diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-11-22 14:42:36 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-11-22 14:42:36 -0800 |
commit | 7c5abd5e88f2556cc7709ad8b96803d5c8810327 (patch) | |
tree | a375bfd5679660fd3868b2c25a2e2ae6fad668a7 | |
parent | a129e2f5c284fae96a5239d4d48b8f27ed67fbdc (diff) |
Fix a bug in generating memory access functions when more than one MMAP_CODE region exists
-rw-r--r-- | backend_x86.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/backend_x86.c b/backend_x86.c index 63fcdc2..56b0f8d 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -194,11 +194,10 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n mov_rr(code, opts->scratch2, opts->scratch1, opts->address_size); shr_ir(code, opts->ram_flags_shift, opts->scratch1, opts->address_size); bt_rrdisp(code, opts->scratch1, opts->context_reg, ram_flags_off, opts->address_size); - //FIXME: These adjustments to ram_flags_off need to take into account bits vs bytes and ram_flags_shift if (memmap[chunk].mask == opts->address_mask) { - ram_flags_off += memmap[chunk].end - memmap[chunk].start; + ram_flags_off += (memmap[chunk].end - memmap[chunk].start) / (1 << opts->ram_flags_shift) / 8; ; } else { - ram_flags_off += memmap[chunk].mask + 1; + ram_flags_off += (memmap[chunk].mask + 1) / (1 << opts->ram_flags_shift) / 8;; } code_ptr not_code = code->cur + 1; jcc(code, CC_NC, code->cur + 2); |