From d865ff74ba096d016c9b1542a4e3d305169c9e55 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Mon, 21 Dec 2020 01:41:55 +0100 Subject: hurd: implement SA_SIGINFO signal handlers. SA_SIGINFO is actually just another way of expressing what we were already passing over with struct sigcontext. This just introduces the SIGINFO interface and fixes the posix values when that interface is requested by the application. --- hurd/hurd/signal.h | 5 +++++ hurd/hurdfault.c | 2 +- hurd/hurdinit.c | 2 +- hurd/hurdsig.c | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'hurd') diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index c11f841..f6f9121 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -288,6 +288,11 @@ extern int _hurd_raise_signal (struct hurd_sigstate *ss, int signo, extern void _hurd_exception2signal (struct hurd_signal_detail *detail, int *signo); +/* Translate a Mach exception into a signal with a legacy sigcode. */ + +extern void _hurd_exception2signal_legacy (struct hurd_signal_detail *detail, + int *signo); + /* Make the thread described by SS take the signal described by SIGNO and DETAIL. If the process is traced, this will in fact stop with a SIGNO diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c index fa28347..6df1016 100644 --- a/hurd/hurdfault.c +++ b/hurd/hurdfault.c @@ -70,7 +70,7 @@ _hurdsig_fault_catch_exception_raise (mach_port_t port, codes into a signal number and subcode. */ _hurd_exception2signal (&d, &signo); - return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.code) + return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.exc_subcode) ? 0 : EGREGIOUS; } diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c index 7faa51b..daa4791 100644 --- a/hurd/hurdinit.c +++ b/hurd/hurdinit.c @@ -205,7 +205,7 @@ _hurd_new_proc_init (char **argv, /* This process is "traced", meaning it should stop on signals or exec. We are all set up now to handle signals. Stop ourselves, to inform our parent (presumably a debugger) that the exec has completed. */ - __msg_sig_post (_hurd_msgport, SIGTRAP, 0, __mach_task_self ()); + __msg_sig_post (_hurd_msgport, SIGTRAP, TRAP_TRACE, __mach_task_self ()); } #include diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 2b778d6..852ae7e 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -735,7 +735,7 @@ post_signal (struct hurd_sigstate *ss, { /* PE cannot be null. */ do { - if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code)) + if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->exc_subcode)) { if (pe->preemptor) { @@ -1379,7 +1379,7 @@ _S_msg_sig_post (mach_port_t me, if (err = signal_allowed (signo, refport)) return err; - d.code = sigcode; + d.code = d.exc_subcode = sigcode; d.exc = 0; /* Post the signal to a global receiver thread (or mark it pending in @@ -1408,7 +1408,7 @@ _S_msg_sig_post_untraced (mach_port_t me, if (err = signal_allowed (signo, refport)) return err; - d.code = sigcode; + d.code = d.exc_subcode = sigcode; d.exc = 0; /* Post the signal to the designated signal-receiving thread. This will -- cgit v1.1