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 atomic_cas_{8,16}:



details:   https://anonhg.NetBSD.org/src/rev/e6a296a7d55c
branches:  trunk
changeset: 339202:e6a296a7d55c
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Jul 04 06:56:29 2015 +0000

description:
atomic_cas_{8,16}:
 - Correct the wrong offset in stack.
__sync_bool_compare_and_swap_{1,2,4}:
 - Correct the wrong offset in stack.
 - D3 must be preserved in subroutines.
PR/49995.

diffstat:

 common/lib/libc/arch/m68k/atomic/atomic_cas.S |  30 +++++++++++---------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diffs (73 lines):

diff -r 55333ad418bc -r e6a296a7d55c common/lib/libc/arch/m68k/atomic/atomic_cas.S
--- a/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Sat Jul 04 06:13:01 2015 +0000
+++ b/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Sat Jul 04 06:56:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.10 2014/02/22 17:08:30 martin Exp $   */
+/*     $NetBSD: atomic_cas.S,v 1.11 2015/07/04 06:56:29 isaki Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,11 +63,9 @@
 
 ENTRY(__sync_bool_compare_and_swap_4)
        movl    4(%sp), %a0
-       movl    8(%sp), %d3
-       movl    %d3, %d2
+       movl    8(%sp), %d0
        movl    12(%sp), %d1
-       casl    %d3, %d1, (%a0)
-       /* %d3 now contains the old value */
+       casl    %d0, %d1, (%a0)
        beq     1f
        clrl    %d0     /* return false */
        rts
@@ -77,8 +75,8 @@
 
 ENTRY(_atomic_cas_16)
        movl    4(%sp), %a0
-       movw    8(%sp), %d0
-       movw    10(%sp), %d1
+       movw    8+2(%sp), %d0           /* lower word */
+       movw    12+2(%sp), %d1          /* lower word */
        casw    %d0, %d1, (%a0)
        /* %d0 now contains the old value */
        rts
@@ -89,10 +87,9 @@
 
 ENTRY(__sync_bool_compare_and_swap_2)
        movl    4(%sp), %a0
-       movw    8(%sp), %d3
-       movw    %d3, %d2
-       movw    10(%sp), %d1
-       casw    %d3, %d1, (%a0)
+       movw    8+2(%sp), %d0           /* lower word */
+       movw    12+2(%sp), %d1          /* lower word */
+       casw    %d0, %d1, (%a0)
        /* %d3 now contains the old value */
        beq     1f
        clrl    %d0     /* return failure */
@@ -103,8 +100,8 @@
 
 ENTRY(_atomic_cas_8)
        movl    4(%sp), %a0
-       movb    8(%sp), %d0
-       movb    9(%sp), %d1
+       movb    8+3(%sp), %d0           /* lower byte */
+       movb    12+3(%sp), %d1          /* lower byte */
        casb    %d0, %d1, (%a0)
        /* %d0 now contains the old value */
        rts
@@ -116,10 +113,9 @@
 
 ENTRY(__sync_bool_compare_and_swap_1)
        movl    4(%sp), %a0
-       movb    8(%sp), %d3
-       movb    %d3, %d2
-       movb    9(%sp), %d1
-       casb    %d3, %d1, (%a0)
+       movb    8+3(%sp), %d0           /* lower byte */
+       movb    12+3(%sp), %d1          /* lower byte */
+       casb    %d0, %d1, (%a0)
        /* %d3 now contains the old value */
        beq     1f
        clrl    %d0     /* return failure */



Home | Main Index | Thread Index | Old Index