--- /dev/null
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "textflag.h"
+
+TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0
+ // Rewind stack pointer so anything that happens on the stack
+ // will clobber the test pattern created by the caller
+ ADDV $(1024*8), R3
+
+ // Ask signaller to setgid
+ MOVW $1, R12
+ DBAR
+ MOVW R12, ·Baton(SB)
+ DBAR
+
+ // Wait for setgid completion
+loop:
+ DBAR
+ MOVW ·Baton(SB), R12
+ OR R13, R13, R13 // hint that we're in a spin loop
+ BNE R12, loop
+ DBAR
+
+ // Restore stack
+ ADDV $(-1024*8), R3
+ RET
// errorcheck -0 -d=ssa/intrinsics/debug
-// +build amd64 arm64 mips mipsle mips64 mips64le ppc64 ppc64le riscv64 s390x
+// +build amd64 arm64 loong64 mips mipsle mips64 mips64le ppc64 ppc64le riscv64 s390x
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
case "mips64", "mips64le":
ptrSize = 8
fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
+ case "loong64":
+ ptrSize = 8
+ fmt.Fprintf(&buf, "#define REGISTER (R0)\n")
case "ppc64", "ppc64le":
ptrSize = 8
fmt.Fprintf(&buf, "#define REGISTER (CTR)\n")
"amd64": {"GOAMD64", "v1", "v2", "v3", "v4"},
"arm": {"GOARM", "5", "6", "7"},
"arm64": {},
+ "loong64": {},
"mips": {"GOMIPS", "hardfloat", "softfloat"},
"mips64": {"GOMIPS64", "hardfloat", "softfloat"},
"ppc64": {"GOPPC64", "power8", "power9"},