github.com/aloncn/graphics-go@v0.0.1/src/runtime/rt0_darwin_386.s (about) 1 // Copyright 2009 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_386_darwin(SB),NOSPLIT,$8 8 MOVL 8(SP), AX 9 LEAL 12(SP), BX 10 MOVL AX, 0(SP) 11 MOVL BX, 4(SP) 12 CALL main(SB) 13 INT $3 14 15 // With -buildmode=c-archive, this symbol is called from a global constructor. 16 TEXT _rt0_386_darwin_lib(SB),NOSPLIT,$0 17 PUSHL BP 18 MOVL SP, BP 19 PUSHL BX 20 PUSHL SI 21 PUSHL DI 22 23 MOVL 8(BP), AX 24 MOVL AX, _rt0_386_darwin_lib_argc<>(SB) 25 MOVL 12(BP), AX 26 MOVL AX, _rt0_386_darwin_lib_argv<>(SB) 27 28 // Synchronous initialization. 29 MOVL $runtime·libpreinit(SB), AX 30 CALL AX 31 32 SUBL $12, SP 33 34 // Create a new thread to do the runtime initialization and return. 35 MOVL _cgo_sys_thread_create(SB), AX 36 TESTL AX, AX 37 JZ nocgo 38 MOVL $_rt0_386_darwin_lib_go(SB), BX 39 MOVL BX, 0(SP) 40 MOVL $0, 4(SP) 41 CALL AX 42 JMP restore 43 44 nocgo: 45 MOVL $0x800000, 0(SP) // stacksize = 8192KB 46 MOVL $_rt0_386_darwin_lib_go(SB), AX 47 MOVL AX, 4(SP) // fn 48 MOVL $0, 8(SP) // fnarg 49 MOVL $runtime·newosproc0(SB), AX 50 CALL AX 51 52 restore: 53 ADDL $12, SP 54 POPL DI 55 POPL SI 56 POPL BX 57 POPL BP 58 RET 59 60 TEXT _rt0_386_darwin_lib_go(SB),NOSPLIT,$12 61 MOVL _rt0_386_darwin_lib_argc<>(SB), AX 62 MOVL AX, 0(SP) 63 MOVL _rt0_386_darwin_lib_argv<>(SB), AX 64 MOVL AX, 4(SP) 65 MOVL $runtime·rt0_go(SB), AX 66 CALL AX 67 RET 68 69 DATA _rt0_386_darwin_lib_argc<>(SB)/4, $0 70 GLOBL _rt0_386_darwin_lib_argc<>(SB),NOPTR, $4 71 DATA _rt0_386_darwin_lib_argv<>(SB)/4, $0 72 GLOBL _rt0_386_darwin_lib_argv<>(SB),NOPTR, $4 73 74 TEXT main(SB),NOSPLIT,$0 75 JMP runtime·rt0_go(SB)