Home | History | Annotate | Download | only in runtime
      1 // Copyright 2011 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 "go_asm.h"
      6 #include "go_tls.h"
      7 #include "textflag.h"
      8 
      9 TEXT _rt0_amd64_windows(SB),NOSPLIT,$-8
     10 	LEAQ	8(SP), SI // argv
     11 	MOVQ	0(SP), DI // argc
     12 	MOVQ	$main(SB), AX
     13 	JMP	AX
     14 
     15 // When building with -buildmode=(c-shared or c-archive), this
     16 // symbol is called. For dynamic libraries it is called when the
     17 // library is loaded. For static libraries it is called when the
     18 // final executable starts, during the C runtime initialization
     19 // phase.
     20 TEXT _rt0_amd64_windows_lib(SB),NOSPLIT,$0x28
     21 	MOVQ	BP, 0x00(SP)
     22 	MOVQ	BX, 0x08(SP)
     23 	MOVQ	AX, 0x10(SP)
     24 	MOVQ  CX, 0x18(SP)
     25 	MOVQ  DX, 0x20(SP)
     26 
     27 	// Create a new thread to do the runtime initialization and return.
     28 	MOVQ	_cgo_sys_thread_create(SB), AX
     29 	MOVQ	$_rt0_amd64_windows_lib_go(SB), CX
     30 	MOVQ	$0, DX
     31 	CALL	AX
     32 
     33 	MOVQ	0x00(SP), BP
     34 	MOVQ	0x08(SP), BX
     35 	MOVQ	0x10(SP), AX
     36 	MOVQ	0x18(SP), CX
     37 	MOVQ	0x20(SP), DX
     38 	RET
     39 
     40 TEXT _rt0_amd64_windows_lib_go(SB),NOSPLIT,$0
     41 	MOVQ  $0, DI
     42 	MOVQ	$0, SI
     43 	MOVQ	$runtimert0_go(SB), AX
     44 	JMP	AX
     45 
     46 TEXT main(SB),NOSPLIT,$-8
     47 	MOVQ	$runtimert0_go(SB), AX
     48 	JMP	AX
     49