Mercurial > repos > blastem
diff 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 |
line wrap: on
line diff
--- a/backend_x86.c Tue Oct 04 18:30:49 2016 -0700 +++ b/backend_x86.c Thu Oct 06 09:25:43 2016 -0700 @@ -141,10 +141,15 @@ if (opts->address_size != SZ_D) { movzx_rr(code, adr_reg, adr_reg, opts->address_size, SZ_D); } + if (is_write && (memmap[chunk].flags & MMAP_CODE)) { + push_r(code, adr_reg); + } add_rdispr(code, opts->context_reg, opts->mem_ptr_off + sizeof(void*) * memmap[chunk].ptr_index, adr_reg, SZ_PTR); if (is_write) { mov_rrind(code, opts->scratch1, opts->scratch2, size); - + if (memmap[chunk].flags & MMAP_CODE) { + pop_r(code, adr_reg); + } } else { mov_rindr(code, opts->scratch1, opts->scratch1, size); }