Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/arch/arm/atomic Make these under Thumb2



details:   https://anonhg.NetBSD.org/src/rev/c153ba781796
branches:  trunk
changeset: 789181:c153ba781796
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Aug 10 19:59:21 2013 +0000

description:
Make these under Thumb2

diffstat:

 common/lib/libc/arch/arm/atomic/atomic_add_32.S  |  24 ++++++------
 common/lib/libc/arch/arm/atomic/atomic_add_64.S  |  44 +++++++----------------
 common/lib/libc/arch/arm/atomic/atomic_and_32.S  |  21 ++++++-----
 common/lib/libc/arch/arm/atomic/atomic_and_64.S  |  40 +++++----------------
 common/lib/libc/arch/arm/atomic/atomic_cas_32.S  |  22 +++++++----
 common/lib/libc/arch/arm/atomic/atomic_cas_64.S  |  27 ++++++++------
 common/lib/libc/arch/arm/atomic/atomic_cas_8.S   |  20 ++++++----
 common/lib/libc/arch/arm/atomic/atomic_cas_up.S  |   3 +-
 common/lib/libc/arch/arm/atomic/atomic_dec_32.S  |  29 ++++++++-------
 common/lib/libc/arch/arm/atomic/atomic_dec_64.S  |  38 ++++++++------------
 common/lib/libc/arch/arm/atomic/atomic_inc_32.S  |  23 ++++++------
 common/lib/libc/arch/arm/atomic/atomic_inc_64.S  |  38 ++++++++------------
 common/lib/libc/arch/arm/atomic/atomic_or_32.S   |  27 +++++++-------
 common/lib/libc/arch/arm/atomic/atomic_or_64.S   |  40 +++++----------------
 common/lib/libc/arch/arm/atomic/atomic_swap.S    |  24 ++++++++----
 common/lib/libc/arch/arm/atomic/atomic_swap_64.S |  13 +++---
 16 files changed, 194 insertions(+), 239 deletions(-)

diffs (truncated from 859 to 300 lines):

diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_add_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_add_32.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_add_32.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_add_32.S,v 1.3 2012/08/31 23:41:52 matt Exp $   */
+/*     $NetBSD: atomic_add_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,19 +34,19 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_add_32)
-       mov     r3, r0                  /* need r0 for return value */
-1:     ldrex   r0, [r3]                /* load old value (to be returned) */
-       add     r2, r0, r1              /* calculate new value */
-       strex   ip, r2, [r3]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
+1:     ldrex   r3, [r0]                /* load old value */
+       add     r3, r3, r1              /* calculate new value */
+       strex   r2, r3, [r0]            /* try to store */
+       cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r2, c7, c10, 5  /* data memory barrier */
 #endif
        RET                             /* return old value */
-       END(_atomic_add_32)
+END(_atomic_add_32)
+
 ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32)
 ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32)
 ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32)
@@ -56,16 +56,16 @@
 STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32)
 
 ENTRY_NP(_atomic_add_32_nv)
-       mov     r3, r0                  /* need r0 for return value */
-1:     ldrex   r0, [r3]                /* load old value */
+       mov     ip, r0                  /* need r0 for return value */
+1:     ldrex   r0, [ip]                /* load old value */
        add     r0, r0, r1              /* calculate new value (return value) */
-       strex   r2, r0, [r3]            /* try to store */
+       strex   r2, r0, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r2, c7, c10, 5  /* data memory barrier */
 #endif
        RET                             /* return new value */
        END(_atomic_add_32_nv)
diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_add_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_add_64.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_add_64.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_add_64.S,v 1.5 2013/08/10 19:02:22 matt Exp $   */
+/*     $NetBSD: atomic_add_64.S,v 1.6 2013/08/10 19:59:21 matt Exp $   */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,50 +32,34 @@
 
 #ifdef _ARM_ARCH_6
 
-ENTRY_NP(_atomic_add_64)
+ENTRY_NP(_atomic_add_64_nv)
        push    {r4}                    /* save temporary */
-       mov     r4, r0                  /* need r0 for return value */
+       mov     ip, r0                  /* need r0 for return value */
 #ifndef __ARM_EABI__
        mov     r3, r2
        mov     r2, r1
 #endif
-1:     ldrexd  r0, [r4]                /* load old value (to be returned) */
-       adds    LO, LO, NLO             /* calculate new value */
-       adc     HI, HI, NHI             /* calculate new value */
-       strexd  ip, r0, [r4]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
-       bne     1b                      /*     no, try again */
-#ifdef _ARM_ARCH_7
-       dmb
+1:     ldrexd  r0, [ip]                /* load old value */
+#ifdef __thumb__
+       add     LO, LO, NLO             /* calculate new value lo */
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       adds    LO, LO, NLO             /* calculate new value lo */
 #endif
-       pop     {r4}                    /* restore temporary */
-       RET
-       END(_atomic_add_64)
-ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
-
-ENTRY_NP(_atomic_add_64_nv)
-       push    {r4}                    /* save temporary */
-       mov     r4, r0                  /* need r0 for return value */
-#ifndef __ARM_EABI__
-       mov     r3, r2
-       mov     r2, r1
-#endif
-1:     ldrexd  r0, [r4]                /* load old value */
-       adds    LO, LO, NLO             /* calculate new value lo */
        adc     HI, HI, NHI             /* calculate new value hi */
-       strexd  ip, r0, [r4]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
+       strexd  r4, r0, [ip]            /* try to store */
+       cmp     r4, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r4, c7, c10, 5  /* data memory barrier */
 #endif
        pop     {r4}                    /* restore temporary */
        RET                             /* return new value */
-       END(_atomic_add_64_nv)
+END(_atomic_add_64_nv)
+
+STRONG_ALIAS(_atomic_add_64,_atomic_add_64_nv)
 ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv)
+ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
 
 #endif /* _ARM_ARCH_6 */
diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_and_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_and_32.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_and_32.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_and_32.S,v 1.3 2012/08/31 23:41:52 matt Exp $   */
+/*     $NetBSD: atomic_and_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,19 +34,19 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_and_32)
-       mov     r3, r0                  /* need r0 for return value */
-1:     ldrex   r0, [r3]                /* load old value (to be returned) */
-       and     r2, r0, r1              /* calculate new value */
-       strex   ip, r2, [r3]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
+1:     ldrex   r3, [r0]                /* load old value (to be returned) */
+       and     r3, r3, r1              /* calculate new value */
+       strex   r2, r3, [r0]            /* try to store */
+       cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r2, c7, c10, 5  /* data memory barrier */
 #endif
        RET                             /* return old value */
-       END(_atomic_and_32)
+END(_atomic_and_32)
+
 ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32)
 ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32)
 ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32)
@@ -63,10 +63,11 @@
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r2, c7, c10, 5  /* data memory barrier */
 #endif
        RET                             /* return new value */
-       END(_atomic_and_32_nv)
+END(_atomic_and_32_nv)
+
 ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
 ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv)
 ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv)
diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_and_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_and_64.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_and_64.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_and_64.S,v 1.4 2013/08/10 19:02:22 matt Exp $   */
+/*     $NetBSD: atomic_and_64.S,v 1.5 2013/08/10 19:59:21 matt Exp $   */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,50 +32,30 @@
 
 #ifdef _ARM_ARCH_6
 
-ENTRY_NP(_atomic_and_64)
-       push    {r4}                    /* save temporary */
-#ifndef __ARM_EABI__
-       mov     r3, r2
-       mov     r2, r1
-#endif
-       mov     r4, r0                  /* need r0 for return value */
-1:     ldrexd  r0, [r4]                /* load old value (to be returned) */
-       and     r0, r0, r2              /* calculate new value */
-       and     r1, r1, r3              /* calculate new value */
-       strexd  ip, r0, [r4]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
-       bne     1b                      /*     no, try again */
-#ifdef _ARM_ARCH_7
-       dmb
-#else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
-#endif
-       pop     {r4}                    /* restore temporary */
-       RET
-       END(_atomic_and_64)
-ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
-
 ENTRY_NP(_atomic_and_64_nv)
        push    {r4}                    /* save temporary */
 #ifndef __ARM_EABI__
        mov     r3, r2
        mov     r2, r1
 #endif
-       mov     r4, r0                  /* need r0 for return value */
-1:     ldrexd  r0, [r4]                /* load old value */
+       mov     ip, r0                  /* need r0 for return value */
+1:     ldrexd  r0, [ip]                /* load old value */
        and     r0, r0, r2              /* calculate new value */
        and     r1, r1, r3              /* calculate new value */
-       strexd  ip, r0, [r4]            /* try to store */
-       cmp     ip, #0                  /*   succeed? */
+       strexd  r4, r0, [ip]            /* try to store */
+       cmp     r4, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
 #ifdef _ARM_ARCH_7
        dmb
 #else
-       mcr     p15, 0, ip, c7, c10, 5  /* data memory barrier */
+       mcr     p15, 0, r4, c7, c10, 5  /* data memory barrier */
 #endif
        pop     {r4}                    /* restore temporary */
        RET                             /* return new value */
-       END(_atomic_and_64_nv)
+END(_atomic_and_64_nv)
+
+STRONG_ALIAS(_atomic_and_64,_atomic_and_64_nv)
 ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv)
+ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64_nv)
 
 #endif /* _ARM_ARCH_6 */
diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_cas_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_cas_32.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_cas_32.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas_32.S,v 1.4 2012/10/29 14:09:38 chs Exp $    */
+/*     $NetBSD: atomic_cas_32.S,v 1.5 2013/08/10 19:59:21 matt Exp $   */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,21 +36,25 @@
  * and kernel.
  */
 ENTRY_NP(_atomic_cas_32)
-       mov     r3, r0                  /* we need r0 for return value */
+       mov     ip, r0                  /* we need r0 for return value */
 1:
-       ldrex   r0, [r3]                /* load old value */
-       teq     r0, r1                  /*   compare? */
+       ldrex   r0, [ip]                /* load old value */
+       cmp     r0, r1                  /*   compare? */
+#ifdef __thumb__
+       bne     2f                      /*     return if different */
+#else
        RETc(ne)                        /*     return if different */
-       strex   ip, r2, [r3]            /* store new value */
-       cmp     ip, #0                  /*   succeed? */
+#endif
+       strex   r3, r2, [ip]            /* store new value */
+       cmp     r3, #0                  /*   succeed? */
        bne     1b                      /*     nope, try again. */
 #ifdef _ARM_ARCH_7
        dsb
 #else
-       mcr     p15, 0, ip, c7, c10, 4  /* data synchronization barrier */
+       mcr     p15, 0, r3, c7, c10, 4  /* data synchronization barrier */
 #endif
-       RET                             /* return. */
-       END(_atomic_cas_32)
+2:     RET                             /* return. */
+END(_atomic_cas_32)
 
 ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
 ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
diff -r a5f9c4a55469 -r c153ba781796 common/lib/libc/arch/arm/atomic/atomic_cas_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_cas_64.S   Sat Aug 10 19:02:22 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_cas_64.S   Sat Aug 10 19:59:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas_64.S,v 1.2 2012/10/29 14:09:38 chs Exp $    */
+/*     $NetBSD: atomic_cas_64.S,v 1.3 2013/08/10 19:59:21 matt Exp $   */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.



Home | Main Index | Thread Index | Old Index