diff options
author | marcel <marcel@FreeBSD.org> | 2003-11-09 22:17:36 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-11-09 22:17:36 +0000 |
commit | b4eb6c7533882571dfbe765fdf4ce225da688ed8 (patch) | |
tree | bfc9ead6e27d98cf889fe730fafc3b2ae90f6622 /sys/ia64/include/ucontext.h | |
parent | b2bc11d840b269eb5927723a806087bb3444d082 (diff) | |
download | FreeBSD-src-b4eb6c7533882571dfbe765fdf4ce225da688ed8.zip FreeBSD-src-b4eb6c7533882571dfbe765fdf4ce225da688ed8.tar.gz |
Use get_mcontext() to construct the signal context in sendsig() and
use set_mcontext() to restore the context in sigreturn(). Since we
put the syscall number and the syscall arguments in the trapframe
(we don't save the scratch registers for syscalls, which allows us
to reuse the space to our advantage), create a MD specific flag so
that we save the scratch registers even for syscalls. We would not
be able to restart a syscall otherwise.
The signal trampoline does not need to flush the regiters anymore,
because get_mcontext() already handles that. In fact, if we set up
the context correctly, we do not need to have a trampoline at all.
This change however only minimally changes the trampoline code. In
follow-up commits this can be further optimized.
Note that normally we preserve cfm and iip in the trapframe created
by the EPC syscall path when we restore a context in set_mcontext()
because those fields are not normally set for a synchronuous context.
The kernel puts the return address and frame info of the syscall
stub in there. By preserving these fields we hide this detail from
userland which allows us to use setcontext(2) for user created
contexts. However, sigreturn() is commonly called from the trampoline,
which means that if we preserve cfm and iip in all cases, we would
return to the trampoline after the sigreturn(), which means we hit
the safety net: we call exit(2). So, we do not preserve cfm and iip
when we have a synchronous context that also has scratch registers
(the uncommon context created by sendsig() only), under the assumption
that if such a context is created in userland, something special is
going on and the use of cfm and iip is then just another quirk. All
this is invisible in the common case.
Diffstat (limited to 'sys/ia64/include/ucontext.h')
-rw-r--r-- | sys/ia64/include/ucontext.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/ia64/include/ucontext.h b/sys/ia64/include/ucontext.h index 66f8fff..0ff1e29 100644 --- a/sys/ia64/include/ucontext.h +++ b/sys/ia64/include/ucontext.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999 Marcel Moolenaar + * Copyright (c) 1999, 2003 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,4 +96,9 @@ typedef struct __mcontext { struct _high_fp mc_high_fp; } mcontext_t; +#ifdef _KERNEL +/* Flags for get_mcontext(). See also <sys/ucontext.h>. */ +#define GET_MC_IA64_SCRATCH 0x10 +#endif + #endif /* !_MACHINE_UCONTEXT_H_ */ |