Text file misc/cgo/test/testdata/issue9400/asm_riscv64.s

     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  // +build riscv64
     6  // +build gc
     7  
     8  #include "textflag.h"
     9  
    10  TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0
    11  	// Rewind stack pointer so anything that happens on the stack
    12  	// will clobber the test pattern created by the caller
    13  	ADD	$(1024*8), X2
    14  
    15  	// Ask signaller to setgid
    16  	MOV	$1, X5
    17  	FENCE
    18  	MOVW	X5, ·Baton(SB)
    19  	FENCE
    20  
    21  	// Wait for setgid completion
    22  loop:
    23  	FENCE
    24  	MOVW	·Baton(SB), X5
    25  	OR	X6, X6, X6	// hint that we're in a spin loop
    26  	BNE	ZERO, X5, loop
    27  	FENCE
    28  
    29  	// Restore stack
    30  	ADD	$(-1024*8), X2
    31  	RET
    32  

View as plain text