Text file src/runtime/cgo/gcc_arm64.S

     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  /*
     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 crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
    20   *
    21   * Calling into the gc tool chain, where all registers are caller save.
    22   * Called from standard ARM EABI, where x19-x29 are callee-save, so they
    23   * must be saved explicitly, along with x30 (LR).
    24   */
    25  .globl EXT(crosscall1)
    26  EXT(crosscall1):
    27  	.cfi_startproc
    28  	stp x29, x30, [sp, #-96]!
    29  	.cfi_def_cfa_offset 96
    30  	.cfi_offset 29, -96
    31  	.cfi_offset 30, -88
    32  	mov x29, sp
    33  	.cfi_def_cfa_register 29
    34  	stp x19, x20, [sp, #80]
    35  	.cfi_offset 19, -16
    36  	.cfi_offset 20, -8
    37  	stp x21, x22, [sp, #64]
    38  	.cfi_offset 21, -32
    39  	.cfi_offset 22, -24
    40  	stp x23, x24, [sp, #48]
    41  	.cfi_offset 23, -48
    42  	.cfi_offset 24, -40
    43  	stp x25, x26, [sp, #32]
    44  	.cfi_offset 25, -64
    45  	.cfi_offset 26, -56
    46  	stp x27, x28, [sp, #16]
    47  	.cfi_offset 27, -80
    48  	.cfi_offset 28, -72
    49  
    50  	mov x19, x0
    51  	mov x20, x1
    52  	mov x0, x2
    53  
    54  	blr x20
    55  	blr x19
    56  
    57  	ldp x27, x28, [sp, #16]
    58  	.cfi_restore 27
    59  	.cfi_restore 28
    60  	ldp x25, x26, [sp, #32]
    61  	.cfi_restore 25
    62  	.cfi_restore 26
    63  	ldp x23, x24, [sp, #48]
    64  	.cfi_restore 23
    65  	.cfi_restore 24
    66  	ldp x21, x22, [sp, #64]
    67  	.cfi_restore 21
    68  	.cfi_restore 22
    69  	ldp x19, x20, [sp, #80]
    70  	.cfi_restore 19
    71  	.cfi_restore 20
    72  	ldp x29, x30, [sp], #96
    73  	.cfi_restore 29
    74  	.cfi_restore 30
    75  	.cfi_def_cfa 31, 0
    76  	ret
    77  	.cfi_endproc
    78  
    79  
    80  #ifdef __ELF__
    81  .section .note.GNU-stack,"",%progbits
    82  #endif
    83  

View as plain text