From 80bded6289b1af0ad5a0842a7964cedf11dc65bf Mon Sep 17 00:00:00 2001 From: drochner Date: Fri, 26 Mar 2004 14:11:01 +0000 Subject: [PATCH] To the rest of the kernel, pretend that hppa supports SIGINFO. There are still only "sigcontext" stackframes passed to the user, but at least we can clean up the MI sources now. --- sys/arch/hp700/hp700/genassym.cf | 4 +-- sys/arch/hppa/hppa/fpu.c | 11 +++++--- sys/arch/hppa/hppa/sig_machdep.c | 14 +++++++---- sys/arch/hppa/hppa/sigcode.S | 4 +-- sys/arch/hppa/hppa/trap.c | 43 ++++++++++++++++++++++---------- sys/arch/hppa/include/signal.h | 4 ++- 6 files changed, 53 insertions(+), 27 deletions(-) diff --git a/sys/arch/hp700/hp700/genassym.cf b/sys/arch/hp700/hp700/genassym.cf index 1330911683cc..9caf6f8f705f 100644 --- a/sys/arch/hp700/hp700/genassym.cf +++ b/sys/arch/hp700/hp700/genassym.cf @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.5 2003/08/31 01:26:31 chs Exp $ +# $NetBSD: genassym.cf,v 1.6 2004/03/26 14:11:01 drochner Exp $ # $OpenBSD: genassym.cf,v 1.18 2001/09/20 18:31:14 mickey Exp $ @@ -205,4 +205,4 @@ member U_PCB u_pcb export SYSCALLGATE export SYS_exit export SYS_execve -export SYS___sigreturn14 +export SYS_compat_16___sigreturn14 diff --git a/sys/arch/hppa/hppa/fpu.c b/sys/arch/hppa/hppa/fpu.c index 7954599593b7..ebb791d2a95a 100644 --- a/sys/arch/hppa/hppa/fpu.c +++ b/sys/arch/hppa/hppa/fpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.c,v 1.4 2003/11/28 19:02:25 chs Exp $ */ +/* $NetBSD: fpu.c,v 1.5 2004/03/26 14:11:01 drochner Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.4 2003/11/28 19:02:25 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.5 2004/03/26 14:11:01 drochner Exp $"); #include #include @@ -89,6 +89,9 @@ paddr_t fpu_cur_uspace; /* In locore.S, this swaps states in and out of the FPU. */ void hppa_fpu_swap(struct user *, struct user *); +/* XXX see trap.c */ +void hppa_trapsignal_hack(struct lwp *, int, u_long); + #ifdef FPEMUL /* * Given a trapframe and a general register number, the @@ -384,7 +387,7 @@ hppa_fpu_emulate(struct trapframe *frame, struct lwp *l) case 0x09: case 0x0b: if (hppa_fpu_ls(frame, l) != 0) - trapsignal(l, SIGSEGV, frame->tf_iioq_head); + hppa_trapsignal_hack(l, SIGSEGV, frame->tf_iioq_head); return; case 0x0c: exception = decode_0c(inst, class, sub, fpregs); @@ -404,7 +407,7 @@ hppa_fpu_emulate(struct trapframe *frame, struct lwp *l) } if (exception) - trapsignal(l, (exception & UNIMPLEMENTEDEXCEPTION) ? + hppa_trapsignal_hack(l, (exception & UNIMPLEMENTEDEXCEPTION) ? SIGILL : SIGFPE, frame->tf_iioq_head); } diff --git a/sys/arch/hppa/hppa/sig_machdep.c b/sys/arch/hppa/hppa/sig_machdep.c index 9c722693e74d..e146de38d1f9 100644 --- a/sys/arch/hppa/hppa/sig_machdep.c +++ b/sys/arch/hppa/hppa/sig_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sig_machdep.c,v 1.7 2003/11/28 19:02:25 chs Exp $ */ +/* $NetBSD: sig_machdep.c,v 1.8 2004/03/26 14:11:01 drochner Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -111,7 +111,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.7 2003/11/28 19:02:25 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.8 2004/03/26 14:11:01 drochner Exp $"); #include "opt_compat_netbsd.h" @@ -144,8 +144,12 @@ int sigpid = 0; * Send an interrupt to process. */ void -sendsig(int sig, const sigset_t *mask, u_long code) +sendsig(const struct ksiginfo *ksi, const sigset_t *mask) { + /* XXX we don't deliver siginfo yet */ + int sig = ksi->ksi_signo; + u_long code = ksi->ksi_trap; + struct lwp *l = curlwp; struct proc *p = l->l_proc; struct sigacts *ps = p->p_sigacts; @@ -273,9 +277,9 @@ sendsig(int sig, const sigset_t *mask, u_long code) } int -sys___sigreturn14(struct lwp *l, void *v, register_t *retval) +compat_16_sys___sigreturn14(struct lwp *l, void *v, register_t *retval) { - struct sys___sigreturn14_args /* { + struct compat_16_sys___sigreturn14_args /* { syscallarg(struct sigcontext *) sigcntxp; } */ *uap = v; struct proc *p = l->l_proc; diff --git a/sys/arch/hppa/hppa/sigcode.S b/sys/arch/hppa/hppa/sigcode.S index 081b36177452..e2e6c00a4040 100644 --- a/sys/arch/hppa/hppa/sigcode.S +++ b/sys/arch/hppa/hppa/sigcode.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigcode.S,v 1.4 2003/10/10 15:07:43 chs Exp $ */ +/* $NetBSD: sigcode.S,v 1.5 2004/03/26 14:11:01 drochner Exp $ */ /* $OpenBSD: locore.S,v 1.46 2001/09/20 18:33:03 mickey Exp $ */ @@ -112,7 +112,7 @@ L$sigcode_bounce: ldil L%SYSCALLGATE, %r1 .call ble 4(%sr7, %r1) - ldi SYS___sigreturn14, %t1 + ldi SYS_compat_16___sigreturn14, %t1 /* Make a SYS_exit system call. */ copy %ret0, %arg0 ldil L%SYSCALLGATE, %r1 diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index ba4fcd48b9e2..52dd3f21902f 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.15 2004/03/14 01:08:47 cl Exp $ */ +/* $NetBSD: trap.c,v 1.16 2004/03/26 14:11:01 drochner Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.15 2004/03/14 01:08:47 cl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.16 2004/03/26 14:11:01 drochner Exp $"); /* #define INTRDEBUG */ /* #define TRAPDEBUG */ @@ -176,6 +176,9 @@ volatile int astpending; void pmap_hptdump(void); void syscall(struct trapframe *, int *); +/* XXX */ +void hppa_trapsignal_hack(struct lwp *, int, u_long); + #ifdef USERTRACE /* * USERTRACE is a crude facility that traces the PC of @@ -618,7 +621,7 @@ trap(int type, struct trapframe *frame) * We don't have FPU emulation, so signal the * process with a SIGFPE. */ - trapsignal(l, SIGFPE, frame->tf_iioq_head); + hppa_trapsignal_hack(l, SIGFPE, frame->tf_iioq_head); #endif /* !FPEMUL */ break; @@ -641,7 +644,7 @@ trap(int type, struct trapframe *frame) #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGILL, frame->tf_iioq_head); + hppa_trapsignal_hack(l, SIGILL, frame->tf_iioq_head); break; } if (trap_kdebug(type, va, frame)) @@ -658,11 +661,11 @@ trap(int type, struct trapframe *frame) break; case T_EXCEPTION | T_USER: /* co-proc assist trap */ - trapsignal(l, SIGFPE, va); + hppa_trapsignal_hack(l, SIGFPE, va); break; case T_OVERFLOW | T_USER: - trapsignal(l, SIGFPE, va); + hppa_trapsignal_hack(l, SIGFPE, va); break; case T_CONDITION | T_USER: @@ -672,32 +675,32 @@ trap(int type, struct trapframe *frame) #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGILL, va); + hppa_trapsignal_hack(l, SIGILL, va); break; case T_PRIV_OP | T_USER: #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGILL, va); + hppa_trapsignal_hack(l, SIGILL, va); break; case T_PRIV_REG | T_USER: #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGILL, va); + hppa_trapsignal_hack(l, SIGILL, va); break; /* these should never got here */ case T_HIGHERPL | T_USER: case T_LOWERPL | T_USER: - trapsignal(l, SIGSEGV, va); + hppa_trapsignal_hack(l, SIGSEGV, va); break; case T_IPROT | T_USER: case T_DPROT | T_USER: - trapsignal(l, SIGSEGV, va); + hppa_trapsignal_hack(l, SIGSEGV, va); break; case T_DATACC: case T_USER | T_DATACC: @@ -774,7 +777,7 @@ printf("trapsignal: uvm_fault(%p, %x, %d, %d)=%d\n", #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGSEGV, frame->tf_ior); + hppa_trapsignal_hack(l, SIGSEGV, frame->tf_ior); } else { if (l && l->l_addr->u_pcb.pcb_onfault) { #ifdef PMAPDEBUG @@ -802,7 +805,7 @@ if (trap_kdebug (type, va, frame)) #ifdef DEBUG user_backtrace(frame, l, type); #endif - trapsignal(l, SIGBUS, va); + hppa_trapsignal_hack(l, SIGBUS, va); break; case T_INTERRUPT: @@ -1167,3 +1170,17 @@ upcallret(struct lwp *l) { userret(l, l->l_md.md_regs->tf_iioq_head, 0); } + +/* + * XXX for transition to SIGINFO + */ +void +hppa_trapsignal_hack(struct lwp *l, int signum, u_long code) +{ + ksiginfo_t ksi; + + KSI_INIT_TRAP(&ksi); + ksi.ksi_signo = signum; + ksi.ksi_trap = (int)code; + trapsignal(l, &ksi); +} diff --git a/sys/arch/hppa/include/signal.h b/sys/arch/hppa/include/signal.h index 722543acd372..92dfd433346a 100644 --- a/sys/arch/hppa/include/signal.h +++ b/sys/arch/hppa/include/signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.3 2003/09/20 22:26:16 matt Exp $ */ +/* $NetBSD: signal.h,v 1.4 2004/03/26 14:11:01 drochner Exp $ */ /* $OpenBSD: signal.h,v 1.1 1998/06/23 19:45:27 mickey Exp $ */ @@ -36,6 +36,8 @@ typedef int sig_atomic_t; +#define __HAVE_SIGINFO + #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) #include /* codes for SIGILL, SIGFPE */ #endif