Commit bec67e11 authored by Jingnan Si's avatar Jingnan Si Committed by Ian Lance Taylor

runtime: follow Windows calling convention for _cgo_sys_thread_create

Windows requires space for four pointers on the stack.

Change-Id: I9f7ba3e09b6c660f86d15139bb51954fffc8ccb1
GitHub-Last-Rev: 76d21bcc2b07edfde6daa45000093d070e2337bc
GitHub-Pull-Request: golang/go#30944
Reviewed-on: https://go-review.googlesource.com/c/go/+/168351Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 81c7beb0
......@@ -14,12 +14,14 @@ TEXT _rt0_amd64_windows(SB),NOSPLIT,$-8
// library is loaded. For static libraries it is called when the
// final executable starts, during the C runtime initialization
// phase.
TEXT _rt0_amd64_windows_lib(SB),NOSPLIT,$0x28
MOVQ BP, 0x00(SP)
MOVQ BX, 0x08(SP)
MOVQ AX, 0x10(SP)
MOVQ CX, 0x18(SP)
MOVQ DX, 0x20(SP)
// Leave space for four pointers on the stack as required
// by the Windows amd64 calling convention.
TEXT _rt0_amd64_windows_lib(SB),NOSPLIT,$0x48
MOVQ BP, 0x20(SP)
MOVQ BX, 0x28(SP)
MOVQ AX, 0x30(SP)
MOVQ CX, 0x38(SP)
MOVQ DX, 0x40(SP)
// Create a new thread to do the runtime initialization and return.
MOVQ _cgo_sys_thread_create(SB), AX
......@@ -27,11 +29,11 @@ TEXT _rt0_amd64_windows_lib(SB),NOSPLIT,$0x28
MOVQ $0, DX
CALL AX
MOVQ 0x00(SP), BP
MOVQ 0x08(SP), BX
MOVQ 0x10(SP), AX
MOVQ 0x18(SP), CX
MOVQ 0x20(SP), DX
MOVQ 0x20(SP), BP
MOVQ 0x28(SP), BX
MOVQ 0x30(SP), AX
MOVQ 0x38(SP), CX
MOVQ 0x40(SP), DX
RET
TEXT _rt0_amd64_windows_lib_go(SB),NOSPLIT,$0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment