...
Run Format

Text file src/runtime/rt0_darwin_arm64.s

Documentation: runtime

     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	#include "textflag.h"
     6	
     7	// No need for _rt0_arm64_darwin as darwin/arm64 only
     8	// supports external linking.
     9	TEXT _rt0_arm64_darwin(SB),NOSPLIT,$-8
    10		MOVD	$42, R0
    11		MOVD	$1, R16	// SYS_exit
    12		SVC	$0x80
    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/arm64 platforms require
    18	// cgo and do not support c-shared.
    19	TEXT _rt0_arm64_darwin_lib(SB),NOSPLIT,$168
    20		// Preserve callee-save registers.
    21		MOVD R19, 24(RSP)
    22		MOVD R20, 32(RSP)
    23		MOVD R21, 40(RSP)
    24		MOVD R22, 48(RSP)
    25		MOVD R23, 56(RSP)
    26		MOVD R24, 64(RSP)
    27		MOVD R25, 72(RSP)
    28		MOVD R26, 80(RSP)
    29		MOVD R27, 88(RSP)
    30		FMOVD F8, 96(RSP)
    31		FMOVD F9, 104(RSP)
    32		FMOVD F10, 112(RSP)
    33		FMOVD F11, 120(RSP)
    34		FMOVD F12, 128(RSP)
    35		FMOVD F13, 136(RSP)
    36		FMOVD F14, 144(RSP)
    37		FMOVD F15, 152(RSP)
    38	
    39		MOVD  R0, _rt0_arm64_darwin_lib_argc<>(SB)
    40		MOVD  R1, _rt0_arm64_darwin_lib_argv<>(SB)
    41	
    42		// Synchronous initialization.
    43		MOVD	$runtime·libpreinit(SB), R4
    44		BL	(R4)
    45	
    46		// Create a new thread to do the runtime initialization and return.
    47		MOVD  _cgo_sys_thread_create(SB), R4
    48		MOVD  $_rt0_arm64_darwin_lib_go(SB), R0
    49		MOVD  $0, R1
    50		BL    (R4)
    51	
    52		// Restore callee-save registers.
    53		MOVD 24(RSP), R19
    54		MOVD 32(RSP), R20
    55		MOVD 40(RSP), R21
    56		MOVD 48(RSP), R22
    57		MOVD 56(RSP), R23
    58		MOVD 64(RSP), R24
    59		MOVD 72(RSP), R25
    60		MOVD 80(RSP), R26
    61		MOVD 88(RSP), R27
    62		FMOVD 96(RSP), F8
    63		FMOVD 104(RSP), F9
    64		FMOVD 112(RSP), F10
    65		FMOVD 120(RSP), F11
    66		FMOVD 128(RSP), F12
    67		FMOVD 136(RSP), F13
    68		FMOVD 144(RSP), F14
    69		FMOVD 152(RSP), F15
    70		RET
    71	
    72	TEXT _rt0_arm64_darwin_lib_go(SB),NOSPLIT,$0
    73		MOVD  _rt0_arm64_darwin_lib_argc<>(SB), R0
    74		MOVD  _rt0_arm64_darwin_lib_argv<>(SB), R1
    75		MOVD  $runtime·rt0_go(SB), R4
    76		B     (R4)
    77	
    78	DATA  _rt0_arm64_darwin_lib_argc<>(SB)/8, $0
    79	GLOBL _rt0_arm64_darwin_lib_argc<>(SB),NOPTR, $8
    80	DATA  _rt0_arm64_darwin_lib_argv<>(SB)/8, $0
    81	GLOBL _rt0_arm64_darwin_lib_argv<>(SB),NOPTR, $8
    82	
    83	TEXT main(SB),NOSPLIT,$-8
    84		MOVD	$runtime·rt0_go(SB), R2
    85		BL	(R2)
    86	exit:
    87		MOVD	$0, R0
    88		MOVD	$1, R16	// sys_exit
    89		SVC	$0x80
    90		B	exit

View as plain text