• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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//go:build (mips || mipsle) && gc
6
7#include "textflag.h"
8
9TEXT ·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	ADDU	$(1024*8), R29
13
14	// Ask signaller to setgid
15	MOVW	$1, R1
16	SYNC
17	MOVW	R1, ·Baton(SB)
18	SYNC
19
20	// Wait for setgid completion
21loop:
22	SYNC
23	MOVW	·Baton(SB), R1
24	OR	R2, R2, R2	// hint that we're in a spin loop
25	BNE	R1, loop
26	SYNC
27
28	// Restore stack
29	ADDU	$(-1024*8), R29
30	RET
31