Home | History | Annotate | Download | only in runtime
      1 // Copyright 2014 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 #include "textflag.h"
      6 
      7 TEXT _rt0_arm_darwin(SB),7,$-4
      8 	// prepare arguments for main (_rt0_go)
      9 	MOVW	(R13), R0	// argc
     10 	MOVW	$4(R13), R1		// argv
     11 	MOVW	$main(SB), R4
     12 	B		(R4)
     13 
     14 // When linking with -buildmode=c-archive or -buildmode=c-shared,
     15 // this symbol is called from a global initialization function.
     16 //
     17 // Note that all currently shipping darwin/arm platforms require
     18 // cgo and do not support c-shared.
     19 TEXT _rt0_arm_darwin_lib(SB),NOSPLIT,$12
     20 	MOVW  R0, _rt0_arm_darwin_lib_argc<>(SB)
     21 	MOVW  R1, _rt0_arm_darwin_lib_argv<>(SB)
     22 
     23 	// Create a new thread to do the runtime initialization and return.
     24 	MOVW  _cgo_sys_thread_create(SB), R4
     25 	CMP   $0, R4
     26 	B.EQ  nocgo
     27 	MOVW  $_rt0_arm_darwin_lib_go(SB), R0
     28 	MOVW  $0, R1
     29 	BL    (R4)
     30 	RET
     31 nocgo:
     32 	MOVW  $0x400000, R0
     33 	MOVW  $_rt0_arm_darwin_lib_go(SB), R1
     34 	MOVW  $0, R2
     35 	MOVW  R0,  (R13) // stacksize
     36 	MOVW  R1, 4(R13) // fn
     37 	MOVW  R2, 8(R13) // fnarg
     38 	MOVW  $runtimenewosproc0(SB), R4
     39 	BL    (R4)
     40 	RET
     41 
     42 TEXT _rt0_arm_darwin_lib_go(SB),NOSPLIT,$0
     43 	MOVW  _rt0_arm_darwin_lib_argc<>(SB), R0
     44 	MOVW  _rt0_arm_darwin_lib_argv<>(SB), R1
     45 	MOVW  R0,  (R13)
     46 	MOVW  R1, 4(R13)
     47 	MOVW  $runtimert0_go(SB), R4
     48 	B     (R4)
     49 
     50 DATA  _rt0_arm_darwin_lib_argc<>(SB)/4, $0
     51 GLOBL _rt0_arm_darwin_lib_argc<>(SB),NOPTR, $4
     52 DATA  _rt0_arm_darwin_lib_argv<>(SB)/4, $0
     53 GLOBL _rt0_arm_darwin_lib_argv<>(SB),NOPTR, $4
     54 
     55 TEXT main(SB),NOSPLIT,$-8
     56 	// save argc and argv onto stack
     57 	MOVM.DB.W [R0-R1], (R13)
     58 	MOVW	$runtimert0_go(SB), R4
     59 	B		(R4)
     60