2008-06-05 17:54:34 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-09-04 21:05:18 -06:00
|
|
|
#include "textflag.h"
|
2013-08-07 13:20:05 -06:00
|
|
|
|
|
|
|
TEXT _rt0_amd64_linux(SB),NOSPLIT,$-8
|
2013-03-06 13:03:04 -07:00
|
|
|
LEAQ 8(SP), SI // argv
|
|
|
|
MOVQ 0(SP), DI // argc
|
|
|
|
MOVQ $main(SB), AX
|
|
|
|
JMP AX
|
|
|
|
|
2015-04-03 10:48:51 -06:00
|
|
|
// When building with -buildmode=c-shared, this symbol is called when the shared
|
|
|
|
// library is loaded.
|
2015-04-17 18:27:07 -06:00
|
|
|
TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0x40
|
|
|
|
MOVQ BX, 0x10(SP)
|
|
|
|
MOVQ BP, 0x18(SP)
|
|
|
|
MOVQ R12, 0x20(SP)
|
|
|
|
MOVQ R13, 0x28(SP)
|
|
|
|
MOVQ R14, 0x30(SP)
|
|
|
|
MOVQ R15, 0x38(SP)
|
2015-04-20 11:32:39 -06:00
|
|
|
|
2015-03-25 18:50:35 -06:00
|
|
|
MOVQ DI, _rt0_amd64_linux_lib_argc<>(SB)
|
|
|
|
MOVQ SI, _rt0_amd64_linux_lib_argv<>(SB)
|
|
|
|
|
|
|
|
// Create a new thread to do the runtime initialization and return.
|
|
|
|
MOVQ _cgo_sys_thread_create(SB), AX
|
|
|
|
TESTQ AX, AX
|
|
|
|
JZ nocgo
|
|
|
|
MOVQ $_rt0_amd64_linux_lib_go(SB), DI
|
|
|
|
MOVQ $0, SI
|
|
|
|
CALL AX
|
2015-04-20 11:32:39 -06:00
|
|
|
JMP restore
|
|
|
|
|
2015-03-25 18:50:35 -06:00
|
|
|
nocgo:
|
|
|
|
MOVQ $8388608, 0(SP) // stacksize
|
|
|
|
MOVQ $_rt0_amd64_linux_lib_go(SB), AX
|
|
|
|
MOVQ AX, 8(SP) // fn
|
|
|
|
MOVQ $runtime·newosproc0(SB), AX
|
|
|
|
CALL AX
|
2015-04-20 11:32:39 -06:00
|
|
|
|
|
|
|
restore:
|
2015-04-17 18:27:07 -06:00
|
|
|
MOVQ 0x10(SP), BX
|
|
|
|
MOVQ 0x18(SP), BP
|
|
|
|
MOVQ 0x20(SP), R12
|
|
|
|
MOVQ 0x28(SP), R13
|
|
|
|
MOVQ 0x30(SP), R14
|
|
|
|
MOVQ 0x38(SP), R15
|
2015-03-17 10:47:01 -06:00
|
|
|
RET
|
|
|
|
|
2015-03-25 18:50:35 -06:00
|
|
|
TEXT _rt0_amd64_linux_lib_go(SB),NOSPLIT,$0
|
|
|
|
MOVQ _rt0_amd64_linux_lib_argc<>(SB), DI
|
|
|
|
MOVQ _rt0_amd64_linux_lib_argv<>(SB), SI
|
|
|
|
MOVQ $runtime·rt0_go(SB), AX
|
|
|
|
JMP AX
|
|
|
|
|
|
|
|
DATA _rt0_amd64_linux_lib_argc<>(SB)/8, $0
|
|
|
|
GLOBL _rt0_amd64_linux_lib_argc<>(SB),NOPTR, $8
|
|
|
|
DATA _rt0_amd64_linux_lib_argv<>(SB)/8, $0
|
|
|
|
GLOBL _rt0_amd64_linux_lib_argv<>(SB),NOPTR, $8
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT main(SB),NOSPLIT,$-8
|
2014-09-03 09:11:16 -06:00
|
|
|
MOVQ $runtime·rt0_go(SB), AX
|
2008-06-30 12:50:36 -06:00
|
|
|
JMP AX
|