diff options
author | Mike Pall <mike> | 2011-03-29 02:18:36 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-03-29 02:18:36 +0200 |
commit | 98e3c8a8ff03a9919cd4c21ce5a3d077821b28c2 (patch) | |
tree | c72b6dd6c1e2be9d14cc5d0a8effbf6996ecb461 | |
parent | 4c9a10f3ad9804e8d8ae4d14bf59c0ef4649440e (diff) | |
download | luajit-98e3c8a8ff03a9919cd4c21ce5a3d077821b28c2.tar.gz luajit-98e3c8a8ff03a9919cd4c21ce5a3d077821b28c2.tar.bz2 luajit-98e3c8a8ff03a9919cd4c21ce5a3d077821b28c2.zip |
ARM: Add register assignments, type definitions and stack layout.
-rw-r--r-- | src/buildvm_arm.dasc | 64 | ||||
-rw-r--r-- | src/lj_frame.h | 13 |
2 files changed, 70 insertions, 7 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc index c52cfc6c..9d2efa67 100644 --- a/src/buildvm_arm.dasc +++ b/src/buildvm_arm.dasc | |||
@@ -15,6 +15,70 @@ | |||
15 | | | 15 | | |
16 | |//----------------------------------------------------------------------- | 16 | |//----------------------------------------------------------------------- |
17 | | | 17 | | |
18 | |// Fixed register assignments for the interpreter. | ||
19 | | | ||
20 | |// The following must be C callee-save (but BASE is often refetched). | ||
21 | |.define BASE, r4 // Base of current Lua stack frame. | ||
22 | |.define KBASE, r5 // Constants of current Lua function. | ||
23 | |.define PC, r6 // Next PC. | ||
24 | |.define DISPATCH, r7 // Opcode dispatch table. | ||
25 | |.define LREG, r8 // Register holding lua_State (also in SAVE_L). | ||
26 | |.define MASKR8, r9 // 255*8 constant for fast bytecode decoding. | ||
27 | | | ||
28 | |// The following temporaries are not saved across C calls, except for RA/RC. | ||
29 | |.define RA, r10 // Callee-save. | ||
30 | |.define RC, r11 // Callee-save. | ||
31 | |.define RB, r12 | ||
32 | |.define OP, r12 // Overlaps RB, must not be lr. | ||
33 | |.define INS, lr | ||
34 | | | ||
35 | |// Calling conventions. Also used as temporaries. | ||
36 | |.define CARG1, r0 | ||
37 | |.define CARG2, r1 | ||
38 | |.define CARG3, r2 | ||
39 | |.define CARG4, r3 | ||
40 | |.define CARG12, r0 // For 1st soft-fp double. | ||
41 | |.define CARG34, r2 // For 2nd soft-fp double. | ||
42 | | | ||
43 | |.define CRET1, r0 | ||
44 | |.define CRET2, r1 | ||
45 | | | ||
46 | |// Stack layout while in interpreter. Must match with lj_frame.h. | ||
47 | |.define CFRAME_SPACE, #28 | ||
48 | |.define SAVE_ERRF, [sp, #24] | ||
49 | |.define SAVE_NRES, [sp, #20] | ||
50 | |.define SAVE_CFRAME, [sp, #16] | ||
51 | |.define SAVE_L, [sp, #12] | ||
52 | |.define SAVE_PC, [sp, #8] | ||
53 | |.define SAVE_MULTRES, [sp, #4] | ||
54 | |.define ARG5, [sp] | ||
55 | | | ||
56 | |.macro saveregs | ||
57 | | push {r4, r5, r6, r7, r8, r9, r10, r11, lr} | ||
58 | | sub sp, sp, CFRAME_SPACE | ||
59 | |.endmacro | ||
60 | |.macro restoreregs_ret | ||
61 | | add sp, sp, CFRAME_SPACE | ||
62 | | pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} | ||
63 | |.endmacro | ||
64 | | | ||
65 | |// Type definitions. Some of these are only used for documentation. | ||
66 | |.type L, lua_State, LREG | ||
67 | |.type GL, global_State | ||
68 | |.type TVALUE, TValue | ||
69 | |.type GCOBJ, GCobj | ||
70 | |.type STR, GCstr | ||
71 | |.type TAB, GCtab | ||
72 | |.type LFUNC, GCfuncL | ||
73 | |.type CFUNC, GCfuncC | ||
74 | |.type PROTO, GCproto | ||
75 | |.type UPVAL, GCupval | ||
76 | |.type NODE, Node | ||
77 | |.type NARGS8, int | ||
78 | |.type TRACE, GCtrace | ||
79 | | | ||
80 | |//----------------------------------------------------------------------- | ||
81 | | | ||
18 | |// Trap for not-yet-implemented parts. | 82 | |// Trap for not-yet-implemented parts. |
19 | |.macro NYI; ud; .endmacro | 83 | |.macro NYI; ud; .endmacro |
20 | | | 84 | | |
diff --git a/src/lj_frame.h b/src/lj_frame.h index 21074724..c123353e 100644 --- a/src/lj_frame.h +++ b/src/lj_frame.h | |||
@@ -91,13 +91,12 @@ enum { | |||
91 | #define CFRAME_SHIFT_MULTRES 0 | 91 | #define CFRAME_SHIFT_MULTRES 0 |
92 | #endif | 92 | #endif |
93 | #elif LJ_TARGET_ARM | 93 | #elif LJ_TARGET_ARM |
94 | /* NYI: Dummy definitions for now. */ | 94 | #define CFRAME_OFS_ERRF 24 |
95 | #define CFRAME_OFS_ERRF 28 | 95 | #define CFRAME_OFS_NRES 20 |
96 | #define CFRAME_OFS_NRES 24 | 96 | #define CFRAME_OFS_PREV 16 |
97 | #define CFRAME_OFS_PREV 20 | 97 | #define CFRAME_OFS_L 12 |
98 | #define CFRAME_OFS_L 16 | 98 | #define CFRAME_OFS_PC 8 |
99 | #define CFRAME_OFS_PC 12 | 99 | #define CFRAME_OFS_MULTRES 4 |
100 | #define CFRAME_OFS_MULTRES 8 | ||
101 | #define CFRAME_SIZE 64 | 100 | #define CFRAME_SIZE 64 |
102 | #define CFRAME_SIZE_JIT CFRAME_SIZE | 101 | #define CFRAME_SIZE_JIT CFRAME_SIZE |
103 | #define CFRAME_SHIFT_MULTRES 3 | 102 | #define CFRAME_SHIFT_MULTRES 3 |