diff options
author | Michael Pavone <pavone@retrodev.com> | 2014-12-26 12:36:54 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2014-12-26 12:36:54 -0800 |
commit | d53d8f8d28c067bd80c5a66607973f5b125a0034 (patch) | |
tree | d87c169b972742af41d973b63aa774caf2a5d77c | |
parent | 55471707f6478f63fc07b2d260f6755ca259b6a2 (diff) |
Add a couple of missing checks for the byte_swap and address_size parameters in gen_mem_fun
-rw-r--r-- | backend_x86.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/backend_x86.c b/backend_x86.c index 6ba1a7a..482e9c3 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -154,7 +154,7 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n retn(code); *good_addr = code->cur - (good_addr + 1); shr_ir(code, 1, adr_reg, opts->address_size); - } else { + } else if (opts->byte_swap) { xor_ir(code, 1, adr_reg, opts->address_size); } } else if ((memmap[chunk].flags & MMAP_ONLY_ODD) || (memmap[chunk].flags & MMAP_ONLY_EVEN)) { @@ -164,6 +164,9 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n shr_ir(code, 8, opts->scratch1, SZ_W); } } + if (opts->address_size != SZ_D) { + movzx_rr(code, adr_reg, adr_reg, opts->address_size, SZ_D); + } if ((intptr_t)memmap[chunk].buffer <= 0x7FFFFFFF && (intptr_t)memmap[chunk].buffer >= -2147483648) { if (is_write) { mov_rrdisp(code, opts->scratch1, opts->scratch2, (intptr_t)memmap[chunk].buffer, tmp_size); |