• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2014 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 (amd64 || amd64p32) && gc
6
7#include "textflag.h"
8
9TEXT ·RewindAndSetgid(SB),NOSPLIT,$0-0
10	// Rewind stack pointer so anything that happens on the stack
11	// will clobber the test pattern created by the caller
12	ADDQ	$(1024 * 8), SP
13
14	// Ask signaller to setgid
15	MOVL	$1, ·Baton(SB)
16
17	// Wait for setgid completion
18loop:
19	PAUSE
20	MOVL	·Baton(SB), AX
21	CMPL	AX, $0
22	JNE	loop
23
24	// Restore stack
25	SUBQ	$(1024 * 8), SP
26	RET
27