...
1// Copyright 2022 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#include "textflag.h"
6
7TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0
8 // Rewind stack pointer so anything that happens on the stack
9 // will clobber the test pattern created by the caller
10 ADDV $(1024*8), R3
11
12 // Ask signaller to setgid
13 MOVW $1, R12
14 DBAR
15 MOVW R12, ·Baton(SB)
16 DBAR
17
18 // Wait for setgid completion
19loop:
20 DBAR
21 MOVW ·Baton(SB), R12
22 OR R13, R13, R13 // hint that we're in a spin loop
23 BNE R12, loop
24 DBAR
25
26 // Restore stack
27 ADDV $(-1024*8), R3
28 RET
View as plain text