From dd522d63b63033b7c38ca175a0a9e4b50ef9d82b Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 14 Sep 2018 17:36:09 +1000 Subject: [PATCH] py/asmx64: Fix bug in assembler when creating disp with r13 and 0 offset --- py/asmx64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/asmx64.c b/py/asmx64.c index 271c9f0fb8..fdf9ceeff5 100644 --- a/py/asmx64.c +++ b/py/asmx64.c @@ -192,7 +192,7 @@ STATIC void asm_x64_write_r64_disp(asm_x64_t *as, int r64, int disp_r64, int dis return; } - if (disp_offset == 0 && disp_r64 != ASM_X64_REG_RBP) { + if (disp_offset == 0 && disp_r64 != ASM_X64_REG_RBP && disp_r64 != ASM_X64_REG_R13) { asm_x64_write_byte_1(as, MODRM_R64(r64) | MODRM_RM_DISP0 | MODRM_RM_R64(disp_r64)); } else if (SIGNED_FIT8(disp_offset)) { asm_x64_write_byte_2(as, MODRM_R64(r64) | MODRM_RM_DISP8 | MODRM_RM_R64(disp_r64), IMM32_L0(disp_offset));