| 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 (ppc64 || ppc64le) && gc |
| 6 |
|
| 7 |
#include "textflag.h" |
| 8 |
|
| 9 |
TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$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), R1 |
| 13 |
|
| 14 |
// Ask signaller to setgid |
| 15 |
MOVW $1, R3 |
| 16 |
SYNC |
| 17 |
MOVW R3, ·Baton(SB) |
| 18 |
|
| 19 |
// Wait for setgid completion |
| 20 |
loop: |
| 21 |
SYNC |
| 22 |
MOVW ·Baton(SB), R3 |
| 23 |
CMP R3, $0 |
| 24 |
// Hint that we're in a spin loop |
| 25 |
OR R1, R1, R1 |
| 26 |
BNE loop |
| 27 |
ISYNC |
| 28 |
|
| 29 |
// Restore stack |
| 30 |
SUB $(1024 * 8), R1 |
| 31 |
RET |