Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/ape/lib/ap/mips/tas.s

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 *	mips user level lock code
 */

#define	LL(base, rt)	WORD	$((060<<26)|((base)<<21)|((rt)<<16))
#define	SC(base, rt)	WORD	$((070<<26)|((base)<<21)|((rt)<<16))
#define	NOOP		WORD	$0x27
#define COP3		WORD	$(023<<26)

	TEXT	C_3ktas(SB),$0
	MOVW	R1, R21
btas:
	MOVW	R21, R1
	MOVB	R0, 1(R1)
	NOOP
	COP3
	BLTZ	R1, btas
	RET

	TEXT	tas(SB), $0
	TEXT	C_4ktas(SB), $0
	MOVW	R1, R2		/* address of key */
tas1:
	MOVW	$1, R3
	LL(2, 1)
	NOOP
	SC(2, 3)
	NOOP
	BEQ	R3, tas1
	RET

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].