summaryrefslogtreecommitdiff
path: root/m68k_core.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-02-01 19:33:11 -0800
committerMichael Pavone <pavone@retrodev.com>2017-02-01 19:33:11 -0800
commitf123340cdc3966812468855160b24e0dfcbe9c0e (patch)
tree8b82f95d0ade36974ac40dbb0b13a37e8c0bf170 /m68k_core.c
parent258c7e42f54ecd25e3dfb3dbbd553f169bf25209 (diff)
Fix regression in handling of unmapped memory addresses
Diffstat (limited to 'm68k_core.c')
-rw-r--r--m68k_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/m68k_core.c b/m68k_core.c
index 506dcc3..1ca7f2b 100644
--- a/m68k_core.c
+++ b/m68k_core.c
@@ -565,6 +565,8 @@ code_ptr get_native_address(m68k_options *opts, uint32_t address)
if (mem_chunk) {
//calculate the lowest alias for this address
address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+ } else {
+ address &= opts->gen.address_mask;
}
uint32_t chunk = address / NATIVE_CHUNK_SIZE;
if (!native_code_map[chunk].base) {
@@ -589,6 +591,8 @@ uint32_t get_instruction_start(m68k_options *opts, uint32_t address)
if (mem_chunk) {
//calculate the lowest alias for this address
address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+ } else {
+ address &= opts->gen.address_mask;
}
uint32_t chunk = address / NATIVE_CHUNK_SIZE;
@@ -635,6 +639,8 @@ static void map_native_address(m68k_context * context, uint32_t address, code_pt
}
//calculate the lowest alias for this address
address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+ } else {
+ address &= opts->gen.address_mask;
}
uint32_t chunk = address / NATIVE_CHUNK_SIZE;