From 31b27e64094641e55a5d73a8bba787ea63c880f1 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sat, 11 Apr 2020 13:48:43 -0700 Subject: [PATCH] Fix alignment when adding a jump value to the cache --- src/cpu/core_dyn_x86/risc_x64.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cpu/core_dyn_x86/risc_x64.h b/src/cpu/core_dyn_x86/risc_x64.h index 1bdc257d..fd5ac830 100644 --- a/src/cpu/core_dyn_x86/risc_x64.h +++ b/src/cpu/core_dyn_x86/risc_x64.h @@ -1155,11 +1155,12 @@ static void gen_fill_branch_long(uint8_t *data, uint8_t *from = cache.pos) host_writed(data, from - data - sizeof(uint32_t)); } -static Bit8u * gen_create_jump(Bit8u * to=0) { +static uint8_t *gen_create_jump(uint8_t *to = 0) +{ /* First free all registers */ cache_addb(0xe9); - cache_addd((Bit32u)(to-(cache.pos+4))); - return (cache.pos-4); + cache_addd(to - cache.pos - sizeof(uint32_t)); + return cache.pos - sizeof(uint32_t); } #if 0