# HG changeset patch # User Michael Pavone # Date 1434990138 25200 # Node ID 59b499f6b24f086c028b7b46bfcfb525af9aee34 # Parent 6f439a197f61c009dd439d3c9d1a868f1a8db669 Fix handling of address mask in gen_mem_fun diff -r 6f439a197f61 -r 59b499f6b24f backend_x86.c --- a/backend_x86.c Mon Jun 22 09:22:05 2015 -0700 +++ b/backend_x86.c Mon Jun 22 09:22:18 2015 -0700 @@ -55,12 +55,12 @@ if (after_inc) { *after_inc = code->cur; } - if (opts->address_size == SZ_D && opts->address_mask < 0xFFFFFFFF) { - and_ir(code, opts->address_mask, opts->scratch1, SZ_D); + uint8_t is_write = fun_type == WRITE_16 || fun_type == WRITE_8; + uint8_t adr_reg = is_write ? opts->scratch2 : opts->scratch1; + if (opts->address_size == SZ_D && opts->address_mask != 0xFFFFFFFF) { + and_ir(code, opts->address_mask, adr_reg, SZ_D); } code_ptr lb_jcc = NULL, ub_jcc = NULL; - uint8_t is_write = fun_type == WRITE_16 || fun_type == WRITE_8; - uint8_t adr_reg = is_write ? opts->scratch2 : opts->scratch1; uint16_t access_flag = is_write ? MMAP_WRITE : MMAP_READ; uint8_t size = (fun_type == READ_16 || fun_type == WRITE_16) ? SZ_W : SZ_B; uint32_t ram_flags_off = opts->ram_flags_off;