plan9fox/sys/src/libc/arm64/tas.s
cinap_lenrek 0002fd0cf7 libc/arm64: work arround linker bug for cas()
at the _cas0 label, the linker would generate spurious stack
adjustment before the return:

atexitdont+0x84 0x000000000003614c	CLREX	$0xf
atexitdont+0x88 0x0000000000036150	MOVW	R31,R0
atexitdont+0x8c 0x0000000000036154	MOV	(SP)16!,R30 <- ????????????
atexitdont+0x90 0x0000000000036158	RETURN

the work arround is to move the code into its own cas0
text symbol.

this fixes impossible cwfs crashes in srvi().
2020-05-17 23:46:09 +02:00

13 lines
175 B
ArmAsm

TEXT _tas(SB), 1, $-4
MOVW $1, R2
_tas1:
LDXRW (R0), R1
STXRW R2, (R0), R3
CBNZ R3, _tas1
MOVW R1, R0
B _barrier(SB)
TEXT _barrier(SB), 1, $-4
DMB $0xB // ISH
RETURN