summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-02-20 18:35:44 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-02-20 18:35:44 +0000
commitbab488fcfb90d7b7090fa84aad7392abd3ef2c56 (patch)
tree79f9f7acb26c465e39370a5591f508fb93a9fc93 /sys/arch
parenta7ba0924ae2eb011fe89230eaebfa5a81a55036b (diff)
Preserve pcb_onfault within kcopy(), as expected and as all other platforms do.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m88k/m88k/subr.S15
-rw-r--r--sys/arch/mips64/mips64/lcore_access.S21
2 files changed, 22 insertions, 14 deletions
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index d03edba7c2e..2062bfbdafc 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.16 2007/12/22 17:14:39 miod Exp $ */
+/* $OpenBSD: subr.S,v 1.17 2008/02/20 18:35:41 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -361,7 +361,7 @@ ASLOCAL(Lcidone)
ldcr r5, CPU
ld r6, r5, CI_CURPCB
jmp.n r1
- st r0,r6,PCB_ONFAULT
+ st r0, r6, PCB_ONFAULT
ASLOCAL(Lciflt)
br.n _ASM_LABEL(Lcidone)
@@ -637,7 +637,7 @@ ASLOCAL(Lcodone)
ldcr r5, CPU
ld r6, r5, CI_CURPCB
jmp.n r1
- st r0,r6,PCB_ONFAULT /* clear the handler */
+ st r0, r6, PCB_ONFAULT /* clear the handler */
ASLOCAL(Lcoflt)
br.n _ASM_LABEL(Lcodone)
@@ -705,7 +705,7 @@ ASLOCAL(Lcosdone)
ldcr r5, CPU
ld r6, r5, CI_CURPCB
jmp.n r1
- st r0,r6,PCB_ONFAULT /* clear the handler */
+ st r0, r6, PCB_ONFAULT /* clear the handler */
#undef SRC
#undef DEST
@@ -720,10 +720,13 @@ ASLOCAL(Lcosdone)
* Copy len bytes from src to dst, aborting if we encounter a page fault.
*/
ENTRY(kcopy)
+ subu r31, r31, 16
ldcr r5, CPU
ld r6, r5, CI_CURPCB
or.u r5, r0, hi16(_ASM_LABEL(kcopy_fault))
+ ld r7, r6, PCB_ONFAULT
or r5, r5, lo16(_ASM_LABEL(kcopy_fault))
+ st r7, r31, 0 /* save old pcb_onfault */
st r5, r6, PCB_ONFAULT /* pcb_onfault = kcopy_fault */
bcnd le0,r4,_ASM_LABEL(kcopy_out) /* nothing to do if <= 0 */
/*
@@ -973,9 +976,11 @@ ASLOCAL(kcopy_out)
or r2, r0, 0 /* return success */
ASLOCAL(kcopy_out_fault)
ldcr r5, CPU
+ ld r7, r31, 0
ld r6, r5, CI_CURPCB
+ add r31, r31, 16
jmp.n r1 /* all done, return to caller */
- st r0, r6, PCB_ONFAULT /* clear the handler */
+ st r7, r6, PCB_ONFAULT /* restore previous pcb_onfault */
ASLOCAL(kcopy_fault)
br.n _ASM_LABEL(kcopy_out_fault)
diff --git a/sys/arch/mips64/mips64/lcore_access.S b/sys/arch/mips64/mips64/lcore_access.S
index ca52a6053cf..5606a946978 100644
--- a/sys/arch/mips64/mips64/lcore_access.S
+++ b/sys/arch/mips64/mips64/lcore_access.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcore_access.S,v 1.10 2007/05/20 14:34:23 miod Exp $ */
+/* $OpenBSD: lcore_access.S,v 1.11 2008/02/20 18:35:43 miod Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -415,19 +415,22 @@ _copyerr:
/*
* kcopy is a wrapper around bcopy that catches bad memory references.
*/
-NON_LEAF(kcopy, FRAMESZ(CF_SZ), ra)
- PTR_SUBU sp, sp, FRAMESZ(CF_SZ)
- .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ))
- PTR_S ra, CF_RA_OFFS(sp)
- li v0, KT_KCOPYERR
+NON_LEAF(kcopy, FRAMESZ(CF_SZ + REGSZ), ra)
+ PTR_SUBU sp, sp, FRAMESZ(CF_SZ + REGSZ)
+ .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ + REGSZ))
+ PTR_S ra, CF_RA_OFFS + REGSZ(sp)
PTR_L t3, curprocpaddr
+ lw v1, PCB_ONFAULT(t3)
+ li v0, KT_KCOPYERR
+ PTR_S v1, CF_ARGSZ(sp) # save old pcb_onfault
jal bcopy
sw v0, PCB_ONFAULT(t3)
- PTR_L ra, CF_RA_OFFS(sp)
+ PTR_L v0, CF_ARGSZ(sp)
PTR_L t3, curprocpaddr
- sw zero, PCB_ONFAULT(t3)
- PTR_ADDU sp, sp, FRAMESZ(CF_SZ)
+ PTR_L ra, CF_RA_OFFS + REGSZ(sp)
+ sw v0, PCB_ONFAULT(t3)
+ PTR_ADDU sp, sp, FRAMESZ(CF_SZ + REGSZ)
j ra
move v0, zero
END(kcopy)