diff -Nrc uml-linux-2.4.22/arch/um/kernel/process.c sysemu-uml-linux-2.4.22/arch/um/kernel/process.c *** uml-linux-2.4.22/arch/um/kernel/process.c Tue Oct 14 15:28:28 2003 --- sysemu-uml-linux-2.4.22/arch/um/kernel/process.c Thu Dec 4 20:14:33 2003 *************** *** 222,227 **** --- 222,243 ---- } stop_ptraced_child(pid, stack, 0); printk("OK\n"); + + #ifdef PTRACE_SYSEMU + printk("Checking syscall emulation patch for ptrace..."); + + use_sysemu = 0; + pid = start_ptraced_child(&stack); + if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0) + { + printk("OK\n"); + use_sysemu = 1; + } + else + printk("missing\n"); + + stop_ptraced_child(pid, stack, 0); + #endif } int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) diff -Nrc uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h sysemu-uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h *** uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h Tue Oct 14 15:28:28 2003 --- sysemu-uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h Thu Dec 4 20:15:34 2003 *************** *** 10,15 **** --- 10,22 ---- #ifdef UML_CONFIG_MODE_SKAS + /* syscall emulation path in ptrace */ + + #ifndef PTRACE_SYSEMU + #define PTRACE_SYSEMU 25 + #endif + extern int use_sysemu; + #include "skas_ptregs.h" #define HOST_FRAME_SIZE 17 diff -Nrc uml-linux-2.4.22/arch/um/kernel/skas/process.c sysemu-uml-linux-2.4.22/arch/um/kernel/skas/process.c *** uml-linux-2.4.22/arch/um/kernel/skas/process.c Wed Dec 3 18:53:54 2003 --- sysemu-uml-linux-2.4.22/arch/um/kernel/skas/process.c Fri Dec 5 17:57:03 2003 *************** *** 27,32 **** --- 27,36 ---- #include "skas_ptrace.h" #include "chan_user.h" + #ifdef PTRACE_SYSEMU + int use_sysemu = 0; + #endif + int is_skas_winch(int pid, int fd, void *data) { if(pid != getpid()) *************** *** 65,85 **** return; } ! err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); ! if(err < 0) ! panic("handle_trap - nullifying syscall failed errno = %d\n", ! errno); ! err = ptrace(PTRACE_SYSCALL, pid, 0, 0); ! if(err < 0) ! panic("handle_trap - continuing to end of syscall failed, " ! "errno = %d\n", errno); ! ! err = waitpid(pid, &status, WUNTRACED); ! if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) ! panic("handle_trap - failed to wait at end of syscall, " ! "errno = %d, status = %d\n", errno, status); handle_syscall(regs); } --- 69,91 ---- return; } ! if (!use_sysemu) ! { ! err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); ! if(err < 0) ! panic("handle_trap - nullifying syscall failed errno = %d\n", ! errno); ! err = ptrace(PTRACE_SYSCALL, pid, 0, 0); ! if(err < 0) ! panic("handle_trap - continuing to end of syscall failed, " ! "errno = %d\n", errno); + err = waitpid(pid, &status, WUNTRACED); + if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) + panic("handle_trap - failed to wait at end of syscall, " + "errno = %d, status = %d\n", errno, status); + } handle_syscall(regs); } *************** *** 134,140 **** --- 140,154 ---- restore_registers(regs); + #ifdef PTRACE_SYSEMU + if (use_sysemu) + err = ptrace(PTRACE_SYSEMU, userspace_pid, 0, 0); + else + err = ptrace(PTRACE_SYSCALL, userspace_pid, 0, 0); + #else err = ptrace(PTRACE_SYSCALL, userspace_pid, 0, 0); + #endif + if(err) panic("userspace - PTRACE_SYSCALL failed, errno = %d\n", errno); *************** *** 172,179 **** --- 186,202 ---- restore_registers(regs); + #ifdef PTRACE_SYSEMU + if (use_sysemu) + op = singlestepping_skas() ? PTRACE_SINGLESTEP : + PTRACE_SYSEMU; + else + op = singlestepping_skas() ? PTRACE_SINGLESTEP : + PTRACE_SYSCALL; + #else op = singlestepping_skas() ? PTRACE_SINGLESTEP : PTRACE_SYSCALL; + #endif err = ptrace(op, userspace_pid, 0, 0); if(err) panic("userspace - PTRACE_SYSCALL failed, "