]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/um/kernel/um_arch.c
Merge branch 'linus' into tracing/mmiotrace-mergefixups
[linux-2.6-omap-h63xx.git] / arch / um / kernel / um_arch.c
index 468aba990dbd1652add865bb88f1006ece3a7d16..8d84250324b3d2c41d2a6718e7fd0531ecd025b4 100644 (file)
@@ -115,7 +115,7 @@ static int have_root __initdata = 0;
 /* Set in uml_mem_setup and modified in linux_main */
 long long physmem_size = 32 * 1024 * 1024;
 
-static char *usage_string =
+static const char *usage_string =
 "User Mode Linux v%s\n"
 "      available at http://user-mode-linux.sourceforge.net/\n\n";
 
@@ -150,7 +150,7 @@ __uml_setup("root=", uml_root_setup,
 static int __init no_skas_debug_setup(char *line, int *add)
 {
        printf("'debug' is not necessary to gdb UML in skas mode - run \n");
-       printf("'gdb linux'");
+       printf("'gdb linux'\n");
 
        return 0;
 }
@@ -202,7 +202,7 @@ static void __init uml_checksetup(char *line, int *add)
 
        p = &__uml_setup_start;
        while (p < &__uml_setup_end) {
-               int n;
+               size_t n;
 
                n = strlen(p->str);
                if (!strncmp(line, p->str, n) && p->setup_func(line + n, add))
@@ -241,6 +241,11 @@ static struct notifier_block panic_exit_notifier = {
 };
 
 /* Set during early boot */
+unsigned long task_size;
+EXPORT_SYMBOL(task_size);
+
+unsigned long host_task_size;
+
 unsigned long brk_start;
 unsigned long end_iomem;
 EXPORT_SYMBOL(end_iomem);
@@ -253,7 +258,9 @@ int __init linux_main(int argc, char **argv)
 {
        unsigned long avail, diff;
        unsigned long virtmem_size, max_physmem;
-       unsigned int i, add;
+       unsigned long stack;
+       unsigned int i;
+       int add;
        char * mode;
 
        for (i = 1; i < argc; i++) {
@@ -267,6 +274,13 @@ int __init linux_main(int argc, char **argv)
        if (have_root == 0)
                add_arg(DEFAULT_COMMAND_LINE);
 
+       host_task_size = os_get_top_address();
+       /*
+        * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps
+        * out
+        */
+       task_size = host_task_size & PGDIR_MASK;
+
        /* OS sanity checks that need to happen before the kernel runs */
        os_early_checks();
 
@@ -303,7 +317,7 @@ int __init linux_main(int argc, char **argv)
 
        highmem = 0;
        iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
-       max_physmem = CONFIG_TOP_ADDR - uml_physmem - iomem_size - MIN_VMALLOC;
+       max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC;
 
        /*
         * Zones have to begin on a 1 << MAX_ORDER page boundary,
@@ -335,7 +349,9 @@ int __init linux_main(int argc, char **argv)
        }
 
        virtmem_size = physmem_size;
-       avail = CONFIG_TOP_ADDR - start_vm;
+       stack = (unsigned long) argv;
+       stack &= ~(1024 * 1024 - 1);
+       avail = stack - start_vm;
        if (physmem_size > avail)
                virtmem_size = avail;
        end_vm = start_vm + virtmem_size;