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