diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-10-13 14:53:35 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-10-13 15:16:33 +1100 |
| commit | 006671056da6627073f041b4d451cab9db031ff0 (patch) | |
| tree | ed1385d037fab8ed3b32869f0a9bb9ebd88b79f6 /py/asmthumb.h | |
| parent | 355eb8eafb1a0b0e096cd452d1107ab45bbf72c4 (diff) | |
py/emitnative: Load native fun table ptr from const table for all archs.
All architectures now have a dedicated register to hold the pointer to the
native function table mp_fun_table, and so they all need to load this
register at the start of the native function. This commit makes the
loading of this register uniform across architectures by passing the
pointer in the constant table for the native function, and then loading the
register from the constant table. Doing it this way means that the pointer
is not stored in the assembly code, helping to make the code more portable.
Diffstat (limited to 'py/asmthumb.h')
| -rw-r--r-- | py/asmthumb.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/asmthumb.h b/py/asmthumb.h index 83aec0287..0fd39120e 100644 --- a/py/asmthumb.h +++ b/py/asmthumb.h @@ -261,6 +261,9 @@ void asm_thumb_b_label(asm_thumb_t *as, uint label); // convenience: picks narro void asm_thumb_bcc_label(asm_thumb_t *as, int cc, uint label); // convenience: picks narrow or wide branch void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp); // convenience +// Holds a pointer to mp_fun_table +#define ASM_THUMB_REG_FUN_TABLE ASM_THUMB_REG_R7 + #if GENERIC_ASM_API // The following macros provide a (mostly) arch-independent API to @@ -284,6 +287,8 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp #define REG_LOCAL_3 ASM_THUMB_REG_R6 #define REG_LOCAL_NUM (3) +#define REG_FUN_TABLE ASM_THUMB_REG_FUN_TABLE + #define ASM_T asm_thumb_t #define ASM_END_PASS asm_thumb_end_pass #define ASM_ENTRY asm_thumb_entry |
