aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/ptrace.h
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2010-05-23 18:32:02 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2010-05-23 18:32:02 +0000
commitafe1a68827e6810d86163cc8919247f26a9c45b2 (patch)
tree56fad7d2ceb7c32121f981b707c967936cda94bf /sys/sys/ptrace.h
parentfa1ed4bd1ae8cfc4626b6e641390288ed9e4de6c (diff)
downloadsrc-afe1a68827e6810d86163cc8919247f26a9c45b2.tar.gz
src-afe1a68827e6810d86163cc8919247f26a9c45b2.zip
Reorganize syscall entry and leave handling.
Extend struct sysvec with three new elements: sv_fetch_syscall_args - the method to fetch syscall arguments from usermode into struct syscall_args. The structure is machine-depended (this might be reconsidered after all architectures are converted). sv_set_syscall_retval - the method to set a return value for usermode from the syscall. It is a generalization of cpu_set_syscall_retval(9) to allow ABIs to override the way to set a return value. sv_syscallnames - the table of syscall names. Use sv_set_syscall_retval in kern_sigsuspend() instead of hardcoding the call to cpu_set_syscall_retval(). The new functions syscallenter(9) and syscallret(9) are provided that use sv_*syscall* pointers and contain the common repeated code from the syscall() implementations for the architecture-specific syscall trap handlers. Syscallenter() fetches arguments, calls syscall implementation from ABI sysent table, and set up return frame. The end of syscall bookkeeping is done by syscallret(). Take advantage of single place for MI syscall handling code and implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and PL_FLAG_EXEC. The SCE and SCX flags notify the debugger that the thread is stopped at syscall entry or return point respectively. The EXEC flag augments SCX and notifies debugger that the process address space was changed by one of exec(2)-family syscalls. The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are changed to use syscallenter()/syscallret(). MIPS and arm are not converted and use the mostly unchanged syscall() implementation. Reviewed by: jhb, marcel, marius, nwhitehorn, stas Tested by: marcel (ia64), marius (sparc64), nwhitehorn (powerpc), stas (mips) MFC after: 1 month
Notes
Notes: svn path=/head/; revision=208453
Diffstat (limited to 'sys/sys/ptrace.h')
-rw-r--r--sys/sys/ptrace.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index b30447cfb682..a6dbe2cad3e8 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -99,6 +99,9 @@ struct ptrace_lwpinfo {
int pl_flags; /* LWP flags. */
#define PL_FLAG_SA 0x01 /* M:N thread */
#define PL_FLAG_BOUND 0x02 /* M:N bound thread */
+#define PL_FLAG_SCE 0x04 /* syscall enter point */
+#define PL_FLAG_SCX 0x08 /* syscall leave point */
+#define PL_FLAG_EXEC 0x10 /* exec(2) succeeded */
sigset_t pl_sigmask; /* LWP signal mask */
sigset_t pl_siglist; /* LWP pending signal */
};