asm_amd64x.s 590 B

123456789101112131415161718192021222324252627
  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. // +build amd64 amd64p32
  5. // +build gc
  6. #include "textflag.h"
  7. TEXT ·RewindAndSetgid(SB),NOSPLIT,$0-0
  8. // Rewind stack pointer so anything that happens on the stack
  9. // will clobber the test pattern created by the caller
  10. ADDQ $(1024 * 8), SP
  11. // Ask signaller to setgid
  12. MOVL $1, ·Baton(SB)
  13. // Wait for setgid completion
  14. loop:
  15. PAUSE
  16. MOVL ·Baton(SB), AX
  17. CMPL AX, $0
  18. JNE loop
  19. // Restore stack
  20. SUBQ $(1024 * 8), SP
  21. RET