summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/frame.h
diff options
context:
space:
mode:
authorcracauer <cracauer@FreeBSD.org>1999-07-06 07:13:48 +0000
committercracauer <cracauer@FreeBSD.org>1999-07-06 07:13:48 +0000
commit53573bf465904188986e8c982e8019835628d6b2 (patch)
tree3e7334c4226a10712d8c0459ab03a8d400a4eea7 /sys/amd64/include/frame.h
parent0bb9e75fd21026c94438f2db514d21fd69b82377 (diff)
downloadFreeBSD-src-53573bf465904188986e8c982e8019835628d6b2.zip
FreeBSD-src-53573bf465904188986e8c982e8019835628d6b2.tar.gz
Implement SA_SIGINFO for i386. Thanks to Bruce Evans for much more
than a review, this was a nice puzzle. This is supposed to be binary and source compatible with older applications that access the old FreeBSD-style three arguments to a signal handler. Except those applications that access hidden signal handler arguments bejond the documented third one. If you have applications that do, please let me know so that we take the opportunity to provide the functionality they need in a documented manner. Also except application that use 'struct sigframe' directly. You need to recompile gdb and doscmd. `make world` is recommended. Example program that demonstrates how SA_SIGINFO and old-style FreeBSD handlers (with their three args) may be used in the same process is at http://www3.cons.org/tmp/fbsd-siginfo.c Programs that use the old FreeBSD-style three arguments are easy to change to SA_SIGINFO (although they don't need to, since the old style will still work): Old args to signal handler: void handler_sn(int sig, int code, struct sigcontext *scp) New args: void handler_si(int sig, siginfo_t *si, void *third) where: old:code == new:second->si_code old:scp == &(new:si->si_scp) /* Passed by value! */ The latter is also pointed to by new:third, but accessing via si->si_scp is preferred because it is type-save. FreeBSD implementation notes: - This is just the framework to make the interface POSIX compatible. For now, no additional functionality is provided. This is supposed to happen now, starting with floating point values. - We don't use 'sigcontext_t.si_value' for now (POSIX meant it for realtime-related values). - Documentation will be updated when new functionality is added and the exact arguments passed are determined. The comments in sys/signal.h are meant to be useful. Reviewed by: BDE
Diffstat (limited to 'sys/amd64/include/frame.h')
-rw-r--r--sys/amd64/include/frame.h40
1 files changed, 32 insertions, 8 deletions
diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h
index 5c0dcda..f339f01 100644
--- a/sys/amd64/include/frame.h
+++ b/sys/amd64/include/frame.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)frame.h 5.2 (Berkeley) 1/18/91
- * $Id: frame.h,v 1.16 1999/04/28 01:03:59 luoqi Exp $
+ * $Id: frame.h,v 1.17 1999/05/11 16:29:01 luoqi Exp $
*/
#ifndef _MACHINE_FRAME_H_
@@ -158,15 +158,39 @@ struct clockframe {
};
/*
- * Signal frame
+ * Signal frame, arguments passed to application signal handlers.
*/
struct sigframe {
- int sf_signum;
- int sf_code;
- struct sigcontext *sf_scp;
- char *sf_addr;
- sig_t sf_handler;
- struct sigcontext sf_sc;
+ /*
+ * The first three members may be used by applications.
+ */
+
+ register_t sf_signum;
+
+ /*
+ * Either 'int' for old-style FreeBSD handler or 'siginfo_t *'
+ * pointing to sf_siginfo for SA_SIGINFO handlers.
+ */
+ register_t sf_arg2;
+
+ /* Points to sf_siginfo.si_sc. */
+ register_t sf_scp;
+
+ /*
+ * The following arguments are not constrained by the
+ * function call protocol.
+ * Applications are not supposed to access these members,
+ * except using the pointers we provide in the first three
+ * arguments.
+ */
+ char *sf_addr;
+ union {
+ __siginfohandler_t *sf_action;
+ __sighandler_t *sf_handler;
+ } sf_ahu;
+
+ /* In the SA_SIGINFO case, sf_arg2 points here. */
+ siginfo_t sf_siginfo;
};
int kdb_trap __P((int, int, struct trapframe *));
OpenPOWER on IntegriCloud