summaryrefslogtreecommitdiff
path: root/lib9/lock-Solaris-sparc.s
blob: b5f260d155174fff05b504694822cac4035c37f8 (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,#function

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)