]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/um/kernel/um_arch.c
uml: deal with inaccessible address space start
[karo-tx-linux.git] / arch / um / kernel / um_arch.c
index a6c1dd1cf5a17a7806401e7b6fb97c3e2ceacd26..d1fe2224ddab898dd12817124f6b18fb3217dae3 100644 (file)
@@ -259,6 +259,7 @@ 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;
        char * mode;
 
        for (i = 1; i < argc; i++) {
@@ -272,7 +273,7 @@ int __init linux_main(int argc, char **argv)
        if (have_root == 0)
                add_arg(DEFAULT_COMMAND_LINE);
 
-       host_task_size = os_get_task_size();
+       host_task_size = os_get_top_address();
        /*
         * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps
         * out
@@ -347,7 +348,9 @@ int __init linux_main(int argc, char **argv)
        }
 
        virtmem_size = physmem_size;
-       avail = TASK_SIZE - 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;