summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch/mips64
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2009-12-12 20:03:54 +0000
committermiod <miod@openbsd.org>2009-12-12 20:03:54 +0000
commitb1f38c0acee93b411f7fe20c9dee4ff6a0397e29 (patch)
treef9af73e04f07ca501004f3142c587126fbdd33ce /sys/lib/libkern/arch/mips64
parentunifdef -D__LP64__ (diff)
downloadwireguard-openbsd-b1f38c0acee93b411f7fe20c9dee4ff6a0397e29.tar.xz
wireguard-openbsd-b1f38c0acee93b411f7fe20c9dee4ff6a0397e29.zip
Provide a correct version for little endian kernels... sigh
Diffstat (limited to 'sys/lib/libkern/arch/mips64')
-rw-r--r--sys/lib/libkern/arch/mips64/htonl.S7
-rw-r--r--sys/lib/libkern/arch/mips64/htons.S9
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/lib/libkern/arch/mips64/htonl.S b/sys/lib/libkern/arch/mips64/htonl.S
index 982aeb1cf96..13c1d7024c9 100644
--- a/sys/lib/libkern/arch/mips64/htonl.S
+++ b/sys/lib/libkern/arch/mips64/htonl.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: htonl.S,v 1.3 2004/09/09 15:41:18 pefo Exp $ */
+/* $OpenBSD: htonl.S,v 1.4 2009/12/12 20:03:54 miod Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,6 +40,7 @@
*/
LEAF(htonl, 0) # a0 = 0x11223344, return 0x44332211
ALEAF(ntohl)
+#ifdef __MIPSEL__
.set noreorder
srl v1, a0, 24 # v1 = 0x00000011
sll v0, a0, 24 # v0 = 0x44000000
@@ -51,4 +52,8 @@ ALEAF(ntohl)
and v1, v1, 0xff00 # v1 = 0x00002200
j ra
or v0, v0, v1
+#else
+ j ra
+ move v0, a0
+#endif
END(htonl)
diff --git a/sys/lib/libkern/arch/mips64/htons.S b/sys/lib/libkern/arch/mips64/htons.S
index a5930703fb9..1d956a324b0 100644
--- a/sys/lib/libkern/arch/mips64/htons.S
+++ b/sys/lib/libkern/arch/mips64/htons.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: htons.S,v 1.3 2004/09/09 15:41:18 pefo Exp $ */
+/* $OpenBSD: htons.S,v 1.4 2009/12/12 20:03:54 miod Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,11 +40,16 @@
*/
LEAF(htons, 0)
ALEAF(ntohs)
+#ifdef __MIPSEL__
.set noreorder
srl v0, a0, 8
and v0, v0, 0xff
sll v1, a0, 8
and v1, v1, 0xff00
j ra
- or v0, v0, v1
+ or v0, v0, v1
+#else
+ j ra
+ move v0, a0
+#endif
END(htons)