From 1ea78a87fa2491877791e897ef26a27937908768 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sat, 11 Apr 2020 13:49:53 -0700 Subject: [PATCH] Fix alignment when writing the jump value to memory --- src/cpu/core_dyn_x86/risc_x64.h | 4 ++-- src/cpu/core_dyn_x86/risc_x86.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpu/core_dyn_x86/risc_x64.h b/src/cpu/core_dyn_x86/risc_x64.h index fd5ac830..e5d1a3a4 100644 --- a/src/cpu/core_dyn_x86/risc_x64.h +++ b/src/cpu/core_dyn_x86/risc_x64.h @@ -1164,8 +1164,8 @@ static uint8_t *gen_create_jump(uint8_t *to = 0) } #if 0 -static void gen_fill_jump(Bit8u * data,Bit8u * to=cache.pos) { - *(Bit32u*)data=(Bit32u)(to-data-4); +static void gen_fill_jump(uint8_t *data, uint8_t *to = cache.pos) { + host_writed(data, to - data - sizeof(uint32_t)); } #endif diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index 713b102e..537af05c 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -994,8 +994,8 @@ static Bit8u * gen_create_jump(Bit8u * to=0) { return (cache.pos-4); } -static void gen_fill_jump(Bit8u * data,Bit8u * to=cache.pos) { - *(Bit32u*)data=(to-data-4); +static void gen_fill_jump(uint8_t *data, uint8_t *to = cache.pos) { + host_writed(data, to - data - sizeof(uint32_t)); }