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/* 6 * Apple still insists on underscore prefixes for C function names. 7 */ 8#if defined(__APPLE__) 9#define EXT(s) _##s 10#else 11#define EXT(s) s 12#endif 13 14// Apple's ld64 wants 4-byte alignment for ARM code sections. 15// .align in both Apple as and GNU as treat n as aligning to 2**n bytes. 16.align 2 17 18/* 19 * void crosscall_arm1(void (*fn)(void), void (*setg_gcc)(void *g), void *g) 20 * 21 * Calling into the 5c tool chain, where all registers are caller save. 22 * Called from standard ARM EABI, where r4-r11 are callee-save, so they 23 * must be saved explicitly. 24 */ 25.globl EXT(crosscall_arm1) 26EXT(crosscall_arm1): 27 push {r4, r5, r6, r7, r8, r9, r10, r11, ip, lr} 28 mov r4, r0 29 mov r5, r1 30 mov r0, r2 31 32 // Because the assembler might target an earlier revision of the ISA 33 // by default, we encode BLX as a .word. 34 .word 0xe12fff35 // blx r5 // setg(g) 35 .word 0xe12fff34 // blx r4 // fn() 36 37 pop {r4, r5, r6, r7, r8, r9, r10, r11, ip, pc} 38 39 40#ifdef __ELF__ 41.section .note.GNU-stack,"",%progbits 42#endif 43