1// Copyright 2012 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.file "gcc_arm.S"
6
7/*
8 * void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
9 *
10 * Calling into the gc tool chain, where all registers are caller save.
11 * Called from standard ARM EABI, where r4-r11 are callee-save, so they
12 * must be saved explicitly.
13 */
14.globl crosscall1
15crosscall1:
16	push {r4, r5, r6, r7, r8, r9, r10, r11, ip, lr}
17	mov r4, r0
18	mov r5, r1
19	mov r0, r2
20
21	// Because the assembler might target an earlier revision of the ISA
22	// by default, we encode BLX as a .word.
23	.word 0xe12fff35 // blx r5 // setg(g)
24	.word 0xe12fff34 // blx r4 // fn()
25
26	pop {r4, r5, r6, r7, r8, r9, r10, r11, ip, pc}
27
28
29#ifdef __ELF__
30.section .note.GNU-stack,"",%progbits
31#endif
32