Home | History | Annotate | Download | only in issue9400
      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 // +build !gccgo
      6 
      7 #include "textflag.h"
      8 
      9 TEXT cas<>(SB),NOSPLIT,$0
     10 	MOVW	$0xffff0fc0, R15 // R15 is PC
     11 
     12 TEXT RewindAndSetgid(SB),NOSPLIT,$-4-0
     13 	// Save link register
     14 	MOVW	R14, R4
     15 
     16 	// Rewind stack pointer so anything that happens on the stack
     17 	// will clobber the test pattern created by the caller
     18 	ADD	$(1024 * 8), R13
     19 
     20 	// Ask signaller to setgid
     21 	MOVW	$Baton(SB), R2
     22 storeloop:
     23 	MOVW	0(R2), R0
     24 	MOVW	$1, R1
     25 	BL	cas<>(SB)
     26 	BCC	storeloop
     27 
     28 	// Wait for setgid completion
     29 loop:
     30 	MOVW	$0, R0
     31 	MOVW	$0, R1
     32 	BL	cas<>(SB)
     33 	BCC	loop
     34 
     35 	// Restore stack
     36 	SUB	$(1024 * 8), R13
     37 
     38 	MOVW	R4, R14
     39 	RET
     40