github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/runtime/cgo/gcc_arm64.S (about) 1 // Copyright 2015 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_arm64.S" 6 7 /* 8 * Apple still insists on underscore prefixes for C function names. 9 */ 10 #if defined(__APPLE__) 11 #define EXT(s) _##s 12 #else 13 #define EXT(s) s 14 #endif 15 16 // Apple's ld64 wants 4-byte alignment for ARM code sections. 17 // .align in both Apple as and GNU as treat n as aligning to 2**n bytes. 18 .align 2 19 20 /* 21 * void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g) 22 * 23 * Calling into the gc tool chain, where all registers are caller save. 24 * Called from standard ARM EABI, where x19-x29 are callee-save, so they 25 * must be saved explicitly, along with x30 (LR). 26 */ 27 .globl EXT(crosscall1) 28 EXT(crosscall1): 29 .cfi_startproc 30 stp x29, x30, [sp, #-96]! 31 .cfi_def_cfa_offset 96 32 .cfi_offset 29, -96 33 .cfi_offset 30, -88 34 mov x29, sp 35 .cfi_def_cfa_register 29 36 stp x19, x20, [sp, #80] 37 .cfi_offset 19, -16 38 .cfi_offset 20, -8 39 stp x21, x22, [sp, #64] 40 .cfi_offset 21, -32 41 .cfi_offset 22, -24 42 stp x23, x24, [sp, #48] 43 .cfi_offset 23, -48 44 .cfi_offset 24, -40 45 stp x25, x26, [sp, #32] 46 .cfi_offset 25, -64 47 .cfi_offset 26, -56 48 stp x27, x28, [sp, #16] 49 .cfi_offset 27, -80 50 .cfi_offset 28, -72 51 52 mov x19, x0 53 mov x20, x1 54 mov x0, x2 55 56 blr x20 57 blr x19 58 59 ldp x27, x28, [sp, #16] 60 .cfi_restore 27 61 .cfi_restore 28 62 ldp x25, x26, [sp, #32] 63 .cfi_restore 25 64 .cfi_restore 26 65 ldp x23, x24, [sp, #48] 66 .cfi_restore 23 67 .cfi_restore 24 68 ldp x21, x22, [sp, #64] 69 .cfi_restore 21 70 .cfi_restore 22 71 ldp x19, x20, [sp, #80] 72 .cfi_restore 19 73 .cfi_restore 20 74 ldp x29, x30, [sp], #96 75 .cfi_restore 29 76 .cfi_restore 30 77 .cfi_def_cfa 31, 0 78 ret 79 .cfi_endproc 80 81 82 #ifdef __ELF__ 83 .section .note.GNU-stack,"",%progbits 84 #endif