...
Run Format

Text file src/runtime/rt0_windows_386.s

Documentation: 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_windows(SB),NOSPLIT,$12
     8		MOVL	12(SP), AX
     9		LEAL	16(SP), BX
    10		MOVL	AX, 4(SP)
    11		MOVL	BX, 8(SP)
    12		MOVL	$-1, 0(SP) // return PC for main
    13		JMP	_main(SB)
    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_386_windows_lib(SB),NOSPLIT,$0x1C
    21		MOVL	BP, 0x08(SP)
    22		MOVL	BX, 0x0C(SP)
    23		MOVL	AX, 0x10(SP)
    24		MOVL  CX, 0x14(SP)
    25		MOVL  DX, 0x18(SP)
    26	
    27		// Create a new thread to do the runtime initialization and return.
    28		MOVL	_cgo_sys_thread_create(SB), AX
    29		MOVL	$_rt0_386_windows_lib_go(SB), 0x00(SP)
    30		MOVL	$0, 0x04(SP)
    31	
    32		 // Top two items on the stack are passed to _cgo_sys_thread_create
    33		 // as parameters. This is the calling convention on 32-bit Windows.
    34		CALL	AX
    35	
    36		MOVL	0x08(SP), BP
    37		MOVL	0x0C(SP), BX
    38		MOVL	0x10(SP), AX
    39		MOVL	0x14(SP), CX
    40		MOVL	0x18(SP), DX
    41		RET
    42	
    43	TEXT _rt0_386_windows_lib_go(SB),NOSPLIT,$0
    44		MOVL  $0, DI
    45		MOVL	$0, SI
    46		MOVL	$runtime·rt0_go(SB), AX
    47		JMP	AX
    48	
    49	TEXT _main(SB),NOSPLIT,$0
    50		JMP	runtime·rt0_go(SB)

View as plain text