From 32692cc50e2c16b7e6e5ec3841aeaad00a63ada6 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sat, 11 Apr 2020 13:37:11 -0700 Subject: [PATCH] Fix alignment when reading values from the write-map --- src/cpu/core_dyn_x86/cache.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/cpu/core_dyn_x86/cache.h b/src/cpu/core_dyn_x86/cache.h index 9dce4baf..3134da5a 100644 --- a/src/cpu/core_dyn_x86/cache.h +++ b/src/cpu/core_dyn_x86/cache.h @@ -137,8 +137,10 @@ public: addr&=4095; if (host_readw(hostmem+addr)==(Bit16u)val) return; host_writew(hostmem+addr,val); - if (!*(Bit16u*)&write_map[addr]) { - if (active_blocks) return; + const uint16_t is_mapped = host_readw(write_map + addr); + if (!is_mapped) { + if (active_blocks) + return; active_count--; if (!active_count) Release(); return; @@ -160,8 +162,10 @@ public: addr&=4095; if (host_readd(hostmem+addr)==(Bit32u)val) return; host_writed(hostmem+addr,val); - if (!*(Bit32u*)&write_map[addr]) { - if (active_blocks) return; + const uint32_t is_mapped = host_readd(write_map + addr); + if (!is_mapped) { + if (active_blocks) + return; active_count--; if (!active_count) Release(); return; @@ -211,7 +215,9 @@ public: } addr&=4095; if (host_readw(hostmem+addr)==(Bit16u)val) return false; - if (!*(Bit16u*)&write_map[addr]) { + + const uint16_t is_mapped = host_readw(write_map + addr); + if (!is_mapped) { if (!active_blocks) { active_count--; if (!active_count) Release(); @@ -240,7 +246,9 @@ public: } addr&=4095; if (host_readd(hostmem+addr)==(Bit32u)val) return false; - if (!*(Bit32u*)&write_map[addr]) { + + const uint32_t is_mapped = host_readd(write_map + addr); + if (!is_mapped) { if (!active_blocks) { active_count--; if (!active_count) Release();