1
0
mirror of https://github.com/golang/go synced 2024-11-06 02:16:10 -07:00
go/misc/cgo/test/issue9400/asm_arm.s
Ian Lance Taylor e2b6cebcd6 misc/cgo/test/issue9400: fix to build with gccgo
This doesn't test much with gccgo, but at least it builds now, and the
test does, unsurprisingly, pass.  A proper test would require adding
assembly files in GCC syntax for all platforms that gccgo supports,
which would be infeasible.

Also added copyright headers to the asm files.

Change-Id: Icea5af29d7d521a0681506ddb617a79705b76d33
Reviewed-on: https://go-review.googlesource.com/9417
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-29 16:57:13 +00:00

40 lines
755 B
ArmAsm

// Copyright 2014 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.
// +build !gccgo
#include "textflag.h"
TEXT cas<>(SB),NOSPLIT,$0
MOVW $0xffff0fc0, R15 // R15 is PC
TEXT ·RewindAndSetgid(SB),NOSPLIT,$-4-0
// Save link register
MOVW R14, R4
// Rewind stack pointer so anything that happens on the stack
// will clobber the test pattern created by the caller
ADD $(1024 * 8), R13
// Ask signaller to setgid
MOVW $·Baton(SB), R2
storeloop:
MOVW 0(R2), R0
MOVW $1, R1
BL cas<>(SB)
BCC storeloop
// Wait for setgid completion
loop:
MOVW $0, R0
MOVW $0, R1
BL cas<>(SB)
BCC loop
// Restore stack
SUB $(1024 * 8), R13
MOVW R4, R14
RET