github.com/ader1990/go@v0.0.0-20140630135419-8c24447fa791/src/pkg/runtime/cgo/gcc_386.S (about) 1 // Copyright 2009 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__) || defined(_WIN32) 9 #define EXT(s) _##s 10 #else 11 #define EXT(s) s 12 #endif 13 14 /* 15 * void crosscall_386(void (*fn)(void)) 16 * 17 * Calling into the 8c tool chain, where all registers are caller save. 18 * Called from standard x86 ABI, where %ebp, %ebx, %esi, 19 * and %edi are callee-save, so they must be saved explicitly. 20 */ 21 .globl EXT(crosscall_386) 22 EXT(crosscall_386): 23 pushl %ebp 24 movl %esp, %ebp 25 pushl %ebx 26 pushl %esi 27 pushl %edi 28 29 movl 8(%ebp), %eax /* fn */ 30 call *%eax 31 32 popl %edi 33 popl %esi 34 popl %ebx 35 popl %ebp 36 ret 37 38 .globl EXT(__stack_chk_fail_local) 39 EXT(__stack_chk_fail_local): 40 1: 41 jmp 1b 42 43 #ifdef __ELF__ 44 .section .note.GNU-stack,"",@progbits 45 #endif