summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-01-21 20:35:52 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-01-21 20:35:52 +0000
commita7eaac3b940b161944023bffd96cadb92bfa2e55 (patch)
treeec2247773684653962d9353e87ec64f0ee5eb031 /sys/arch
parent1fb357dae99152f2d4a728cfdd6f532de9c1c4f0 (diff)
Argh, correctly handle the maxlen == 0 case.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m68k/m68k/copy.s6
-rw-r--r--sys/arch/mvme88k/mvme88k/locore_asm_routines.S9
2 files changed, 8 insertions, 7 deletions
diff --git a/sys/arch/m68k/m68k/copy.s b/sys/arch/m68k/m68k/copy.s
index ca33c7d49d7..83fb7d9e744 100644
--- a/sys/arch/m68k/m68k/copy.s
+++ b/sys/arch/m68k/m68k/copy.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: copy.s,v 1.12 2002/01/21 19:48:54 miod Exp $ */
+/* $OpenBSD: copy.s,v 1.13 2002/01/21 20:35:49 miod Exp $ */
/* $NetBSD: copy.s,v 1.30 1998/03/04 06:39:14 thorpej Exp $ */
/*-
@@ -262,6 +262,8 @@ Lcisloop:
Lcistoolong:
moveq #ENAMETOOLONG,d0 | ran out of space
Lcisnull:
+ cmpl sp@(8),a1 | do not attempt to clear last byte
+ beq Lcisdone | if we faulted on first write
subql #1, a1
clrb a1@+ | clear last byte
Lcisdone:
@@ -276,8 +278,6 @@ Lcisexit:
rts
Lcisfault:
moveq #EFAULT,d0
- cmpl sp@(8),a1 | do not attempt to clear last byte
- beq Lcisdone | if we faulted on first write
bra Lcisnull
/*
diff --git a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
index 7dcde6cf05c..73b31afa46b 100644
--- a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
+++ b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_asm_routines.S,v 1.19 2002/01/21 19:59:19 miod Exp $ */
+/* $OpenBSD: locore_asm_routines.S,v 1.20 2002/01/21 20:35:51 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -568,9 +568,9 @@ ENTRY(copyinstr)
or.u r6, r0, hi16(.Lcisflt)
or r6, r6, lo16(.Lcisflt)
st r6, r7, PCB_ONFAULT
+ or r6, r0, 0
bcnd lt0, CNT, .Lcisflt
bcnd eq0, CNT, .Lcistoolong
- or r6, r0, 0
1:
#ifdef ERRATA__XXX_USR
NOP
@@ -591,6 +591,8 @@ ENTRY(copyinstr)
or r2, r0, ENAMETOOLONG /* overflow */
.Lcisnull:
+ bcnd eq0,r6, .Lcisdone /* do not attempt to clear last byte */
+ /* if we did not write to the string */
subu r6, r6, 1
st.b r0, DEST, r6 /* clear last byte */
br.n .Lcisdone
@@ -608,8 +610,7 @@ ENTRY(copyinstr)
jmp r1
.Lcisflt:
or r2, r0, EFAULT /* return fault */
- bcnd eq0,r6, .Lcisdone /* do not attempt to clear last byte */
- br .Lcisnull /* if we faulted on first write */
+ br .Lcisnull
#undef SRC
#undef DEST