github.com/tcnksm/go@v0.0.0-20141208075154-439b32936367/src/runtime/cgo/gcc_arm.S (about) 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 /* 15 * void crosscall_arm1(void (*fn)(void), void (*setg_gcc)(void *g), void *g) 16 * 17 * Calling into the 5c tool chain, where all registers are caller save. 18 * Called from standard ARM EABI, where r4-r11 are callee-save, so they 19 * must be saved explicitly. 20 */ 21 .globl EXT(crosscall_arm1) 22 EXT(crosscall_arm1): 23 push {r4, r5, r6, r7, r8, r9, r10, r11, ip, lr} 24 mov r4, r0 25 mov r5, r1 26 mov r0, r2 27 28 // Because the assembler might target an earlier revision of the ISA 29 // by default, we encode BLX as a .word. 30 .word 0xe12fff35 // blx r5 // setg(g) 31 .word 0xe12fff34 // blx r4 // fn() 32 33 pop {r4, r5, r6, r7, r8, r9, r10, r11, ip, pc} 34 35 .globl EXT(__stack_chk_fail_local) 36 EXT(__stack_chk_fail_local): 37 1: 38 b 1b 39 40 #ifdef __ELF__ 41 .section .note.GNU-stack,"",%progbits 42 #endif