]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
uml: remove task_protections
authorJeff Dike <jdike@addtoit.com>
Fri, 11 May 2007 05:22:30 +0000 (22:22 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 11 May 2007 15:29:33 +0000 (08:29 -0700)
Replaced task_protections with stack_protections since they do the same
thing, and task_protections was misnamed anyway.

This needs THREAD_SIZE, so that's imported via common-offsets.h

Also tidied up the code in the vicinity.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/include/common-offsets.h
arch/um/include/os.h
arch/um/kernel/tt/exec_kern.c
arch/um/kernel/tt/process_kern.c
arch/um/kernel/um_arch.c
arch/um/os-Linux/util.c

index 5593a802708321ac919247574bf16ec48856c246..541f4a8ca512ab3519a19005e490b2a9246d7ae3 100644 (file)
@@ -28,3 +28,5 @@ DEFINE(UM_NR_CPUS, NR_CPUS);
 
 /* For crypto assembler code. */
 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
+
+DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
index 688d181b5f8ae602fb34509cbd876fd343aa273a..4d9fb26387d565290a58ef093d34f3c25d10042b 100644 (file)
@@ -272,7 +272,6 @@ extern void do_longjmp(void *p, int val);
 
 /* util.c */
 extern void stack_protections(unsigned long address);
-extern void task_protections(unsigned long address);
 extern int raw(int fd);
 extern void setup_machinename(char *machine_out);
 extern void setup_hostinfo(char *buf, int len);
index 98e21743e604046da3e324e43215dd5b38129f62..40126cb5180103c194590b6e35d4ff9ae413317e 100644 (file)
@@ -57,7 +57,7 @@ void flush_thread_tt(void)
        enable_timer();
        free_page(stack);
        protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
-       task_protections((unsigned long) current_thread);
+       stack_protections((unsigned long) current_thread);
        force_flush_all();
        unblock_signals();
 }
index c631303cb800cf80a8593a22836b1ee47cf7f7f6..74347adf81bfbcf745f62587d21a0bdaeffb7064 100644 (file)
@@ -209,7 +209,7 @@ void finish_fork_handler(int sig)
        if(current->mm != current->parent->mm)
                protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 
                               1, 0, 1);
-       task_protections((unsigned long) current_thread);
+       stack_protections((unsigned long) current_thread);
 
        free_page(current->thread.temp_stack);
        local_irq_disable();
index 1cf954a47fd7719c83e818e53428f9de027ed99a..ecc458fe51b910d91374664660db4446723fd46d 100644 (file)
@@ -459,7 +459,7 @@ int __init linux_main(int argc, char **argv)
 
        uml_postsetup();
 
-       task_protections((unsigned long) &init_thread_info);
+       stack_protections((unsigned long) &init_thread_info);
        os_flush_stdout();
 
        return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
index c307a89ed2598cef9a0c619cc8576e353115aa54..7cbcf484e13d3337d8bbaaa06d3fed165a02f377 100644 (file)
 
 void stack_protections(unsigned long address)
 {
-       int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
-
-       if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0)
-               panic("protecting stack failed, errno = %d", errno);
-}
-
-void task_protections(unsigned long address)
-{
-       unsigned long guard = address + UM_KERN_PAGE_SIZE;
-       unsigned long stack = guard + UM_KERN_PAGE_SIZE;
-       int prot = 0, pages;
-
-#ifdef notdef
-       if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0)
-               panic("protecting guard page failed, errno = %d", errno);
-#endif
-       pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2;
-       prot = PROT_READ | PROT_WRITE | PROT_EXEC;
-       if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0)
+       if(mprotect((void *) address, UM_THREAD_SIZE,
+                   PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
                panic("protecting stack failed, errno = %d", errno);
 }
 
@@ -72,7 +55,7 @@ int raw(int fd)
 
        /* XXX tcsetattr could have applied only some changes
         * (and cfmakeraw() is a set of changes) */
-       return(0);
+       return 0;
 }
 
 void setup_machinename(char *machine_out)