summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-09-18 14:14:49 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-09-18 14:14:49 +0000
commit7ef814e80d0c9c0a54668956096f0618bbf932e9 (patch)
treeadb0b60e0bd7b3c6fddd388afc4bcec65975366b /sys/arch
parentd7010c20cff4157dfcb23f4349706b753df22bce (diff)
Some fixes for the signal handling code.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hppa64/hppa64/locore.S4
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c24
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/arch/hppa64/hppa64/locore.S b/sys/arch/hppa64/hppa64/locore.S
index a7143f21340..825c3b4b8d0 100644
--- a/sys/arch/hppa64/hppa64/locore.S
+++ b/sys/arch/hppa64/hppa64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.39 2011/09/18 14:05:38 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.40 2011/09/18 14:14:48 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -1971,12 +1971,14 @@ ENTRY(sigcode,0)
copy %r31, %rp
ldil L%SYSCALLGATE, %r1
+ depd %r0, 31, 32, %r1
copy %r4, %arg0
.call
ble 4(%sr7, %r1)
ldi SYS_sigreturn, %r1
ldil L%SYSCALLGATE, %r1
+ depd %r0, 31, 32, %r1
copy %ret0, %arg0
.call
ble 4(%sr7, %r1)
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index c862da5941a..787cc5d6811 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.40 2011/08/16 17:36:37 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.41 2011/09/18 14:14:48 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -825,14 +825,13 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
{
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_regs;
+ struct pcb *pcb = &p->p_addr->u_pcb;
struct sigacts *psp = p->p_sigacts;
struct sigcontext ksc;
siginfo_t ksi;
register_t scp, sip, zero;
int sss;
- /* TODO sendsig */
-
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) && (!sigpid || p->p_pid == sigpid))
printf("sendsig: %s[%d] sig %d catcher %p\n",
@@ -883,9 +882,10 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_args[2] = tf->tf_r4 = scp;
tf->tf_args[3] = (register_t)catcher;
tf->tf_sp = scp + sss;
- tf->tf_ipsw &= ~(PSL_N|PSL_B);
+ tf->tf_ipsw &= ~(PSL_N|PSL_B|PSL_T);
tf->tf_iioq[0] = HPPA_PC_PRIV_USER | p->p_sigcode;
tf->tf_iioq[1] = tf->tf_iioq[0] + 4;
+ tf->tf_iisq[0] = tf->tf_iisq[1] = pcb->pcb_space;
/* disable tracing in the trapframe */
#ifdef DEBUG
@@ -925,8 +925,6 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval)
struct trapframe *tf = p->p_md.md_regs;
int error;
- /* TODO sigreturn */
-
scp = SCARG(uap, sigcntxp);
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) && (!sigpid || p->p_pid == sigpid))
@@ -956,9 +954,17 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval)
bcopy(ksc.sc_fpregs, &p->p_addr->u_pcb.pcb_fpstate->hfp_regs,
sizeof(ksc.sc_fpregs));
- tf->tf_iioq[0] = ksc.sc_pcoqh;
- tf->tf_iioq[1] = ksc.sc_pcoqt;
- tf->tf_ipsw = ksc.sc_ps;
+ tf->tf_iioq[0] = ksc.sc_pcoqh | HPPA_PC_PRIV_USER;
+ tf->tf_iioq[1] = ksc.sc_pcoqt | HPPA_PC_PRIV_USER;
+ if ((tf->tf_iioq[0] & ~PAGE_MASK) == SYSCALLGATE)
+ tf->tf_iisq[0] = HPPA_SID_KERNEL;
+ else
+ tf->tf_iisq[0] = p->p_addr->u_pcb.pcb_space;
+ if ((tf->tf_iioq[0] & ~PAGE_MASK) == SYSCALLGATE)
+ tf->tf_iisq[0] = HPPA_SID_KERNEL;
+ else
+ tf->tf_iisq[0] = p->p_addr->u_pcb.pcb_space;
+ tf->tf_ipsw = ksc.sc_ps | (curcpu()->ci_psw & PSL_O);
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) && (!sigpid || p->p_pid == sigpid))