From 5a69b4638a5eb960e9cd6f95611d5d5b6fdcd21d Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Tue, 22 Nov 2016 13:58:10 -0500 Subject: [PATCH] Fixup the save/restore register macros. I believe these macros obey the C calling convention, so we need to allocate our stack frame and save all callee-save registers. We can tune it later if it turns out we don't need all the registers. --- src/vm_s390x.dasc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/vm_s390x.dasc b/src/vm_s390x.dasc index 44c056d3..49ea335a 100644 --- a/src/vm_s390x.dasc +++ b/src/vm_s390x.dasc @@ -80,16 +80,23 @@ |// Callee save area (allocated by interpreter). |.define CALLEESAVE 000(SP) // <- SP in interpreter. | -|.macro savereg arg1 arg2 arg3 -| STG arg1; // Store 64bit content -| STG arg2; // Store 64bit content -| STG arg3; // Store 64bit content +|.macro saveregs +| lay SP, -CFRAME_SPACE(SP) // Allocate stack frame. +| stmg r6, r15, SAVE_GPRS // Technically we restore r15 regardless. +| std f0, SAVE_FPR0 +| std f2, SAVE_FPR2 +| std f4, SAVE_FPR4 +| std f6, SAVE_FPR6 |.endmacro | -|.macro restreg arg1 arg2 arg3 -| LG arg1; // Load 64 bit content -| LG arg2; // Load 64 bit content -| LG arg3; // Load 64 bit content +|.macro restoreregs +| la SP, CFRAME_SPACE(SP) // De-allocate stack frame. +| lmg r6, r15, SAVE_GPRS // Technically we restore r15 regardless. +| ld f0, SAVE_FPR0 +| ld f2, SAVE_FPR2 +| ld f4, SAVE_FPR4 +| ld f6, SAVE_FPR6 +|// br r14 to return? |.endmacro | |// Type definitions. Some of these are only used for documentation.