diff --git a/src/cpu/core_dynrec/cache.h b/src/cpu/core_dynrec/cache.h index c543ed3f..52baff65 100644 --- a/src/cpu/core_dynrec/cache.h +++ b/src/cpu/core_dynrec/cache.h @@ -145,7 +145,7 @@ public: if (host_readb(hostmem+addr)==(Bit8u)val) return; host_writeb(hostmem+addr,val); // see if there's code where we are writing to - if (!*(Bit8u*)&write_map[addr]) { + if (!host_readb(&write_map[addr])) { if (active_blocks) return; // still some blocks in this page active_count--; if (!active_count) Release(); // delay page releasing until active_count is zero @@ -162,7 +162,7 @@ public: if (host_readw(hostmem+addr)==(Bit16u)val) return; host_writew(hostmem+addr,val); // see if there's code where we are writing to - if (!*(Bit16u*)&write_map[addr]) { + if (!host_readw(&write_map[addr])) { if (active_blocks) return; // still some blocks in this page active_count--; if (!active_count) Release(); // delay page releasing until active_count is zero @@ -171,7 +171,12 @@ public: invalidation_map=(Bit8u*)malloc(4096); memset(invalidation_map,0,4096); } +#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY) + host_writew(&invalidation_map[addr], + host_readw(&invalidation_map[addr])+0x101); +#else (*(Bit16u*)&invalidation_map[addr])+=0x101; +#endif InvalidateRange(addr,addr+1); } void writed(PhysPt addr,Bitu val){ @@ -179,7 +184,7 @@ public: if (host_readd(hostmem+addr)==(Bit32u)val) return; host_writed(hostmem+addr,val); // see if there's code where we are writing to - if (!*(Bit32u*)&write_map[addr]) { + if (!host_readd(&write_map[addr])) { if (active_blocks) return; // still some blocks in this page active_count--; if (!active_count) Release(); // delay page releasing until active_count is zero @@ -188,14 +193,19 @@ public: invalidation_map=(Bit8u*)malloc(4096); memset(invalidation_map,0,4096); } +#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY) + host_writed(&invalidation_map[addr], + host_readd(&invalidation_map[addr])+0x1010101); +#else (*(Bit32u*)&invalidation_map[addr])+=0x1010101; +#endif InvalidateRange(addr,addr+3); } bool writeb_checked(PhysPt addr,Bitu val) { addr&=4095; if (host_readb(hostmem+addr)==(Bit8u)val) return false; // see if there's code where we are writing to - if (!*(Bit8u*)&write_map[addr]) { + if (!host_readb(&write_map[addr])) { if (!active_blocks) { // no blocks left in this page, still delay the page releasing a bit active_count--; @@ -219,7 +229,7 @@ public: addr&=4095; if (host_readw(hostmem+addr)==(Bit16u)val) return false; // see if there's code where we are writing to - if (!*(Bit16u*)&write_map[addr]) { + if (!host_readw(&write_map[addr])) { if (!active_blocks) { // no blocks left in this page, still delay the page releasing a bit active_count--; @@ -230,7 +240,12 @@ public: invalidation_map=(Bit8u*)malloc(4096); memset(invalidation_map,0,4096); } +#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY) + host_writew(&invalidation_map[addr], + host_readw(&invalidation_map[addr])+0x101); +#else (*(Bit16u*)&invalidation_map[addr])+=0x101; +#endif if (InvalidateRange(addr,addr+1)) { cpu.exception.which=SMC_CURRENT_BLOCK; return true; @@ -243,7 +258,7 @@ public: addr&=4095; if (host_readd(hostmem+addr)==(Bit32u)val) return false; // see if there's code where we are writing to - if (!*(Bit32u*)&write_map[addr]) { + if (!host_readd(&write_map[addr])) { if (!active_blocks) { // no blocks left in this page, still delay the page releasing a bit active_count--; @@ -254,7 +269,12 @@ public: invalidation_map=(Bit8u*)malloc(4096); memset(invalidation_map,0,4096); } +#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY) + host_writed(&invalidation_map[addr], + host_readd(&invalidation_map[addr])+0x1010101); +#else (*(Bit32u*)&invalidation_map[addr])+=0x1010101; +#endif if (InvalidateRange(addr,addr+3)) { cpu.exception.which=SMC_CURRENT_BLOCK; return true;