summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-08-27 16:29:23 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-08-27 16:29:23 +0000
commitcda3d88586146367d5bfba84d0b3a3c52ef83f99 (patch)
treef56b810666f4bd339b8478e52e9f8ccd16626c81
parent8e2aeacec1a78201ce908059a149cf53ff570285 (diff)
do not just bail out of the copy loop, but go to the
'done' label for the job finish. major register missallocation for copyonfault, fix it. clean the space regs after use.
-rw-r--r--sys/arch/hppa/hppa/locore.S47
-rw-r--r--sys/lib/libkern/arch/hppa/bcopy.m440
2 files changed, 50 insertions, 37 deletions
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index 7a489870090..a34d423fbd0 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.80 2002/08/13 05:27:44 mickey Exp $ */
+/* $OpenBSD: locore.S,v 1.81 2002/08/27 16:29:22 mickey Exp $ */
/*
* Copyright (c) 1998-2002 Michael Shalayeff
@@ -2220,6 +2220,7 @@ LEAF_ENTRY(name) ! \
#define FUX(name,insn) \
FUSUX(name) ! \
insn 0(sr1, arg0), ret0 ! \
+ mtsp r0, sr1 ! \
bv r0(rp) ! \
stw r1, U_PCB+PCB_ONFAULT(t1) ! \
EXIT(name)
@@ -2227,11 +2228,13 @@ EXIT(name)
#define SUX(name,insn) \
FUSUX(name) ! \
insn arg1, 0(sr1, arg0) ! \
+ mtsp r0, sr1 ! \
bv r0(rp) ! \
stw r1, U_PCB+PCB_ONFAULT(t1) ! \
EXIT(name)
LEAF_ENTRY(fusufault)
+ mtsp r0, sr1
stw r1, U_PCB+PCB_ONFAULT(t1)
ALTENTRY(fusubadaddr)
bv 0(rp)
@@ -2250,7 +2253,11 @@ SUX(suswintr, sth)
.align 64
LEAF_ENTRY(copy_on_fault)
- stw r1, PCB_ONFAULT+U_PCB(t4)
+ mtsp r0, sr1
+ mtsp r0, sr2
+ stw r1, PCB_ONFAULT+U_PCB(r2)
+ ldw HPPA_FRAME_CRP(sp), rp
+ ldo -64(sp), sp
bv 0(rp)
ldi EFAULT, %ret0
EXIT(copy_on_fault)
@@ -2261,40 +2268,42 @@ EXIT(copy_on_fault)
* do a space to space strncpy, return actual copy size in the rsize;
*/
LEAF_ENTRY(spstrcpy)
+ ldw HPPA_FRAME_ARG(4)(sp), t2
+ ldo 64(sp), sp
+ add t2, arg1, t2
+ stw rp, HPPA_FRAME_CRP(sp)
/* setup fault handler */
- ldil L%curproc, t4
- ldw R%curproc(t4), t4
- ldil L%copy_on_fault, t2
- ldw P_ADDR(t4), t4
- ldo R%copy_on_fault(t2), t2
- ldw PCB_ONFAULT+U_PCB(t4), r1
- stw t2, PCB_ONFAULT+U_PCB(t4)
-
- ldw HPPA_FRAME_ARG(4)(sp), ret1
- mfsp sr1, ret0 /* XXX need this? */
- mfsp sr2, ret1 /* XXX need this? */
+ ldil L%curproc, t1
+ ldw R%curproc(t1), t3
+ ldil L%copy_on_fault, t4
+ ldw P_ADDR(t3), r2
+ ldo R%copy_on_fault(t4), t4
+ ldw PCB_ONFAULT+U_PCB(r2), r1
+ stw t4, PCB_ONFAULT+U_PCB(r2)
+
mtsp arg0, sr1
mtsp arg2, sr2
- add ret1, arg1, ret1
copy arg1, arg0
$spstrcpy_loop
ldbs,ma 1(sr1, arg1), t1
- comb,= ret1, arg1, $spstrcpy_exit
+ comb,= t2, arg1, $spstrcpy_exit
stbs,ma t1, 1(sr2, arg3)
comb,<>,n r0, t1, $spstrcpy_loop
nop
$spstrcpy_exit
+ mtsp r0, sr1
+ mtsp r0, sr2
+ stw r1, PCB_ONFAULT+U_PCB(r2)
+ ldw HPPA_FRAME_CRP(sp), rp
sub arg1, arg0, arg1
- mtsp ret0, sr1
- mtsp ret1, sr2 /* XXX need this? */
+ ldo -64(sp), sp
ldw HPPA_FRAME_ARG(5)(sp), arg0
- copy r0, ret0
sub,= r0, arg0, r0
stw arg1, 0(arg0)
bv 0(rp)
- stw r1, PCB_ONFAULT+U_PCB(t4)
+ copy r0, ret0
EXIT(spstrcpy)
diff --git a/sys/lib/libkern/arch/hppa/bcopy.m4 b/sys/lib/libkern/arch/hppa/bcopy.m4
index 363a46588ab..aabab3a0717 100644
--- a/sys/lib/libkern/arch/hppa/bcopy.m4
+++ b/sys/lib/libkern/arch/hppa/bcopy.m4
@@ -1,4 +1,4 @@
-define(_rcsid,``$OpenBSD: bcopy.m4,v 1.12 2002/08/13 05:24:22 mickey Exp $'')dnl
+define(_rcsid,``$OpenBSD: bcopy.m4,v 1.13 2002/08/27 16:29:22 mickey Exp $'')dnl
dnl
dnl
dnl This is the source file for bcopy.S, spcopy.S
@@ -101,7 +101,7 @@ L($1, cleanup)
addib,=,n 4, $6, L($1, done)
ldws 0($2, $3), t1
add $5, $6, $5
- bv r0(rp)
+ b L($1, done)
stbys,E t1, 0($4, $5)
')
dnl
@@ -175,7 +175,7 @@ L($1, cleanup_un)
sub,<= $6, t4, r0
ldws,M F`'4($2, $3), t1
vshd ret1, t1, t2
- bv r0(rp)
+ b L($1, done)
stbys,E t2, 0($4, $5)
L($1, cleanup1_un)
@@ -215,10 +215,10 @@ ALTENTRY(ovbcopy)
ALTENTRY(bcopy)
comb,>,n arg1, arg0, L(bcopy, reverse)
hppa_copy(bcopy_f, sr0, arg0, sr0, arg1, arg2, `+')
- b,n L(bcopy, ret)
+ bv 0(rp)
+ nop
L(bcopy, reverse)
hppa_copy(bcopy_r, sr0, arg0, sr0, arg1, arg2, `-')
-L(bcopy, ret)
bv 0(rp)
nop
EXIT(memcpy)
@@ -239,29 +239,33 @@ ifelse(NAME, `spcopy',
.import curproc, data
.import copy_on_fault, code
LEAF_ENTRY(spcopy)
- ldw HPPA_FRAME_ARG(4)(sp), ret1
- comb,>=,n r0, ret1, L(spcopy, ret)
+ ldw HPPA_FRAME_ARG(4)(sp), ret0
+ sub,<> r0, ret0, r0
+ bv r0(rp)
+ nop
`
+ ldo 64(sp), sp
+ stw rp, HPPA_FRAME_CRP(sp)
/* setup fault handler */
- ldil L%curproc, r31
- ldw R%curproc(r31), r31
+ ldil L%curproc, t1
+ ldw R%curproc(t1), t3
ldil L%copy_on_fault, t2
- ldw P_ADDR(r31), t4
+ ldw P_ADDR(t3), r2
ldo R%copy_on_fault(t2), t2
- ldw PCB_ONFAULT+U_PCB(t4), r1
- stw t2, PCB_ONFAULT+U_PCB(t4)
+ ldw PCB_ONFAULT+U_PCB(r2), r1
+ stw t2, PCB_ONFAULT+U_PCB(r2)
'
- mfsp sr2, ret0 /* XXX need this?, sr1 is scratchable */
mtsp arg0, sr1
mtsp arg2, sr2
- copy ret1, arg0 /* ret1 is used in hppa`'_blcopy() */
- hppa_copy(spcopy, sr1, arg1, sr2, arg3, ret1, `+')
+ hppa_copy(spcopy, sr1, arg1, sr2, arg3, ret0, `+')
+ mtsp r0, sr1
+ mtsp r0, sr2
/* reset fault handler */
- stw r1, PCB_ONFAULT+U_PCB(r31)
- mtsp ret0, sr2
-L(spcopy, ret)
+ stw r1, PCB_ONFAULT+U_PCB(r2)
+ ldw HPPA_FRAME_CRP(sp), rp
+ ldo -64(sp), sp
bv 0(rp)
copy r0, ret0
EXIT(spcopy)