rsc.io/go@v0.0.0-20150416155037-e040fd465409/misc/cgo/test/issue9400/asm_arm64.s (about) 1 #include "textflag.h" 2 3 TEXT ·RewindAndSetgid(SB),NOSPLIT,$-8-0 4 // Save link register 5 MOVD R30, R9 6 7 // Rewind stack pointer so anything that happens on the stack 8 // will clobber the test pattern created by the caller 9 ADD $(1024 * 8), RSP 10 11 // Ask signaller to setgid 12 MOVD $·Baton(SB), R0 13 MOVD $1, R1 14 storeloop: 15 LDAXRW (R0), R2 16 STLXRW R1, (R0), R3 17 CBNZ R3, storeloop 18 19 // Wait for setgid completion 20 MOVW $0, R1 21 MOVW $0, R2 22 loop: 23 LDAXRW (R0), R3 24 CMPW R1, R3 25 BNE loop 26 STLXRW R2, (R0), R3 27 CBNZ R3, loop 28 29 // Restore stack 30 SUB $(1024 * 8), RSP 31 32 MOVD R9, R30 33 RET