summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/lib/libkern/arch/mips64/bzero.S23
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/lib/libkern/arch/mips64/bzero.S b/sys/lib/libkern/arch/mips64/bzero.S
index 695d60d4508..9fe50002b24 100644
--- a/sys/lib/libkern/arch/mips64/bzero.S
+++ b/sys/lib/libkern/arch/mips64/bzero.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: bzero.S,v 1.4 2004/09/18 09:13:57 pefo Exp $ */
+/* $OpenBSD: bzero.S,v 1.5 2004/09/21 10:42:37 miod Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,13 +34,30 @@
#include "DEFS.h"
-
/*
* bzero(void *p, size_t len)
*/
LEAF(bzero, 0)
ALEAF(blkclr)
.set noreorder
+#ifdef _STANDALONE
+ blt a1, 12, smallclr # small amount to clear?
+ subu a3, zero, a0 # compute # bytes to word align address
+ and a3, a3, 3
+ beq a3, zero, 1f # skip if word aligned
+ subu a1, a1, a3 # subtract from remaining count
+ SWHI zero, 0(a0) # clear 1, 2, or 3 bytes to align
+ addu a0, a0, a3
+1:
+ and v0, a1, 3 # compute number of words left
+ subu a3, a1, v0
+ move a1, v0
+ addu a3, a3, a0 # compute ending address
+2:
+ addu a0, a0, 4 # clear words
+ bne a0, a3, 2b # unrolling loop does not help
+ sw zero, -4(a0) # since we are limited by memory speed
+#else
blt a1, 24, smallclr # small amount to clear?
subu a3, zero, a0 # compute # bytes to word align address
and a3, a3, 7
@@ -57,6 +74,7 @@ ALEAF(blkclr)
addu a0, a0, 8 # clear words
bne a0, a3, 2b # unrolling loop does not help
sd zero, -8(a0) # since we are limited by memory speed
+#endif
smallclr:
ble a1, zero, 2f
addu a3, a1, a0 # compute ending address
@@ -68,4 +86,3 @@ smallclr:
j ra
nop
END(bzero)
-