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 gc 6 7#include "textflag.h" 8 9TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0 10 // Save link register 11 MOVD R30, R9 12 13 // Rewind stack pointer so anything that happens on the stack 14 // will clobber the test pattern created by the caller 15 ADD $(1024 * 8), RSP 16 17 // Ask signaller to setgid 18 MOVD $·Baton(SB), R0 19 MOVD $1, R1 20storeloop: 21 LDAXRW (R0), R2 22 STLXRW R1, (R0), R3 23 CBNZ R3, storeloop 24 25 // Wait for setgid completion 26 MOVW $0, R1 27 MOVW $0, R2 28loop: 29 LDAXRW (R0), R3 30 CMPW R1, R3 31 BNE loop 32 STLXRW R2, (R0), R3 33 CBNZ R3, loop 34 35 // Restore stack 36 SUB $(1024 * 8), RSP 37 38 MOVD R9, R30 39 RET 40