github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/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 .file "gcc_386.S" 6 7 /* 8 * Windows still insists on underscore prefixes for C function names. 9 */ 10 #if defined(_WIN32) 11 #define EXT(s) _##s 12 #else 13 #define EXT(s) s 14 #endif 15 16 /* 17 * void crosscall_386(void (*fn)(void)) 18 * 19 * Calling into the 8c tool chain, where all registers are caller save. 20 * Called from standard x86 ABI, where %ebp, %ebx, %esi, 21 * and %edi are callee-save, so they must be saved explicitly. 22 */ 23 .globl EXT(crosscall_386) 24 EXT(crosscall_386): 25 pushl %ebp 26 movl %esp, %ebp 27 pushl %ebx 28 pushl %esi 29 pushl %edi 30 31 movl 8(%ebp), %eax /* fn */ 32 call *%eax 33 34 popl %edi 35 popl %esi 36 popl %ebx 37 popl %ebp 38 ret 39 40 #ifdef __ELF__ 41 .section .note.GNU-stack,"",@progbits 42 #endif