github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/src/pkg/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_arm2(void (*fn)(void), void (*setmg_gcc)(void *m, void *g), void *m, 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_arm2)
    22  EXT(crosscall_arm2):
    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  	mov r1, r3
    28  	blx r5 // setmg(m, g) 
    29  	blx r4 // fn() 
    30  	pop {r4, r5, r6, r7, r8, r9, r10, r11, ip, pc}
    31  
    32  .globl EXT(__stack_chk_fail_local)
    33  EXT(__stack_chk_fail_local):
    34  1:
    35  	b 1b
    36  
    37  #ifdef __ELF__
    38  .section .note.GNU-stack,"",%progbits
    39  #endif