2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2014 The Go Authors. All rights reserved.
|
2015-04-28 18:58:17 -06:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// +build !gccgo
|
|
|
|
|
2014-12-19 14:16:17 -07:00
|
|
|
#include "textflag.h"
|
|
|
|
|
|
|
|
TEXT ·RewindAndSetgid(SB),NOSPLIT,$0-0
|
2016-06-02 07:00:34 -06:00
|
|
|
MOVL $·Baton(SB), BX
|
2014-12-19 14:16:17 -07:00
|
|
|
// Rewind stack pointer so anything that happens on the stack
|
|
|
|
// will clobber the test pattern created by the caller
|
|
|
|
ADDL $(1024 * 8), SP
|
|
|
|
|
|
|
|
// Ask signaller to setgid
|
2016-06-02 07:00:34 -06:00
|
|
|
MOVL $1, (BX)
|
2014-12-19 14:16:17 -07:00
|
|
|
|
|
|
|
// Wait for setgid completion
|
|
|
|
loop:
|
|
|
|
PAUSE
|
2016-06-02 07:00:34 -06:00
|
|
|
MOVL (BX), AX
|
2014-12-19 14:16:17 -07:00
|
|
|
CMPL AX, $0
|
|
|
|
JNE loop
|
|
|
|
|
|
|
|
// Restore stack
|
|
|
|
SUBL $(1024 * 8), SP
|
|
|
|
RET
|