Home | History | Annotate | Download | only in runtime
      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_linux(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 // When building with -buildmode=c-shared, this symbol is called when the shared
     16 // library is loaded.
     17 TEXT _rt0_386_linux_lib(SB),NOSPLIT,$0
     18 	PUSHL	BP
     19 	MOVL	SP, BP
     20 	PUSHL	BX
     21 	PUSHL	SI
     22 	PUSHL	DI
     23 
     24 	MOVL	8(BP), AX
     25 	MOVL	AX, _rt0_386_linux_lib_argc<>(SB)
     26 	MOVL	12(BP), AX
     27 	MOVL	AX, _rt0_386_linux_lib_argv<>(SB)
     28 
     29 	SUBL	$8, SP
     30 
     31 	// Create a new thread to do the runtime initialization.
     32 	MOVL	_cgo_sys_thread_create(SB), AX
     33 	TESTL	AX, AX
     34 	JZ	nocgo
     35 	MOVL	$_rt0_386_linux_lib_go(SB), BX
     36 	MOVL	BX, 0(SP)
     37 	MOVL	$0, 4(SP)
     38 	CALL	AX
     39 	JMP	restore
     40 
     41 nocgo:
     42 	MOVL	$0x800000, 0(SP)                    // stacksize = 8192KB
     43 	MOVL	$_rt0_386_linux_lib_go(SB), AX
     44 	MOVL	AX, 4(SP)                           // fn
     45 	MOVL	$runtimenewosproc0(SB), AX
     46 	CALL	AX
     47 
     48 restore:
     49 	ADDL	$8, SP
     50 	POPL	DI
     51 	POPL	SI
     52 	POPL	BX
     53 	POPL	BP
     54 	RET
     55 
     56 TEXT _rt0_386_linux_lib_go(SB),NOSPLIT,$12
     57 	MOVL	_rt0_386_linux_lib_argc<>(SB), AX
     58 	MOVL	AX, 0(SP)
     59 	MOVL	_rt0_386_linux_lib_argv<>(SB), AX
     60 	MOVL	AX, 4(SP)
     61 	MOVL	$runtimert0_go(SB), AX
     62 	CALL	AX
     63 	RET
     64 
     65 DATA _rt0_386_linux_lib_argc<>(SB)/4, $0
     66 GLOBL _rt0_386_linux_lib_argc<>(SB),NOPTR, $4
     67 DATA _rt0_386_linux_lib_argv<>(SB)/4, $0
     68 GLOBL _rt0_386_linux_lib_argv<>(SB),NOPTR, $4
     69 
     70 TEXT main(SB),NOSPLIT,$0
     71 	JMP	runtimert0_go(SB)
     72 
     73 TEXT _fallback_vdso(SB),NOSPLIT,$0
     74 	INT	$0x80
     75 	RET
     76 
     77 DATA	runtime_vdso(SB)/4, $_fallback_vdso(SB)
     78 GLOBL	runtime_vdso(SB), NOPTR, $4
     79 
     80