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