summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1996-07-30 20:19:10 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1996-07-30 20:19:10 +0000
commitb039b90135b7419709f2766cbede80c1acf288a8 (patch)
tree2b3a7aa4c956319a5bd645a7dd14ed17270e7469 /sys/lib/libkern/arch
parent2133e70c13d931b67166823eefd18e8b96980643 (diff)
Cleanup of endian and abi call stuff.
Diffstat (limited to 'sys/lib/libkern/arch')
-rw-r--r--sys/lib/libkern/arch/mips/bcmp.S14
-rw-r--r--sys/lib/libkern/arch/mips/bcopy.S22
-rw-r--r--sys/lib/libkern/arch/mips/bzero.S4
-rw-r--r--sys/lib/libkern/arch/mips/ffs.S2
-rw-r--r--sys/lib/libkern/arch/mips/htonl.S4
-rw-r--r--sys/lib/libkern/arch/mips/htons.S2
-rw-r--r--sys/lib/libkern/arch/mips/strcmp.S2
-rw-r--r--sys/lib/libkern/arch/mips/strlen.S2
8 files changed, 24 insertions, 28 deletions
diff --git a/sys/lib/libkern/arch/mips/bcmp.S b/sys/lib/libkern/arch/mips/bcmp.S
index 409c821aeb5..0a18dadd12b 100644
--- a/sys/lib/libkern/arch/mips/bcmp.S
+++ b/sys/lib/libkern/arch/mips/bcmp.S
@@ -1,11 +1,11 @@
#include "DEFS.h"
- .set noreorder
/*
* bcmp(s1, s2, n)
*/
LEAF(bcmp)
+ .set noreorder
blt a2, 16, smallcmp # is it worth any trouble?
xor v0, a0, a1 # compare low two bits of addresses
and v0, v0, 3
@@ -16,9 +16,8 @@ LEAF(bcmp)
beq a3, zero, 1f
subu a2, a2, a3 # subtract from remaining count
move v0, v1 # init v0,v1 so unmodified bytes match
-/*XXX FIXME Endian dependent */
- LWLO v0, 0(a0) # read 1, 2, or 3 bytes
- LWLO v1, 0(a1)
+ LWHI v0, 0(a0) # read 1, 2, or 3 bytes
+ LWHI v1, 0(a1)
addu a1, a1, a3
bne v0, v1, nomatch
addu a0, a0, a3
@@ -53,9 +52,8 @@ unalignedcmp:
subu a2, a2, a3 # which has to be >= (16-3) & ~3
addu a3, a3, a0 # compute ending address
3:
-/*XXX FIXME Endian dependent */
- LWLO v0, 0(a0) # compare words a0 unaligned, a1 aligned
- LWHI v0, 3(a0)
+ LWHI v0, 0(a0) # compare words a0 unaligned, a1 aligned
+ LWLO v0, 3(a0)
lw v1, 0(a1)
addu a0, a0, 4
bne v0, v1, nomatch
@@ -78,5 +76,5 @@ match:
move v0, zero
nomatch:
j ra
- li v0, 1
+ li v0, 1
END(bcmp)
diff --git a/sys/lib/libkern/arch/mips/bcopy.S b/sys/lib/libkern/arch/mips/bcopy.S
index 50937442a9e..3936fb8b2ed 100644
--- a/sys/lib/libkern/arch/mips/bcopy.S
+++ b/sys/lib/libkern/arch/mips/bcopy.S
@@ -1,17 +1,18 @@
#include "DEFS.h"
- .set noreorder
/*
* memcpy(to, from, len)
* {ov}bcopy(from, to, len)
*/
LEAF(memcpy)
+ .set noreorder
move v0, a0 # swap from and to
move a0, a1
move a1, v0
ALEAF(bcopy)
ALEAF(ovbcopy)
+ .set noreorder
addu t0, a0, a2 # t0 = end of s1 region
sltu t1, a1, t0
sltu t2, a0, a1
@@ -40,11 +41,10 @@ forward:
beq a3, zero, 1f
subu a2, a2, a3 # subtract from remaining count
-/*XXX FIXME Endian dependent */
- LWLO v1, 0(a0) # get next 4 bytes (unaligned)
- LWHI v1, 3(a0)
+ LWHI v1, 0(a0) # get next 4 bytes (unaligned)
+ LWLO v1, 3(a0)
addu a0, a0, a3
- SWLO v1, 0(a1) # store 1, 2, or 3 bytes to align a1
+ SWHI v1, 0(a1) # store 1, 2, or 3 bytes to align a1
addu a1, a1, a3
1:
and v1, a2, 3 # compute number of words left
@@ -52,9 +52,8 @@ forward:
move a2, v1
addu a3, a3, a0 # compute ending address
2:
-/*XXX FIXME Endian dependent */
- LWLO v1, 0(a0) # copy words a0 unaligned, a1 aligned
- LWHI v1, 3(a0)
+ LWHI v1, 0(a0) # copy words a0 unaligned, a1 aligned
+ LWLO v1, 3(a0)
addu a0, a0, 4
sw v1, 0(a1)
addu a1, a1, 4
@@ -65,9 +64,9 @@ forward:
aligned:
beq a3, zero, 1f
subu a2, a2, a3 # subtract from remaining count
- LWLO v1, 0(a0) # copy 1, 2, or 3 bytes to align
+ LWHI v1, 0(a0) # copy 1, 2, or 3 bytes to align
addu a0, a0, a3
- SWLO v1, 0(a1)
+ SWHI v1, 0(a1)
addu a1, a1, a3
1:
and v1, a2, 3 # compute number of whole words left
@@ -87,9 +86,8 @@ smallcpy:
lbu v1, 0(a0) # copy bytes
addu a0, a0, 1
sb v1, 0(a1)
- addu a1, a1, 1
bne a0, a3, 1b
- nop # MMU BUG ? can't do -1(a1) at 0x80000000!!
+ addu a1, a1, 1 # MMU BUG ? can't do -1(a1) at 0x80000000!!
2:
j ra
nop
diff --git a/sys/lib/libkern/arch/mips/bzero.S b/sys/lib/libkern/arch/mips/bzero.S
index 77b12f6b5b4..4ff16b0a93b 100644
--- a/sys/lib/libkern/arch/mips/bzero.S
+++ b/sys/lib/libkern/arch/mips/bzero.S
@@ -1,18 +1,18 @@
#include "DEFS.h"
- .set noreorder
/*
* bzero(s1, n)
*/
LEAF(bzero)
ALEAF(blkclr)
+ .set noreorder
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
- SWLO zero, 0(a0) # clear 1, 2, or 3 bytes to align
+ 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
diff --git a/sys/lib/libkern/arch/mips/ffs.S b/sys/lib/libkern/arch/mips/ffs.S
index fdc8c0bd3ee..f84c947105d 100644
--- a/sys/lib/libkern/arch/mips/ffs.S
+++ b/sys/lib/libkern/arch/mips/ffs.S
@@ -1,11 +1,11 @@
#include "DEFS.h"
- .set noreorder
/*
* bit = ffs(value)
*/
LEAF(ffs)
+ .set noreorder
beq a0, zero, 2f
move v0, zero
1:
diff --git a/sys/lib/libkern/arch/mips/htonl.S b/sys/lib/libkern/arch/mips/htonl.S
index 24046d252e0..85576cde536 100644
--- a/sys/lib/libkern/arch/mips/htonl.S
+++ b/sys/lib/libkern/arch/mips/htonl.S
@@ -1,6 +1,5 @@
#include "DEFS.h"
- .set noreorder
/*
* netorder = htonl(hostorder)
@@ -8,6 +7,7 @@
*/
LEAF(htonl) # a0 = 0x11223344, return 0x44332211
ALEAF(ntohl)
+ .set noreorder
srl v1, a0, 24 # v1 = 0x00000011
sll v0, a0, 24 # v0 = 0x44000000
or v0, v0, v1
@@ -17,5 +17,5 @@ ALEAF(ntohl)
srl v1, a0, 8
and v1, v1, 0xff00 # v1 = 0x00002200
j ra
- or v0, v0, v1
+ or v0, v0, v1
END(htonl)
diff --git a/sys/lib/libkern/arch/mips/htons.S b/sys/lib/libkern/arch/mips/htons.S
index 2ac256aa271..f425144c094 100644
--- a/sys/lib/libkern/arch/mips/htons.S
+++ b/sys/lib/libkern/arch/mips/htons.S
@@ -1,6 +1,5 @@
#include "DEFS.h"
- .set noreorder
/*
* netorder = htons(hostorder)
@@ -8,6 +7,7 @@
*/
LEAF(htons)
ALEAF(ntohs)
+ .set noreorder
srl v0, a0, 8
and v0, v0, 0xff
sll v1, a0, 8
diff --git a/sys/lib/libkern/arch/mips/strcmp.S b/sys/lib/libkern/arch/mips/strcmp.S
index 02b661e11d7..6c6b7a503c5 100644
--- a/sys/lib/libkern/arch/mips/strcmp.S
+++ b/sys/lib/libkern/arch/mips/strcmp.S
@@ -1,11 +1,11 @@
#include "DEFS.h"
- .set noreorder
/*
* NOTE: this version assumes unsigned chars in order to be "8 bit clean".
*/
LEAF(strcmp)
+ .set noreorder
1:
lbu t0, 0(a0) # get two bytes and compare them
lbu t1, 0(a1)
diff --git a/sys/lib/libkern/arch/mips/strlen.S b/sys/lib/libkern/arch/mips/strlen.S
index 95d6696429d..4f9288eb537 100644
--- a/sys/lib/libkern/arch/mips/strlen.S
+++ b/sys/lib/libkern/arch/mips/strlen.S
@@ -1,11 +1,11 @@
#include "DEFS.h"
- .set noreorder
/*
* strlen(str)
*/
LEAF(strlen)
+ .set noreorder
addu v1, a0, 1
1:
lb v0, 0(a0) # get byte from string