diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/arm/string/_memcpy.S | 64 | ||||
-rw-r--r-- | lib/libc/arch/arm/string/memset.S | 14 |
2 files changed, 41 insertions, 37 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 */ |