ARM: Add register assignments, type definitions and stack layout.

This commit is contained in:
Mike Pall 2011-03-29 02:18:36 +02:00
parent 4c9a10f3ad
commit 98e3c8a8ff
2 changed files with 70 additions and 7 deletions

View File

@ -15,6 +15,70 @@
| |
|//----------------------------------------------------------------------- |//-----------------------------------------------------------------------
| |
|// Fixed register assignments for the interpreter.
|
|// The following must be C callee-save (but BASE is often refetched).
|.define BASE, r4 // Base of current Lua stack frame.
|.define KBASE, r5 // Constants of current Lua function.
|.define PC, r6 // Next PC.
|.define DISPATCH, r7 // Opcode dispatch table.
|.define LREG, r8 // Register holding lua_State (also in SAVE_L).
|.define MASKR8, r9 // 255*8 constant for fast bytecode decoding.
|
|// The following temporaries are not saved across C calls, except for RA/RC.
|.define RA, r10 // Callee-save.
|.define RC, r11 // Callee-save.
|.define RB, r12
|.define OP, r12 // Overlaps RB, must not be lr.
|.define INS, lr
|
|// Calling conventions. Also used as temporaries.
|.define CARG1, r0
|.define CARG2, r1
|.define CARG3, r2
|.define CARG4, r3
|.define CARG12, r0 // For 1st soft-fp double.
|.define CARG34, r2 // For 2nd soft-fp double.
|
|.define CRET1, r0
|.define CRET2, r1
|
|// Stack layout while in interpreter. Must match with lj_frame.h.
|.define CFRAME_SPACE, #28
|.define SAVE_ERRF, [sp, #24]
|.define SAVE_NRES, [sp, #20]
|.define SAVE_CFRAME, [sp, #16]
|.define SAVE_L, [sp, #12]
|.define SAVE_PC, [sp, #8]
|.define SAVE_MULTRES, [sp, #4]
|.define ARG5, [sp]
|
|.macro saveregs
| push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
| sub sp, sp, CFRAME_SPACE
|.endmacro
|.macro restoreregs_ret
| add sp, sp, CFRAME_SPACE
| pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
|.endmacro
|
|// Type definitions. Some of these are only used for documentation.
|.type L, lua_State, LREG
|.type GL, global_State
|.type TVALUE, TValue
|.type GCOBJ, GCobj
|.type STR, GCstr
|.type TAB, GCtab
|.type LFUNC, GCfuncL
|.type CFUNC, GCfuncC
|.type PROTO, GCproto
|.type UPVAL, GCupval
|.type NODE, Node
|.type NARGS8, int
|.type TRACE, GCtrace
|
|//-----------------------------------------------------------------------
|
|// Trap for not-yet-implemented parts. |// Trap for not-yet-implemented parts.
|.macro NYI; ud; .endmacro |.macro NYI; ud; .endmacro
| |

View File

@ -91,13 +91,12 @@ enum {
#define CFRAME_SHIFT_MULTRES 0 #define CFRAME_SHIFT_MULTRES 0
#endif #endif
#elif LJ_TARGET_ARM #elif LJ_TARGET_ARM
/* NYI: Dummy definitions for now. */ #define CFRAME_OFS_ERRF 24
#define CFRAME_OFS_ERRF 28 #define CFRAME_OFS_NRES 20
#define CFRAME_OFS_NRES 24 #define CFRAME_OFS_PREV 16
#define CFRAME_OFS_PREV 20 #define CFRAME_OFS_L 12
#define CFRAME_OFS_L 16 #define CFRAME_OFS_PC 8
#define CFRAME_OFS_PC 12 #define CFRAME_OFS_MULTRES 4
#define CFRAME_OFS_MULTRES 8
#define CFRAME_SIZE 64 #define CFRAME_SIZE 64
#define CFRAME_SIZE_JIT CFRAME_SIZE #define CFRAME_SIZE_JIT CFRAME_SIZE
#define CFRAME_SHIFT_MULTRES 3 #define CFRAME_SHIFT_MULTRES 3