summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-06-08 14:22:05 +0000
committerjsg <jsg@openbsd.org>2015-06-08 14:22:05 +0000
commitc6b709f57b9f0eb79d5cd435ebd6ead1f648a81f (patch)
treed34f59e202e510eb4663d503ef0d259fda2a6fd6
parentMerge multiple copies of the code doing VLAN tag insertion back into (diff)
downloadwireguard-openbsd-c6b709f57b9f0eb79d5cd435ebd6ead1f648a81f.tar.xz
wireguard-openbsd-c6b709f57b9f0eb79d5cd435ebd6ead1f648a81f.zip
At some point arm moved to a unified syntax for arm and thumb instructions.
While binutils supports both "unified" and "divided" syntax (defaulting to divided) the integrated assembler in clang only supports unified names so switch some files to unified syntax. Similiar changes were made in bitrig and freebsd. No difference in objdump -d output. tested on zaurus by deraadt@, ok miod@
-rw-r--r--lib/libc/arch/arm/string/_memcpy.S64
-rw-r--r--lib/libc/arch/arm/string/memset.S14
-rw-r--r--sys/arch/arm/arm/in_cksum_arm.S12
-rw-r--r--sys/lib/libkern/arch/arm/memcpy.S68
-rw-r--r--sys/lib/libkern/arch/arm/memset.S14
5 files changed, 91 insertions, 81 deletions
diff --git a/lib/libc/arch/arm/string/_memcpy.S b/lib/libc/arch/arm/string/_memcpy.S
index 3ec7a49dd35..dee8de3e080 100644
--- a/lib/libc/arch/arm/string/_memcpy.S
+++ b/lib/libc/arch/arm/string/_memcpy.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: _memcpy.S,v 1.3 2008/06/26 05:42:04 ray Exp $ */
+/* $OpenBSD: _memcpy.S,v 1.4 2015/06/08 14:22:05 jsg Exp $ */
/* $NetBSD: _memcpy.S,v 1.4 2003/04/05 23:08:52 bjh21 Exp $ */
/*-
@@ -63,6 +63,8 @@
* Apologies for the state of the comments ;-)
*/
+.syntax unified
+
ENTRY(_memcpy)
/* Determine copy direction */
cmp r1, r0
@@ -98,8 +100,8 @@ ENTRY(_memcpy)
bge .Lmemcpy_floop32
cmn r2, #0x10
- ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
- stmgeia r0!, {r3, r4, r12, lr}
+ ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+ stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
ldmia sp!, {r4} /* return r4 */
@@ -108,9 +110,9 @@ ENTRY(_memcpy)
/* blat 12 bytes at a time */
.Lmemcpy_floop12:
- ldmgeia r1!, {r3, r12, lr}
- stmgeia r0!, {r3, r12, lr}
- subges r2, r2, #0x0c
+ ldmiage r1!, {r3, r12, lr}
+ stmiage r0!, {r3, r12, lr}
+ subsge r2, r2, #0x0c
bge .Lmemcpy_floop12
.Lmemcpy_fl12:
@@ -120,23 +122,23 @@ ENTRY(_memcpy)
subs r2, r2, #4
ldrlt r3, [r1], #4
strlt r3, [r0], #4
- ldmgeia r1!, {r3, r12}
- stmgeia r0!, {r3, r12}
+ ldmiage r1!, {r3, r12}
+ stmiage r0!, {r3, r12}
subge r2, r2, #4
.Lmemcpy_fl4:
/* less than 4 bytes to go */
adds r2, r2, #4
- ldmeqia sp!, {r0, pc} /* done */
+ ldmiaeq sp!, {r0, pc} /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
ldmia sp!, {r0, pc}
/* erg - unaligned destination */
@@ -147,10 +149,10 @@ ENTRY(_memcpy)
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
subs r2, r2, r12
blt .Lmemcpy_fl4 /* less the 4 bytes */
@@ -299,12 +301,12 @@ ENTRY(_memcpy)
.Lmemcpy_bl32:
cmn r2, #0x10
- ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
- stmgedb r0!, {r3, r4, r12, lr}
+ ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+ stmdbge r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
adds r2, r2, #0x14
- ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
- stmgedb r0!, {r3, r12, lr}
+ ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
+ stmdbge r0!, {r3, r12, lr}
subge r2, r2, #0x0c
ldmia sp!, {r4, lr}
@@ -314,8 +316,8 @@ ENTRY(_memcpy)
subs r2, r2, #4
ldrlt r3, [r1, #-4]!
strlt r3, [r0, #-4]!
- ldmgedb r1!, {r3, r12}
- stmgedb r0!, {r3, r12}
+ ldmdbge r1!, {r3, r12}
+ stmdbge r0!, {r3, r12}
subge r2, r2, #4
.Lmemcpy_bl4:
@@ -327,10 +329,10 @@ ENTRY(_memcpy)
cmp r2, #2
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
- ldrgeb r3, [r1, #-1]!
- strgeb r3, [r0, #-1]!
- ldrgtb r3, [r1, #-1]!
- strgtb r3, [r0, #-1]!
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
mov pc, lr
/* erg - unaligned destination */
@@ -340,10 +342,10 @@ ENTRY(_memcpy)
/* align destination with byte copies */
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
- ldrgeb r3, [r1, #-1]!
- strgeb r3, [r0, #-1]!
- ldrgtb r3, [r1, #-1]!
- strgtb r3, [r0, #-1]!
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
subs r2, r2, r12
blt .Lmemcpy_bl4 /* less than 4 bytes to go */
ands r12, r1, #3
diff --git a/lib/libc/arch/arm/string/memset.S b/lib/libc/arch/arm/string/memset.S
index a6c6c015e3c..a4c3d158938 100644
--- a/lib/libc/arch/arm/string/memset.S
+++ b/lib/libc/arch/arm/string/memset.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: memset.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */
+/* $OpenBSD: memset.S,v 1.3 2015/06/08 14:22:05 jsg Exp $ */
/* $NetBSD: memset.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */
/*
@@ -47,6 +47,8 @@
* r0 - dest address
*/
+.syntax unified
+
ENTRY(memset)
stmfd sp!, {r0} /* Remember address for return value */
and r1, r1, #0x000000ff /* We write bytes */
@@ -63,8 +65,8 @@ ENTRY(memset)
sub r2, r2, r3
cmp r3, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
+ strbge r1, [r0], #0x0001 /* Set another byte */
+ strbgt r1, [r0], #0x0001 /* and a third */
cmp r2, #0x00000004
blt .Lmemset_lessthanfour
@@ -115,13 +117,13 @@ ENTRY(memset)
.Lmemset_lessthanfour:
cmp r2, #0x00000000
- ldmeqfd sp!, {r0}
+ ldmfdeq sp!, {r0}
moveq pc, lr /* Zero length so exit */
cmp r2, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
+ strbge r1, [r0], #0x0001 /* Set another byte */
+ strbgt r1, [r0], #0x0001 /* and a third */
ldmfd sp!, {r0}
mov pc, lr /* Exit */
diff --git a/sys/arch/arm/arm/in_cksum_arm.S b/sys/arch/arm/arm/in_cksum_arm.S
index 1894105210f..02140c9605d 100644
--- a/sys/arch/arm/arm/in_cksum_arm.S
+++ b/sys/arch/arm/arm/in_cksum_arm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_cksum_arm.S,v 1.4 2014/12/22 02:26:53 tedu Exp $ */
+/* $OpenBSD: in_cksum_arm.S,v 1.5 2015/06/08 14:22:05 jsg Exp $ */
/* $NetBSD: in_cksum_arm.S,v 1.3 2003/11/26 10:31:53 rearnsha Exp $ */
/*
@@ -43,6 +43,8 @@
#include <machine/asm.h>
#include "assym.h"
+.syntax unified
+
/*
* int in_cksum(struct mbuf *m, int len)
*
@@ -231,9 +233,9 @@ ASENTRY_NP(L_cksumdata)
blt .Lcksumdata_endgame
cmp r7, #0x02
ldrb r4, [r0], #0x01 /* Fetch 1st byte */
- ldrgeb r5, [r0], #0x01 /* Fetch 2nd byte */
+ ldrbge r5, [r0], #0x01 /* Fetch 2nd byte */
movlt r5, #0x00
- ldrgtb r6, [r0], #0x01 /* Fetch 3rd byte */
+ ldrbgt r6, [r0], #0x01 /* Fetch 3rd byte */
movle r6, #0x00
/* Combine the three bytes depending on endianness and alignment */
orreq r2, r4, r5, lsl #8
@@ -415,9 +417,9 @@ ASENTRY_NP(L_cksumdata)
.Lcksumdata_endgame:
ldrb r3, [r0] /* Fetch first byte */
cmp r1, #0x02
- ldrgeb r4, [r0, #0x01] /* Fetch 2nd and 3rd as necessary */
+ ldrbge r4, [r0, #0x01] /* Fetch 2nd and 3rd as necessary */
movlt r4, #0x00
- ldrgtb r5, [r0, #0x02]
+ ldrbgt r5, [r0, #0x02]
movle r5, #0x00
/* Combine the three bytes depending on endianness and alignment */
tst r0, #0x01
diff --git a/sys/lib/libkern/arch/arm/memcpy.S b/sys/lib/libkern/arch/arm/memcpy.S
index 998250d9968..fade0f032a7 100644
--- a/sys/lib/libkern/arch/arm/memcpy.S
+++ b/sys/lib/libkern/arch/arm/memcpy.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: memcpy.S,v 1.5 2014/12/30 08:12:52 jsg Exp $ */
+/* $OpenBSD: memcpy.S,v 1.6 2015/06/08 14:22:05 jsg Exp $ */
/* $NetBSD: memcpy.S,v 1.2 2001/11/20 00:29:20 chris Exp $ */
/*-
@@ -63,6 +63,8 @@
* Apologies for the state of the comments ;-)
*/
+.syntax unified
+
ENTRY(memcpy)
ENTRY_NP(memmove)
/* Determine copy direction */
@@ -102,8 +104,8 @@ Lmemcpy_floop32:
bge Lmemcpy_floop32
cmn r2, #0x10
- ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
- stmgeia r0!, {r3, r4, r12, lr}
+ ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+ stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
ldmia sp!, {r4} /* return r4 */
@@ -112,9 +114,9 @@ Lmemcpy_fl32:
/* blat 12 bytes at a time */
Lmemcpy_floop12:
- ldmgeia r1!, {r3, r12, lr}
- stmgeia r0!, {r3, r12, lr}
- subges r2, r2, #0x0c
+ ldmiage r1!, {r3, r12, lr}
+ stmiage r0!, {r3, r12, lr}
+ subsge r2, r2, #0x0c
bge Lmemcpy_floop12
Lmemcpy_fl12:
@@ -124,26 +126,26 @@ Lmemcpy_fl12:
subs r2, r2, #4
ldrlt r3, [r1], #4
strlt r3, [r0], #4
- ldmgeia r1!, {r3, r12}
- stmgeia r0!, {r3, r12}
+ ldmiage r1!, {r3, r12}
+ stmiage r0!, {r3, r12}
subge r2, r2, #4
Lmemcpy_fl4:
/* less than 4 bytes to go */
adds r2, r2, #4
#ifdef __APCS_26_
- ldmeqia sp!, {r0, pc}^ /* done */
+ ldmiaeq sp!, {r0, pc}^ /* done */
#else
- ldmeqia sp!, {r0, pc} /* done */
+ ldmiaeq sp!, {r0, pc} /* done */
#endif
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
ldmia sp!, {r0, pc}
/* erg - unaligned destination */
@@ -154,10 +156,10 @@ Lmemcpy_fdestul:
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
subs r2, r2, r12
blt Lmemcpy_fl4 /* less the 4 bytes */
@@ -306,12 +308,12 @@ Lmemcpy_bloop32:
Lmemcpy_bl32:
cmn r2, #0x10
- ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
- stmgedb r0!, {r3, r4, r12, lr}
+ ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+ stmdbge r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
adds r2, r2, #0x14
- ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
- stmgedb r0!, {r3, r12, lr}
+ ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
+ stmdbge r0!, {r3, r12, lr}
subge r2, r2, #0x0c
ldmia sp!, {r4}
@@ -321,23 +323,23 @@ Lmemcpy_bl12:
subs r2, r2, #4
ldrlt r3, [r1, #-4]!
strlt r3, [r0, #-4]!
- ldmgedb r1!, {r3, r12}
- stmgedb r0!, {r3, r12}
+ ldmdbge r1!, {r3, r12}
+ stmdbge r0!, {r3, r12}
subge r2, r2, #4
Lmemcpy_bl4:
/* less than 4 bytes to go */
adds r2, r2, #4
- ldmeqia sp!, {r0, pc}
+ ldmiaeq sp!, {r0, pc}
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
- ldrgeb r3, [r1, #-1]!
- strgeb r3, [r0, #-1]!
- ldrgtb r3, [r1, #-1]!
- strgtb r3, [r0, #-1]!
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
ldmia sp!, {r0, pc}
/* erg - unaligned destination */
@@ -347,10 +349,10 @@ Lmemcpy_bdestul:
/* align destination with byte copies */
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
- ldrgeb r3, [r1, #-1]!
- strgeb r3, [r0, #-1]!
- ldrgtb r3, [r1, #-1]!
- strgtb r3, [r0, #-1]!
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
subs r2, r2, r12
blt Lmemcpy_bl4 /* less than 4 bytes to go */
ands r12, r1, #3
diff --git a/sys/lib/libkern/arch/arm/memset.S b/sys/lib/libkern/arch/arm/memset.S
index 1635c81f7b9..9497448e98c 100644
--- a/sys/lib/libkern/arch/arm/memset.S
+++ b/sys/lib/libkern/arch/arm/memset.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: memset.S,v 1.3 2014/12/30 08:12:52 jsg Exp $ */
+/* $OpenBSD: memset.S,v 1.4 2015/06/08 14:22:05 jsg Exp $ */
/* $NetBSD: memset.S,v 1.1 2000/12/29 20:51:57 bjh21 Exp $ */
/*
@@ -47,6 +47,8 @@
* r0 - dest address
*/
+.syntax unified
+
ENTRY(memset)
stmfd sp!, {r0} /* Remember address for return value */
and r1, r1, #0x000000ff /* We write bytes */
@@ -63,8 +65,8 @@ ENTRY(memset)
sub r2, r2, r3
cmp r3, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
+ strbge r1, [r0], #0x0001 /* Set another byte */
+ strbgt r1, [r0], #0x0001 /* and a third */
cmp r2, #0x00000004
blt Lmemset_lessthanfour
@@ -115,13 +117,13 @@ Lmemset_loop4:
Lmemset_lessthanfour:
cmp r2, #0x00000000
- ldmeqfd sp!, {r0}
+ ldmfdeq sp!, {r0}
moveq pc, lr /* Zero length so exit */
cmp r2, #0x00000002
strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
+ strbge r1, [r0], #0x0001 /* Set another byte */
+ strbgt r1, [r0], #0x0001 /* and a third */
ldmfd sp!, {r0}
mov pc, lr /* Exit */