asm_mipsx.s 664 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2016 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 mips mipsle
  5. // +build gc
  6. #include "textflag.h"
  7. TEXT ·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. ADDU $(1024*8), R29
  11. // Ask signaller to setgid
  12. MOVW $1, R1
  13. SYNC
  14. MOVW R1, ·Baton(SB)
  15. SYNC
  16. // Wait for setgid completion
  17. loop:
  18. SYNC
  19. MOVW ·Baton(SB), R1
  20. OR R2, R2, R2 // hint that we're in a spin loop
  21. BNE R1, loop
  22. SYNC
  23. // Restore stack
  24. ADDU $(-1024*8), R29
  25. RET