# HG changeset patch # User Michael Pavone # Date 1448232156 28800 # Node ID 381a3b2f606599b646d44bc708398086ba92777d # Parent 90d54ccf95574cf208de2b00a5423367108aede8 Fix a bug in generating memory access functions when more than one MMAP_CODE region exists diff -r 90d54ccf9557 -r 381a3b2f6065 backend_x86.c --- a/backend_x86.c Tue Nov 17 19:55:59 2015 -0800 +++ b/backend_x86.c Sun Nov 22 14:42:36 2015 -0800 @@ -194,11 +194,10 @@ 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);