summaryrefslogtreecommitdiff
path: root/py/asmxtensa.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-10-13 14:53:35 +1100
committerDamien George <damien.p.george@gmail.com>2018-10-13 15:16:33 +1100
commit006671056da6627073f041b4d451cab9db031ff0 (patch)
treeed1385d037fab8ed3b32869f0a9bb9ebd88b79f6 /py/asmxtensa.c
parent355eb8eafb1a0b0e096cd452d1107ab45bbf72c4 (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/asmxtensa.c')
-rw-r--r--py/asmxtensa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/asmxtensa.c b/py/asmxtensa.c
index 6a3a874f1..8da56ffe3 100644
--- a/py/asmxtensa.c
+++ b/py/asmxtensa.c
@@ -213,9 +213,9 @@ void asm_xtensa_mov_reg_pcrel(asm_xtensa_t *as, uint reg_dest, uint label) {
void asm_xtensa_call_ind(asm_xtensa_t *as, uint idx) {
if (idx < 16) {
- asm_xtensa_op_l32i_n(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_A15, idx);
+ asm_xtensa_op_l32i_n(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_FUN_TABLE, idx);
} else {
- asm_xtensa_op_l32i(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_A15, idx);
+ asm_xtensa_op_l32i(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_FUN_TABLE, idx);
}
asm_xtensa_op_callx0(as, ASM_XTENSA_REG_A0);
}