mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
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.
This commit is contained in:
parent
d505a0e0ba
commit
5a69b4638a
@ -80,16 +80,23 @@
|
|||||||
|// Callee save area (allocated by interpreter).
|
|// Callee save area (allocated by interpreter).
|
||||||
|.define CALLEESAVE 000(SP) // <- SP in interpreter.
|
|.define CALLEESAVE 000(SP) // <- SP in interpreter.
|
||||||
|
|
|
|
||||||
|.macro savereg arg1 arg2 arg3
|
|.macro saveregs
|
||||||
| STG arg1; // Store 64bit content
|
| lay SP, -CFRAME_SPACE(SP) // Allocate stack frame.
|
||||||
| STG arg2; // Store 64bit content
|
| stmg r6, r15, SAVE_GPRS // Technically we restore r15 regardless.
|
||||||
| STG arg3; // Store 64bit content
|
| std f0, SAVE_FPR0
|
||||||
|
| std f2, SAVE_FPR2
|
||||||
|
| std f4, SAVE_FPR4
|
||||||
|
| std f6, SAVE_FPR6
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|
|
|
|
||||||
|.macro restreg arg1 arg2 arg3
|
|.macro restoreregs
|
||||||
| LG arg1; // Load 64 bit content
|
| la SP, CFRAME_SPACE(SP) // De-allocate stack frame.
|
||||||
| LG arg2; // Load 64 bit content
|
| lmg r6, r15, SAVE_GPRS // Technically we restore r15 regardless.
|
||||||
| LG arg3; // Load 64 bit content
|
| ld f0, SAVE_FPR0
|
||||||
|
| ld f2, SAVE_FPR2
|
||||||
|
| ld f4, SAVE_FPR4
|
||||||
|
| ld f6, SAVE_FPR6
|
||||||
|
|// br r14 to return?
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|
|
|
|
||||||
|// Type definitions. Some of these are only used for documentation.
|
|// Type definitions. Some of these are only used for documentation.
|
||||||
|
Loading…
Reference in New Issue
Block a user