github.com/s1s1ty/go@v0.0.0-20180207192209-104445e3140f/src/runtime/rt0_windows_amd64.s (about)

     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  	JMP	_rt0_amd64(SB)
    11  
    12  // When building with -buildmode=(c-shared or c-archive), this
    13  // symbol is called. For dynamic libraries it is called when the
    14  // library is loaded. For static libraries it is called when the
    15  // final executable starts, during the C runtime initialization
    16  // phase.
    17  TEXT _rt0_amd64_windows_lib(SB),NOSPLIT,$0x28
    18  	MOVQ	BP, 0x00(SP)
    19  	MOVQ	BX, 0x08(SP)
    20  	MOVQ	AX, 0x10(SP)
    21  	MOVQ  CX, 0x18(SP)
    22  	MOVQ  DX, 0x20(SP)
    23  
    24  	// Create a new thread to do the runtime initialization and return.
    25  	MOVQ	_cgo_sys_thread_create(SB), AX
    26  	MOVQ	$_rt0_amd64_windows_lib_go(SB), CX
    27  	MOVQ	$0, DX
    28  	CALL	AX
    29  
    30  	MOVQ	0x00(SP), BP
    31  	MOVQ	0x08(SP), BX
    32  	MOVQ	0x10(SP), AX
    33  	MOVQ	0x18(SP), CX
    34  	MOVQ	0x20(SP), DX
    35  	RET
    36  
    37  TEXT _rt0_amd64_windows_lib_go(SB),NOSPLIT,$0
    38  	MOVQ  $0, DI
    39  	MOVQ	$0, SI
    40  	MOVQ	$runtime·rt0_go(SB), AX
    41  	JMP	AX