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.
This commit is contained in:
isaki 2015-07-04 06:56:29 +00:00
parent c9d5e93a69
commit 55d302de22
1 changed files with 13 additions and 17 deletions

View File

@ -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_cas_32)
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,_atomic_cas_16)
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,_atomic_cas_8)
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 */