Mercurial > repos > blastem
comparison m68k_core_x86.c @ 2279:3b5fef896475
Fix edge case in m68k_invalidate_code_range that caused problems when loading save states
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 08 Jan 2023 14:20:43 -0800 |
parents | 6677afe78a6f |
children | 959a3e9aaac5 |
comparison
equal
deleted
inserted
replaced
2278:5a21bc0ec583 | 2279:3b5fef896475 |
---|---|
2526 memmap_chunk const *mem_chunk = find_map_chunk(start, &opts->gen, 0, NULL); | 2526 memmap_chunk const *mem_chunk = find_map_chunk(start, &opts->gen, 0, NULL); |
2527 if (mem_chunk) { | 2527 if (mem_chunk) { |
2528 //calculate the lowest alias for this address | 2528 //calculate the lowest alias for this address |
2529 start = mem_chunk->start + ((start - mem_chunk->start) & mem_chunk->mask); | 2529 start = mem_chunk->start + ((start - mem_chunk->start) & mem_chunk->mask); |
2530 } | 2530 } |
2531 mem_chunk = find_map_chunk(end, &opts->gen, 0, NULL); | 2531 mem_chunk = find_map_chunk(end - 1, &opts->gen, 0, NULL); |
2532 if (mem_chunk) { | 2532 if (mem_chunk) { |
2533 //calculate the lowest alias for this address | 2533 //calculate the lowest alias for this address |
2534 end = mem_chunk->start + ((end - mem_chunk->start) & mem_chunk->mask); | 2534 end = mem_chunk->start + ((end - 1 - mem_chunk->start) & mem_chunk->mask) + 1; |
2535 } | 2535 } |
2536 uint32_t start_chunk = start / NATIVE_CHUNK_SIZE, end_chunk = end / NATIVE_CHUNK_SIZE; | 2536 uint32_t start_chunk = start / NATIVE_CHUNK_SIZE, end_chunk = end / NATIVE_CHUNK_SIZE; |
2537 for (uint32_t chunk = start_chunk; chunk <= end_chunk; chunk++) | 2537 for (uint32_t chunk = start_chunk; chunk <= end_chunk; chunk++) |
2538 { | 2538 { |
2539 if (native_code_map[chunk].base) { | 2539 if (native_code_map[chunk].base) { |