2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
9 #include <sys/ptrace.h>
10 #include <asm/unistd.h>
11 #include "sysdep/ptrace.h"
12 #include "sigcontext.h"
13 #include "ptrace_user.h"
15 #include "user_util.h"
16 #include "kern_util.h"
17 #include "syscall_user.h"
21 void syscall_handler_tt(int sig, union uml_pt_regs *regs)
27 syscall = UPT_SYSCALL_NR(regs);
31 index = record_syscall_start(syscall);
32 syscall_trace(regs, 0);
33 result = execute_syscall(regs);
35 /* regs->sc may have changed while the system call ran (there may
36 * have been an interrupt or segfault), so it needs to be refreshed.
40 SC_SET_SYSCALL_RETURN(sc, result);
42 syscall_trace(regs, 1);
43 record_syscall_end(index, result);
46 void do_sigtrap(void *task)
48 UPT_SYSCALL_NR(TASK_REGS(task)) = -1;
51 void do_syscall(void *task, int pid, int local_using_sysemu)
53 unsigned long proc_regs[FRAME_SIZE];
55 if(ptrace_getregs(pid, proc_regs) < 0)
56 tracer_panic("Couldn't read registers");
58 UPT_SYSCALL_NR(TASK_REGS(task)) = PT_SYSCALL_NR(proc_regs);
60 if(((unsigned long *) PT_IP(proc_regs) >= &_stext) &&
61 ((unsigned long *) PT_IP(proc_regs) <= &_etext))
62 tracer_panic("I'm tracing myself and I can't get out");
64 /* advanced sysemu mode set syscall number to -1 automatically */
65 if (local_using_sysemu==2)
68 /* syscall number -1 in sysemu skips syscall restarting in host */
69 if(ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
70 local_using_sysemu ? -1 : __NR_getpid) < 0)
71 tracer_panic("do_syscall : Nullifying syscall failed, "
76 * Overrides for Emacs so that we follow Linus's tabbing style.
77 * Emacs will notice this stuff at the end of the file and automatically
78 * adjust the settings for this buffer only. This must remain at the end
80 * ---------------------------------------------------------------------------
82 * c-file-style: "linux"