comparison backend_x86.c @ 595:68f86ca4bb32

Add a couple of missing checks for the byte_swap and address_size parameters in gen_mem_fun
author Michael Pavone <pavone@retrodev.com>
date Fri, 26 Dec 2014 12:36:54 -0800
parents 5ef3fe516da9
children f0061e3d2ad9
comparison
equal deleted inserted replaced
594:086de8692932 595:68f86ca4bb32
152 mov_ir(code, 0xFF, opts->scratch1, SZ_B); 152 mov_ir(code, 0xFF, opts->scratch1, SZ_B);
153 } 153 }
154 retn(code); 154 retn(code);
155 *good_addr = code->cur - (good_addr + 1); 155 *good_addr = code->cur - (good_addr + 1);
156 shr_ir(code, 1, adr_reg, opts->address_size); 156 shr_ir(code, 1, adr_reg, opts->address_size);
157 } else { 157 } else if (opts->byte_swap) {
158 xor_ir(code, 1, adr_reg, opts->address_size); 158 xor_ir(code, 1, adr_reg, opts->address_size);
159 } 159 }
160 } else if ((memmap[chunk].flags & MMAP_ONLY_ODD) || (memmap[chunk].flags & MMAP_ONLY_EVEN)) { 160 } else if ((memmap[chunk].flags & MMAP_ONLY_ODD) || (memmap[chunk].flags & MMAP_ONLY_EVEN)) {
161 tmp_size = SZ_B; 161 tmp_size = SZ_B;
162 shr_ir(code, 1, adr_reg, opts->address_size); 162 shr_ir(code, 1, adr_reg, opts->address_size);
163 if ((memmap[chunk].flags & MMAP_ONLY_EVEN) && is_write) { 163 if ((memmap[chunk].flags & MMAP_ONLY_EVEN) && is_write) {
164 shr_ir(code, 8, opts->scratch1, SZ_W); 164 shr_ir(code, 8, opts->scratch1, SZ_W);
165 } 165 }
166 }
167 if (opts->address_size != SZ_D) {
168 movzx_rr(code, adr_reg, adr_reg, opts->address_size, SZ_D);
166 } 169 }
167 if ((intptr_t)memmap[chunk].buffer <= 0x7FFFFFFF && (intptr_t)memmap[chunk].buffer >= -2147483648) { 170 if ((intptr_t)memmap[chunk].buffer <= 0x7FFFFFFF && (intptr_t)memmap[chunk].buffer >= -2147483648) {
168 if (is_write) { 171 if (is_write) {
169 mov_rrdisp(code, opts->scratch1, opts->scratch2, (intptr_t)memmap[chunk].buffer, tmp_size); 172 mov_rrdisp(code, opts->scratch1, opts->scratch2, (intptr_t)memmap[chunk].buffer, tmp_size);
170 } else { 173 } else {