github.com/bir3/gocompiler@v0.9.2202/src/cmd/cgo/internal/test/issue9400/asm_riscv64.s (about) 1 // Copyright 2020 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build riscv64 && gc 6 7 #include "textflag.h" 8 9 TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0 10 // Rewind stack pointer so anything that happens on the stack 11 // will clobber the test pattern created by the caller 12 ADD $(1024*8), X2 13 14 // Ask signaller to setgid 15 MOV $1, X5 16 FENCE 17 MOVW X5, ·Baton(SB) 18 FENCE 19 20 // Wait for setgid completion 21 loop: 22 FENCE 23 MOVW ·Baton(SB), X5 24 OR X6, X6, X6 // hint that we're in a spin loop 25 BNE ZERO, X5, loop 26 FENCE 27 28 // Restore stack 29 ADD $(-1024*8), X2 30 RET