summaryrefslogtreecommitdiff
path: root/lib9/lock-Solaris-sparc.s
blob: d0f9399fe96184d3b05c3ece7f75574080f63b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

	.section	".text", #alloc, #execinstr
	.align		8
	.skip		16
	.global canlock
	.type	canlock,2

canlock:
	or	%g0,1,%o1
	swap	[%o0],%o1	! o0 points to lock; key is first word
	cmp	%o1,1
	bne	.gotit
	nop
	retl			! key was 1
	or	%g0,0,%o0
.gotit:
	retl			! key was not 1
	or	%g0,1,%o0

	.size	canlock,(.-canlock)