--- linux-2.6.6/arch/um/kernel/process.c 2004-07-07 06:21:19.144801856 +0200 +++ linux-2.6.6/arch/um/kernel/process.c.sysemu 2004-07-07 06:21:09.136323376 +0200 @@ -41,6 +41,8 @@ #include "skas_ptrace.h" #endif +int sysemu_active=0; + void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) { int flags = 0, pages; @@ -230,12 +232,12 @@ printk("OK\n"); #ifdef PTRACE_SYSEMU - printk("Checking syscall emulation patch for ptrace..."); + printk("Checking syscall emulation patch for ptrace on HOST..."); use_sysemu = 0; pid = start_ptraced_child(&stack); if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0) { - struct user_regs_struct regs; - + struct user_regs_struct regs; + if (waitpid(pid, &status, WUNTRACED) < 0) panic("check_ptrace : wait failed, errno = %d", errno); if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) @@ -252,18 +254,44 @@ stop_ptraced_child(pid, stack, 0); - printk("OK\n"); - use_sysemu = 1; - } - else - { - printk("missing\n"); + printk("Found!\n"); + printk("Syscall emulation is..."); + if(sysemu_active) { + use_sysemu = 1; + printk("On!\n"); + } + else { + use_sysemu = 0; + printk("Off!\n"); + } + + } + else + { + printk("Missing!\n"); + if(sysemu_active) { + printk("Notice: You cannot use syscall emulation on this host!\n"); + } stop_ptraced_child(pid, stack, 1); - } - + } + + # endif /* PTRACE_SYSEMU */ } + +static void sysemufnc(char *str) +{ + sysemu_active=1; +} + +__uml_setup("sysemu",sysemufnc, +"sysemu\n Turn syscall emulation patch for ptrace (SYSEMU) on.\n" +" SYSEMU is a performance-patch introduced by Laurent Vivier. It changes\n" +" behaviour of ptrace() and helps reducing host context switch rate.\n" +" To make it working, you need a kernel patch for your host, too.\n" +" See http://perso.wanadoo.fr/laurent.vivier/UML/ for further information.\n\n"); + int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { jmp_buf buf;