comparison backend_x86.c @ 1081:89cc20cf1ad3

Fix handling of MMAP_CODE chunks that also have MMAP_PTR_IDX set
author Michael Pavone <pavone@retrodev.com>
date Thu, 06 Oct 2016 09:25:43 -0700
parents 6b07af1515b5
children 193db42e702b
comparison
equal deleted inserted replaced
1080:382614130914 1081:89cc20cf1ad3
139 xor_ir(code, 1, adr_reg, opts->address_size); 139 xor_ir(code, 1, adr_reg, opts->address_size);
140 } 140 }
141 if (opts->address_size != SZ_D) { 141 if (opts->address_size != SZ_D) {
142 movzx_rr(code, adr_reg, adr_reg, opts->address_size, SZ_D); 142 movzx_rr(code, adr_reg, adr_reg, opts->address_size, SZ_D);
143 } 143 }
144 if (is_write && (memmap[chunk].flags & MMAP_CODE)) {
145 push_r(code, adr_reg);
146 }
144 add_rdispr(code, opts->context_reg, opts->mem_ptr_off + sizeof(void*) * memmap[chunk].ptr_index, adr_reg, SZ_PTR); 147 add_rdispr(code, opts->context_reg, opts->mem_ptr_off + sizeof(void*) * memmap[chunk].ptr_index, adr_reg, SZ_PTR);
145 if (is_write) { 148 if (is_write) {
146 mov_rrind(code, opts->scratch1, opts->scratch2, size); 149 mov_rrind(code, opts->scratch1, opts->scratch2, size);
147 150 if (memmap[chunk].flags & MMAP_CODE) {
151 pop_r(code, adr_reg);
152 }
148 } else { 153 } else {
149 mov_rindr(code, opts->scratch1, opts->scratch1, size); 154 mov_rindr(code, opts->scratch1, opts->scratch1, size);
150 } 155 }
151 } else { 156 } else {
152 uint8_t tmp_size = size; 157 uint8_t tmp_size = size;