From 6b9ded20a0d44d2b8b44ae59e06d3952d0a2c8dd Mon Sep 17 00:00:00 2001 From: kub Date: Sat, 12 Oct 2019 11:10:28 +0200 Subject: [PATCH] sh2 drc: bugfix in block management --- cpu/sh2/compiler.c | 4 +--- pico/32x/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cpu/sh2/compiler.c b/cpu/sh2/compiler.c index 2c1e8cff..b7c57b3d 100644 --- a/cpu/sh2/compiler.c +++ b/cpu/sh2/compiler.c @@ -769,8 +769,7 @@ static void rm_block_list(struct block_list **blist) struct block_list *next, *current = *blist; while (current != NULL) { next = current->next; - current->next = blist_free; - blist_free = current; + rm_from_block_lists(current->block); current = next; } *blist = NULL; @@ -5441,7 +5440,6 @@ int sh2_drc_init(SH2 *sh2) block_tables[i] = calloc(BLOCK_MAX_COUNT(i), sizeof(*block_tables[0])); if (block_tables[i] == NULL) goto fail; - // max 2 block links (exits) per block block_link_pool[i] = calloc(BLOCK_LINK_MAX_COUNT(i), sizeof(*block_link_pool[0])); if (block_link_pool[i] == NULL) diff --git a/pico/32x/memory.c b/pico/32x/memory.c index 60820e1a..06215a7c 100644 --- a/pico/32x/memory.c +++ b/pico/32x/memory.c @@ -513,9 +513,9 @@ static void p32x_reg_write8(u32 a, u32 d) case 0x2e: case 0x2f: if (REG8IN16(r, a) != d) { - int cycles = SekCyclesDone(); + unsigned int cycles = SekCyclesDone(); - if (cycles - (int)msh2.m68krcycles_done > 30) + if (CYCLES_GT(cycles - msh2.m68krcycles_done, 64)) p32x_sync_sh2s(cycles); REG8IN16(r, a) = d; -- 2.39.2