comparison z80_to_x86.c @ 1182:2a799f24563f

Fix regression in tracking of 3+ byte instructions in Z80 core
author Michael Pavone <pavone@retrodev.com>
date Wed, 18 Jan 2017 07:29:06 -0800
parents 06468b25a543
children 60d73f42a606
comparison
equal deleted inserted replaced
1181:0928b68fef2a 1182:2a799f24563f
2913 return opts->gen.ram_inst_sizes[slot][meta_off%1024]; 2913 return opts->gen.ram_inst_sizes[slot][meta_off%1024];
2914 } 2914 }
2915 2915
2916 void z80_map_native_address(z80_context * context, uint32_t address, uint8_t * native_address, uint8_t size, uint8_t native_size) 2916 void z80_map_native_address(z80_context * context, uint32_t address, uint8_t * native_address, uint8_t size, uint8_t native_size)
2917 { 2917 {
2918 uint32_t orig_address = address;
2919
2920 z80_options * opts = context->options; 2918 z80_options * opts = context->options;
2921 uint32_t meta_off; 2919 uint32_t meta_off;
2922 memmap_chunk const *mem_chunk = find_map_chunk(address, &opts->gen, MMAP_CODE, &meta_off); 2920 memmap_chunk const *mem_chunk = find_map_chunk(address, &opts->gen, MMAP_CODE, &meta_off);
2923 if (mem_chunk) { 2921 if (mem_chunk) {
2924 if (mem_chunk->flags & MMAP_CODE) { 2922 if (mem_chunk->flags & MMAP_CODE) {
2948 map->base = native_address; 2946 map->base = native_address;
2949 map->offsets = malloc(sizeof(int32_t) * NATIVE_CHUNK_SIZE); 2947 map->offsets = malloc(sizeof(int32_t) * NATIVE_CHUNK_SIZE);
2950 memset(map->offsets, 0xFF, sizeof(int32_t) * NATIVE_CHUNK_SIZE); 2948 memset(map->offsets, 0xFF, sizeof(int32_t) * NATIVE_CHUNK_SIZE);
2951 } 2949 }
2952 map->offsets[address % NATIVE_CHUNK_SIZE] = native_address - map->base; 2950 map->offsets[address % NATIVE_CHUNK_SIZE] = native_address - map->base;
2953 for(--size, address++; size; --size, orig_address++) { 2951 for(--size, address++; size; --size, address++) {
2954 address &= opts->gen.address_mask; 2952 address &= opts->gen.address_mask;
2955 map = opts->gen.native_code_map + address / NATIVE_CHUNK_SIZE; 2953 map = opts->gen.native_code_map + address / NATIVE_CHUNK_SIZE;
2956 if (!map->base) { 2954 if (!map->base) {
2957 map->base = native_address; 2955 map->base = native_address;
2958 map->offsets = malloc(sizeof(int32_t) * NATIVE_CHUNK_SIZE); 2956 map->offsets = malloc(sizeof(int32_t) * NATIVE_CHUNK_SIZE);