Commit a7f7a9cc authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

runtime, runtime/cgo: save callee-saved FP registers on arm64

For #14876.

Change-Id: I0992859264cbaf9c9b691fad53345bbb01b4cf3b
Reviewed-on: https://go-review.googlesource.com/21085Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 71916437
......@@ -16,7 +16,7 @@ TEXT crosscall2(SB),NOSPLIT,$-8
* first arg.
* TODO(minux): use LDP/STP here if it matters.
*/
SUB $128, RSP
SUB $(8*24), RSP
MOVD R1, (8*1)(RSP)
MOVD R2, (8*2)(RSP)
MOVD R19, (8*3)(RSP)
......@@ -31,6 +31,14 @@ TEXT crosscall2(SB),NOSPLIT,$-8
MOVD g, (8*12)(RSP)
MOVD R29, (8*13)(RSP)
MOVD R30, (8*14)(RSP)
FMOVD F8, (8*15)(RSP)
FMOVD F9, (8*16)(RSP)
FMOVD F10, (8*17)(RSP)
FMOVD F11, (8*18)(RSP)
FMOVD F12, (8*19)(RSP)
FMOVD F13, (8*20)(RSP)
FMOVD F14, (8*21)(RSP)
FMOVD F15, (8*22)(RSP)
MOVD R0, R19
......@@ -53,5 +61,13 @@ TEXT crosscall2(SB),NOSPLIT,$-8
MOVD (8*12)(RSP), g
MOVD (8*13)(RSP), R29
MOVD (8*14)(RSP), R30
ADD $128, RSP
FMOVD (8*15)(RSP), F8
FMOVD (8*16)(RSP), F9
FMOVD (8*17)(RSP), F10
FMOVD (8*18)(RSP), F11
FMOVD (8*19)(RSP), F12
FMOVD (8*20)(RSP), F13
FMOVD (8*21)(RSP), F14
FMOVD (8*22)(RSP), F15
ADD $(8*24), RSP
RET
......@@ -16,7 +16,7 @@ TEXT _rt0_arm64_darwin(SB),NOSPLIT,$-8
//
// Note that all currently shipping darwin/arm64 platforms require
// cgo and do not support c-shared.
TEXT _rt0_arm64_darwin_lib(SB),NOSPLIT,$88
TEXT _rt0_arm64_darwin_lib(SB),NOSPLIT,$168
// Preserve callee-save registers.
MOVD R19, 24(RSP)
MOVD R20, 32(RSP)
......@@ -27,6 +27,14 @@ TEXT _rt0_arm64_darwin_lib(SB),NOSPLIT,$88
MOVD R25, 72(RSP)
MOVD R26, 80(RSP)
MOVD R27, 88(RSP)
FMOVD F8, 96(RSP)
FMOVD F9, 104(RSP)
FMOVD F10, 112(RSP)
FMOVD F11, 120(RSP)
FMOVD F12, 128(RSP)
FMOVD F13, 136(RSP)
FMOVD F14, 144(RSP)
FMOVD F15, 152(RSP)
MOVD R0, _rt0_arm64_darwin_lib_argc<>(SB)
MOVD R1, _rt0_arm64_darwin_lib_argv<>(SB)
......@@ -51,6 +59,14 @@ TEXT _rt0_arm64_darwin_lib(SB),NOSPLIT,$88
MOVD 72(RSP), R25
MOVD 80(RSP), R26
MOVD 88(RSP), R27
FMOVD 96(RSP), F8
FMOVD 104(RSP), F9
FMOVD 112(RSP), F10
FMOVD 120(RSP), F11
FMOVD 128(RSP), F12
FMOVD 136(RSP), F13
FMOVD 144(RSP), F14
FMOVD 152(RSP), F15
RET
TEXT _rt0_arm64_darwin_lib_go(SB),NOSPLIT,$0
......
......@@ -11,7 +11,7 @@ TEXT _rt0_arm64_linux(SB),NOSPLIT,$-8
// When building with -buildmode=c-shared, this symbol is called when the shared
// library is loaded.
TEXT _rt0_arm64_linux_lib(SB),NOSPLIT,$88
TEXT _rt0_arm64_linux_lib(SB),NOSPLIT,$168
// Preserve callee-save registers.
MOVD R19, 24(RSP)
MOVD R20, 32(RSP)
......@@ -22,6 +22,14 @@ TEXT _rt0_arm64_linux_lib(SB),NOSPLIT,$88
MOVD R25, 72(RSP)
MOVD R26, 80(RSP)
MOVD R27, 88(RSP)
FMOVD F8, 96(RSP)
FMOVD F9, 104(RSP)
FMOVD F10, 112(RSP)
FMOVD F11, 120(RSP)
FMOVD F12, 128(RSP)
FMOVD F13, 136(RSP)
FMOVD F14, 144(RSP)
FMOVD F15, 152(RSP)
MOVD R0, _rt0_arm64_linux_lib_argc<>(SB)
MOVD R1, _rt0_arm64_linux_lib_argv<>(SB)
......@@ -58,6 +66,14 @@ restore:
MOVD 72(RSP), R25
MOVD 80(RSP), R26
MOVD 88(RSP), R27
FMOVD 96(RSP), F8
FMOVD 104(RSP), F9
FMOVD 112(RSP), F10
FMOVD 120(RSP), F11
FMOVD 128(RSP), F12
FMOVD 136(RSP), F13
FMOVD 144(RSP), F14
FMOVD 152(RSP), F15
RET
TEXT _rt0_arm64_linux_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