Module Name:    src
Committed By:   isaki
Date:           Sat Jul  4 06:56:29 UTC 2015

Modified Files:
        src/common/lib/libc/arch/m68k/atomic: atomic_cas.S

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/m68k/atomic/atomic_cas.S
diff -u src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.10 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.11
--- src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.10	Sat Feb 22 17:08:30 2014
+++ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S	Sat Jul  4 06:56:29 2015
@@ -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 @@ STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_
 
 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 @@ END(__sync_bool_compare_and_swap_4)
 
 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 @@ CRT_ALIAS(__sync_val_compare_and_swap_2,
 
 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 @@ END(__sync_bool_compare_and_swap_2)
 
 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 @@ CRT_ALIAS(__sync_val_compare_and_swap_1,
 
 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 */

Reply via email to