# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/dosbox/ppc64le-dynrec-cache.diff # Copyright (C) 2024 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- Index: src/cpu/core_dynrec/cache.h =================================================================== --- ./src/cpu/core_dynrec/cache.h (revision 4296) +++ ./src/cpu/core_dynrec/cache.h (working copy) @@ -553,8 +553,8 @@ static void dyn_return(BlockReturn retcode,bool ret_exception); static void dyn_run_code(void); +static void cache_block_closing(Bit8u* block_start,Bitu block_size); - /* Define temporary pagesize so the MPROTECT case and the regular case share as much code as possible */ #if (C_HAVE_MPROTECT) #define PAGESIZE_TEMP PAGESIZE @@ -614,19 +614,25 @@ } // setup the default blocks for block linkage returns cache.pos=&cache_code_link_blocks[0]; + core_dynrec.runcode=(BlockReturn (*)(Bit8u*))cache.pos; + // can use op to PAGESIZE_TEMP-64 bytes + dyn_run_code(); + cache_block_closing(cache_code_link_blocks, cache.pos-cache_code_link_blocks); + + cache.pos=&cache_code_link_blocks[PAGESIZE_TEMP-64]; link_blocks[0].cache.start=cache.pos; // link code that returns with a special return code + // must be less than 32 bytes dyn_return(BR_Link1,false); - cache.pos=&cache_code_link_blocks[32]; + cache_block_closing(link_blocks[0].cache.start, cache.pos-link_blocks[0].cache.start); + + cache.pos=&cache_code_link_blocks[PAGESIZE_TEMP-32]; link_blocks[1].cache.start=cache.pos; // link code that returns with a special return code + // must be less than 32 bytes dyn_return(BR_Link2,false); + cache_block_closing(link_blocks[1].cache.start, cache.pos-link_blocks[1].cache.start); - cache.pos=&cache_code_link_blocks[64]; - core_dynrec.runcode=(BlockReturn (*)(Bit8u*))cache.pos; -// link_blocks[1].cache.start=cache.pos; - dyn_run_code(); - cache.free_pages=0; cache.last_page=0; cache.used_pages=0;