| 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 gc |
| 6 |
|
| 7 |
#include "textflag.h" |
| 8 |
|
| 9 |
TEXT ·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 |
ADD $(1024 * 8), R15 |
| 13 |
|
| 14 |
// Ask signaller to setgid |
| 15 |
MOVD $·Baton(SB), R5 |
| 16 |
MOVW $1, 0(R5) |
| 17 |
|
| 18 |
// Wait for setgid completion |
| 19 |
loop: |
| 20 |
SYNC |
| 21 |
MOVW ·Baton(SB), R3 |
| 22 |
CMPBNE R3, $0, loop |
| 23 |
|
| 24 |
// Restore stack |
| 25 |
SUB $(1024 * 8), R15 |
| 26 |
RET |