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/m68k/atomic Provide _atomic_cas_8_up an...



details:   https://anonhg.NetBSD.org/src/rev/e1d32b9892a5
branches:  trunk
changeset: 793177:e1d32b9892a5
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jan 29 10:20:11 2014 +0000

description:
Provide _atomic_cas_8_up and _atomic_cas_16_up as assembler functions

diffstat:

 common/lib/libc/arch/m68k/atomic/Makefile.inc       |   5 ++-
 common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S |  31 ++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diffs (61 lines):

diff -r 89541411b1d2 -r e1d32b9892a5 common/lib/libc/arch/m68k/atomic/Makefile.inc
--- a/common/lib/libc/arch/m68k/atomic/Makefile.inc     Wed Jan 29 08:27:04 2014 +0000
+++ b/common/lib/libc/arch/m68k/atomic/Makefile.inc     Wed Jan 29 10:20:11 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.10 2013/07/18 19:49:00 matt Exp $
+#      $NetBSD: Makefile.inc,v 1.11 2014/01/29 10:20:11 martin Exp $
 
 #
 # Note: The atomic operations here in these assembly files are atomic
@@ -35,7 +35,8 @@
 
 SRCS+= atomic_init_testset.c
 SRCS+= atomic_cas_68000.S
-CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP
+CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D__HAVE_ASM_ATOMIC_CAS_16_UP \
+        -D__HAVE_ASM_ATOMIC_CAS_8_UP
 
 .endif
 .endif
diff -r 89541411b1d2 -r e1d32b9892a5 common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S
--- a/common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S       Wed Jan 29 08:27:04 2014 +0000
+++ b/common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S       Wed Jan 29 10:20:11 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas_68000.S,v 1.5 2013/07/16 23:24:18 matt Exp $        */
+/*     $NetBSD: atomic_cas_68000.S,v 1.6 2014/01/29 10:20:11 martin Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -47,3 +47,32 @@
 RAS_END_ASM_HIDDEN(_atomic_cas)
 1:     rts
 END(_atomic_cas_up)
+
+ENTRY(_atomic_cas_16_up)
+       .hidden _C_LABEL(_atomic_cas_16_up)
+
+       movl    4(%sp), %a0             /* Fetch ptr */
+
+RAS_START_ASM_HIDDEN(_atomic_cas_16)
+       movw    (%a0), %d0              /* d0 = *ptr */
+       cmpw    8(%sp), %d0             /* Same as old? */
+       jne     1f                      /* Nope */
+       movw    12(%sp), (%a0)          /* *ptr = new */
+RAS_END_ASM_HIDDEN(_atomic_cas_16)
+1:     rts
+END(_atomic_cas_16_up)
+
+
+ENTRY(_atomic_cas_8_up)
+       .hidden _C_LABEL(_atomic_cas_8_up)
+
+       movl    4(%sp), %a0             /* Fetch ptr */
+
+RAS_START_ASM_HIDDEN(_atomic_cas_8)
+       movb    (%a0), %d0              /* d0 = *ptr */
+       cmpb    8(%sp), %d0             /* Same as old? */
+       jne     1f                      /* Nope */
+       movb    12(%sp), (%a0)          /* *ptr = new */
+RAS_END_ASM_HIDDEN(_atomic_cas_8)
+1:     rts
+END(_atomic_cas_8_up)



Home | Main Index | Thread Index | Old Index