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/asmx64.c | |
| 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/asmx64.c')
| -rw-r--r-- | py/asmx64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/asmx64.c b/py/asmx64.c index 9cd2fc64c..3609f49d3 100644 --- a/py/asmx64.c +++ b/py/asmx64.c @@ -623,7 +623,7 @@ void asm_x64_call_i1(asm_x64_t *as, void* func, int i1) { void asm_x64_call_ind(asm_x64_t *as, size_t fun_id, int temp_r64) { assert(temp_r64 < 8); - asm_x64_mov_mem64_to_r64(as, ASM_X64_REG_RBP, fun_id * WORD_SIZE, temp_r64); + asm_x64_mov_mem64_to_r64(as, ASM_X64_REG_FUN_TABLE, fun_id * WORD_SIZE, temp_r64); asm_x64_write_byte_2(as, OPCODE_CALL_RM32, MODRM_R64(2) | MODRM_RM_REG | MODRM_RM_R64(temp_r64)); } |
