github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/misc/cgo/test/issue9400/asm_mipsx.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 mips mipsle
     6  // +build !gccgo
     7  
     8  #include "textflag.h"
     9  
    10  TEXT ·RewindAndSetgid(SB),NOSPLIT,$-4-0
    11  	// Rewind stack pointer so anything that happens on the stack
    12  	// will clobber the test pattern created by the caller
    13  	ADDU	$(1024*8), R29
    14  
    15  	// Ask signaller to setgid
    16  	MOVW	$1, R1
    17  	SYNC
    18  	MOVW	R1, ·Baton(SB)
    19  	SYNC
    20  
    21  	// Wait for setgid completion
    22  loop:
    23  	SYNC
    24  	MOVW	·Baton(SB), R1
    25  	OR	R2, R2, R2	// hint that we're in a spin loop
    26  	BNE	R1, loop
    27  	SYNC
    28  
    29  	// Restore stack
    30  	ADDU	$(-1024*8), R29
    31  	RET