/*
 * SpySPARCDep.s for SPARC processor
 *
 * Michael Plass, June 27, 1990 1:32:19 pm PDT
 */

	.seg	"text"
	.proc	16
	.globl	←PCSpy←TestAndSet
←PCSpy←TestAndSet:
!
! The followng obvious implementation fails if it has to be restarted (e.g.
! because of a write-protect fault caused by our garbage collector):
!
!	ldstub	[%o0],%o0
!	retl
!	nop
!
	stb %g0,[%o0+3]   ! partially circumvent reputed ldstub bug
	ldstub	[%o0],%g1
	retl
	mov	%g1,%o0		! delay slot