diff options
author | 2017-07-16 22:47:37 +0000 | |
---|---|---|
committer | 2017-07-16 22:47:37 +0000 | |
commit | 69eed90a7a8f9a9f24c7b057864a7c464bc348a6 (patch) | |
tree | 55695cfa124c24962417301efabaa0f5c8920569 | |
parent | Remove the AP from iwm's firmware station table when moving out of AUTH state. (diff) | |
download | wireguard-openbsd-69eed90a7a8f9a9f24c7b057864a7c464bc348a6.tar.xz wireguard-openbsd-69eed90a7a8f9a9f24c7b057864a7c464bc348a6.zip |
Clear the framepointer (r3) in switch_trampoline to avoid faults in stack trace
Reduce size of switch stack frame to match normal 64byte alignment
Eliminate useless 'osp' variable when setting up initial frame in cpu_fork()
ok visa@ kettenis@
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 13 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/vm_machdep.c | 14 |
2 files changed, 14 insertions, 13 deletions
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 7822cf92231..02bba555305 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.198 2017/06/05 18:59:06 deraadt Exp $ */ +/* $OpenBSD: locore.S,v 1.199 2017/07/16 22:47:37 guenther Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -2597,7 +2597,7 @@ ENTRY(cpu_switchto,128) copy r3, r1 stw rp, HPPA_FRAME_CRP(sp) copy sp, r3 - stwm r1, HPPA_FRAME_SIZE+20*4(sp) + stwm r1, HPPA_FRAME_SIZE+16*4(sp) #ifdef DIAGNOSTIC b kstack_check @@ -2686,7 +2686,7 @@ switch_exited mtctl t2, cr30 mtctl t3, pidr2 /* XXX enable interrupts? */ - ldo -(HPPA_FRAME_SIZE+20*4)(sp), r3 + ldo -(HPPA_FRAME_SIZE+16*4)(sp), r3 ldw HPPA_FRAME_ARG(0)(sp), arg0 ldw HPPA_FRAME_ARG(1)(sp), t4 /* in case we're on trampoline */ sub,= r0, t4, r0 @@ -2710,7 +2710,7 @@ switch_exited switch_return ldw HPPA_FRAME_CRP(r3), rp bv 0(rp) - ldwm -(HPPA_FRAME_SIZE+20*4)(sp), r3 + ldwm -(HPPA_FRAME_SIZE+16*4)(sp), r3 EXIT(cpu_switchto) LEAF_ENTRY(cpu_idle_enter) @@ -2729,13 +2729,14 @@ LEAF_ENTRY(cpu_idle_leave) EXIT(cpu_idle_leave) ENTRY(switch_trampoline,0) + copy r0, r3 #ifdef MULTIPROCESSOR - copy t4, r3 + copy t4, r5 copy arg0, r4 bl proc_trampoline_mp, rp nop copy r4, arg0 - copy r3, t4 + copy r5, t4 #endif mfctl cr29, t1 stw r0, CI_CPL(t1) diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index eb517d2def7..afe107dc977 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.82 2017/02/12 04:55:08 guenther Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.83 2017/07/16 22:47:37 guenther Exp $ */ /* * Copyright (c) 1999-2004 Michael Shalayeff @@ -54,7 +54,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, { struct pcb *pcbp; struct trapframe *tf; - register_t sp, osp; + register_t sp; #ifdef DIAGNOSTIC if (round_page(sizeof(struct user)) > NBPG) @@ -112,12 +112,12 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, /* * Build stack frames for the cpu_switchto & co. */ - osp = sp + HPPA_FRAME_SIZE; - *(register_t*)(osp - HPPA_FRAME_SIZE) = 0; - *(register_t*)(osp + HPPA_FRAME_CRP) = (register_t)&switch_trampoline; - *(register_t*)(osp) = (osp - HPPA_FRAME_SIZE); + sp += HPPA_FRAME_SIZE; + *(register_t*)(sp - HPPA_FRAME_SIZE) = 0; + *(register_t*)(sp + HPPA_FRAME_CRP) = (register_t)&switch_trampoline; + *(register_t*)(sp) = (sp - HPPA_FRAME_SIZE); - sp = osp + HPPA_FRAME_SIZE + 20*4; /* frame + callee-saved registers */ + sp += HPPA_FRAME_SIZE + 16*4; /* frame + callee-saved registers */ *HPPA_FRAME_CARG(0, sp) = (register_t)arg; *HPPA_FRAME_CARG(1, sp) = KERNMODE(func); pcbp->pcb_ksp = sp; |