Commit ca4ea81d authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: save callee-saved regs in darwin-amd64 library init

We're only getting away with it today by luck.

Change-Id: I24d1cceee4d20c5181ca64fceda152e875f6ad81
Reviewed-on: https://go-review.googlesource.com/18440
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent 84a95be9
......@@ -12,7 +12,14 @@ TEXT _rt0_amd64_darwin(SB),NOSPLIT,$-8
// When linking with -shared, this symbol is called when the shared library
// is loaded.
TEXT _rt0_amd64_darwin_lib(SB),NOSPLIT,$40
TEXT _rt0_amd64_darwin_lib(SB),NOSPLIT,$0x48
MOVQ BX, 0x18(SP)
MOVQ BP, 0x20(SP)
MOVQ R12, 0x28(SP)
MOVQ R13, 0x30(SP)
MOVQ R14, 0x38(SP)
MOVQ R15, 0x40(SP)
MOVQ DI, _rt0_amd64_darwin_lib_argc<>(SB)
MOVQ SI, _rt0_amd64_darwin_lib_argv<>(SB)
......@@ -23,7 +30,8 @@ TEXT _rt0_amd64_darwin_lib(SB),NOSPLIT,$40
MOVQ $_rt0_amd64_darwin_lib_go(SB), DI
MOVQ $0, SI
CALL AX
RET
JMP restore
nocgo:
MOVQ $8388608, 0(SP) // stacksize
MOVQ $_rt0_amd64_darwin_lib_go(SB), AX
......@@ -31,6 +39,14 @@ nocgo:
MOVQ $0, 16(SP) // fnarg
MOVQ $runtime·newosproc0(SB), AX
CALL AX
restore:
MOVQ 0x18(SP), BX
MOVQ 0x20(SP), BP
MOVQ 0x28(SP), R12
MOVQ 0x30(SP), R13
MOVQ 0x38(SP), R14
MOVQ 0x40(SP), R15
RET
TEXT _rt0_amd64_darwin_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