summaryrefslogtreecommitdiffstats
path: root/arch/sparc64/lib/atomic.S
blob: 3c0dce16abd81bbb9e678c19be082135e6dc9963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* $Id: atomic.S,v 1.1 1999/07/03 22:11:04 davem Exp $
 * atomic.S: These things are too big to do inline.
 *
 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
 */

#include <asm/asi.h>

	.text
	.align	64

	.globl	__atomic_add
__atomic_add:
	lduw	[%g1], %g5
	add	%g5, %g2, %g7
	cas	[%g1], %g5, %g7
	cmp	%g5, %g7
	bne,pn	%icc, __atomic_add
	 nop
	jmpl	%g3 + 8, %g0
	 add	%g7, %g2, %g2

	.globl	__atomic_sub
__atomic_sub:
	lduw	[%g1], %g5
	sub	%g5, %g2, %g7
	cas	[%g1], %g5, %g7
	cmp	%g5, %g7
	bne,pn	%icc, __atomic_sub
	 nop
	jmpl	%g3 + 8, %g0
	 sub	%g7, %g2, %g2