Text file src/runtime/rt0_windows_386.s

     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_windows(SB),NOSPLIT,$0
     8  	JMP	_rt0_386(SB)
     9  
    10  // When building with -buildmode=(c-shared or c-archive), this
    11  // symbol is called. For dynamic libraries it is called when the
    12  // library is loaded. For static libraries it is called when the
    13  // final executable starts, during the C runtime initialization
    14  // phase.
    15  TEXT _rt0_386_windows_lib(SB),NOSPLIT,$0x1C
    16  	MOVL	BP, 0x08(SP)
    17  	MOVL	BX, 0x0C(SP)
    18  	MOVL	AX, 0x10(SP)
    19  	MOVL  CX, 0x14(SP)
    20  	MOVL  DX, 0x18(SP)
    21  
    22  	// Create a new thread to do the runtime initialization and return.
    23  	MOVL	_cgo_sys_thread_create(SB), AX
    24  	MOVL	$_rt0_386_windows_lib_go(SB), 0x00(SP)
    25  	MOVL	$0, 0x04(SP)
    26  
    27  	 // Top two items on the stack are passed to _cgo_sys_thread_create
    28  	 // as parameters. This is the calling convention on 32-bit Windows.
    29  	CALL	AX
    30  
    31  	MOVL	0x08(SP), BP
    32  	MOVL	0x0C(SP), BX
    33  	MOVL	0x10(SP), AX
    34  	MOVL	0x14(SP), CX
    35  	MOVL	0x18(SP), DX
    36  	RET
    37  
    38  TEXT _rt0_386_windows_lib_go(SB),NOSPLIT,$0
    39  	PUSHL	$0
    40  	PUSHL	$0
    41  	JMP	runtime·rt0_go(SB)
    42  
    43  TEXT _main(SB),NOSPLIT,$0
    44  	// Remove the return address from the stack.
    45  	// rt0_go doesn't expect it to be there.
    46  	ADDL	$4, SP
    47  	JMP	runtime·rt0_go(SB)
    48  

View as plain text