github.com/ader1990/go@v0.0.0-20140630135419-8c24447fa791/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   * Because the assembler might target an earlier revision of the ISA
    16   * by default, we must explicitly specify the ISA revision to ensure
    17   * BLX is recognized as a valid instruction.
    18   */	
    19  .arch armv5t
    20  
    21  /*
    22   * void crosscall_arm2(void (*fn)(void), void (*setmg_gcc)(void *m, void *g), void *m, void *g)
    23   *
    24   * Calling into the 5c tool chain, where all registers are caller save.
    25   * Called from standard ARM EABI, where r4-r11 are callee-save, so they
    26   * must be saved explicitly.
    27   */
    28  .globl EXT(crosscall_arm2)
    29  EXT(crosscall_arm2):
    30  	push {r4, r5, r6, r7, r8, r9, r10, r11, ip, lr}
    31  	mov r4, r0
    32  	mov r5, r1
    33  	mov r0, r2
    34  	mov r1, r3
    35  	blx r5 // setmg(m, g) 
    36  	blx r4 // fn() 
    37  	pop {r4, r5, r6, r7, r8, r9, r10, r11, ip, pc}
    38  
    39  .globl EXT(__stack_chk_fail_local)
    40  EXT(__stack_chk_fail_local):
    41  1:
    42  	b 1b
    43  
    44  #ifdef __ELF__
    45  .section .note.GNU-stack,"",%progbits
    46  #endif