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