536788fe2d
Calculate TASK_SIZE at run-time by figuring out the host's VMSPLIT - this is needed on i386 if UML is to run on hosts with varying VMSPLITs without recompilation. TASK_SIZE is now defined in terms of a variable, task_size. This gets rid of an include of pgtable.h from processor.h, which can cause include loops. On i386, task_size is calculated early in boot by probing the address space in a binary search to figure out where the boundary between usable and non-usable memory is. This tries to make sure that a page that is considered to be in userspace is, or can be made, read-write. I'm concerned about a system-global VDSO page in kernel memory being hit and considered to be a userspace page. On x86_64, task_size is just the old value of CONFIG_TOP_ADDR. A bunch of config variable are gone now. CONFIG_TOP_ADDR is directly replaced by TASK_SIZE. NEST_LEVEL is gone since the relocation of the stubs makes it irrelevant. All the HOST_VMSPLIT stuff is gone. All references to these in arch/um/Makefile are also gone. I noticed and fixed a missing extern in os.h when adding os_get_task_size. Note: This has been revised to fix the 32-bit UML on 64-bit host bug that Miklos ran into. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
69 lines
1.6 KiB
C
69 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#ifndef __START_H__
|
|
#define __START_H__
|
|
|
|
#include "uml-config.h"
|
|
#include "kern_constants.h"
|
|
|
|
/*
|
|
* Stolen from linux/const.h, which can't be directly included since
|
|
* this is used in userspace code, which has no access to the kernel
|
|
* headers. Changed to be suitable for adding casts to the start,
|
|
* rather than "UL" to the end.
|
|
*/
|
|
|
|
/* Some constant macros are used in both assembler and
|
|
* C code. Therefore we cannot annotate them always with
|
|
* 'UL' and other type specifiers unilaterally. We
|
|
* use the following macros to deal with this.
|
|
*/
|
|
|
|
#ifdef __ASSEMBLY__
|
|
#define _AC(X, Y) (Y)
|
|
#else
|
|
#define __AC(X, Y) (X (Y))
|
|
#define _AC(X, Y) __AC(X, Y)
|
|
#endif
|
|
|
|
#define STUB_START _AC(, 0x100000)
|
|
#define STUB_CODE _AC((unsigned long), STUB_START)
|
|
#define STUB_DATA _AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE)
|
|
#define STUB_END _AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE)
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include "sysdep/ptrace.h"
|
|
|
|
struct cpu_task {
|
|
int pid;
|
|
void *task;
|
|
};
|
|
|
|
extern struct cpu_task cpu_tasks[];
|
|
|
|
extern unsigned long low_physmem;
|
|
extern unsigned long high_physmem;
|
|
extern unsigned long uml_physmem;
|
|
extern unsigned long uml_reserved;
|
|
extern unsigned long end_vm;
|
|
extern unsigned long start_vm;
|
|
extern unsigned long long highmem;
|
|
|
|
extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
|
|
extern unsigned long _unprotected_end;
|
|
extern unsigned long brk_start;
|
|
|
|
extern unsigned long host_task_size;
|
|
|
|
extern int linux_main(int argc, char **argv);
|
|
|
|
extern void (*sig_info[])(int, struct uml_pt_regs *);
|
|
|
|
#endif
|
|
|
|
#endif
|