aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_s390x.s
diff options
context:
space:
mode:
authorMichael Munday <munday@ca.ibm.com>2016-11-23 14:54:12 -0500
committerMichael Munday <munday@ca.ibm.com>2016-11-23 22:06:06 +0000
commit06fcc32d1460dce6436e675a978eb269d4a5db26 (patch)
treef6fed159cb9c08349e134b93eaed67e1b05930ac /src/runtime/asm_s390x.s
parentc2bb52b8304a814b8e2b447953c3341ac31bbee8 (diff)
downloadgo-06fcc32d1460dce6436e675a978eb269d4a5db26.tar.gz
go-06fcc32d1460dce6436e675a978eb269d4a5db26.zip
runtime/cgo: save correct floating point registers on s390x
When transitioning from C code to Go code we must respect the C calling convention. On s390x this means that r6-r13, r15 and f8-f15 must be saved and restored by functions that use them. On s390x we were saving the wrong set of floating point registers (f0, f2, f4 and f6) rather than f8-f15 which means that Go code could clobber registers that C code expects to be restored. This CL modifies the crosscall functions on s390x to save/restore the correct floating point registers. Fixes #18035. Change-Id: I5cc6f552c893a4e677669c8891521bf735492e97 Reviewed-on: https://go-review.googlesource.com/33571 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/asm_s390x.s')
-rw-r--r--src/runtime/asm_s390x.s14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s
index 026c18c59c..c2212a5f21 100644
--- a/src/runtime/asm_s390x.s
+++ b/src/runtime/asm_s390x.s
@@ -1305,13 +1305,9 @@ found:
// However, since this function is only called once per loaded module
// performance is unimportant.
TEXT runtime·addmoduledata(SB),NOSPLIT|NOFRAME,$0-0
- // Save R6-R15, F0, F2, F4 and F6 in the
- // register save area of the calling function
+ // Save R6-R15 in the register save area of the calling function.
+ // Don't bother saving F8-F15 as we aren't doing any calls.
STMG R6, R15, 48(R15)
- FMOVD F0, 128(R15)
- FMOVD F2, 136(R15)
- FMOVD F4, 144(R15)
- FMOVD F6, 152(R15)
// append the argument (passed in R2, as per the ELF ABI) to the
// moduledata linked list.
@@ -1319,12 +1315,8 @@ TEXT runtime·addmoduledata(SB),NOSPLIT|NOFRAME,$0-0
MOVD R2, moduledata_next(R1)
MOVD R2, runtime·lastmoduledatap(SB)
- // Restore R6-R15, F0, F2, F4 and F6
+ // Restore R6-R15.
LMG 48(R15), R6, R15
- FMOVD F0, 128(R15)
- FMOVD F2, 136(R15)
- FMOVD F4, 144(R15)
- FMOVD F6, 152(R15)
RET
TEXT ·checkASM(SB),NOSPLIT,$0-1