github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/misc/cgo/test/issue9400/asm_mips64x.s (about)

     1  // Copyright 2016 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 mips64 mips64le
     6  // +build !gccgo
     7  
     8  #include "textflag.h"
     9  
    10  #define SYNC	WORD $0xf
    11  
    12  TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0
    13  	// Rewind stack pointer so anything that happens on the stack
    14  	// will clobber the test pattern created by the caller
    15  	ADDV	$(1024*8), R29
    16  
    17  	// Ask signaller to setgid
    18  	MOVW	$1, R1
    19  	SYNC
    20  	MOVW	R1, ·Baton(SB)
    21  	SYNC
    22  
    23  	// Wait for setgid completion
    24  loop:
    25  	SYNC
    26  	MOVW	·Baton(SB), R1
    27  	OR	R2, R2, R2	// hint that we're in a spin loop
    28  	BNE	R1, loop
    29  	SYNC
    30  
    31  	// Restore stack
    32  	ADDV	$(-1024*8), R29
    33  	RET