# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/dosbox/ppc64le-dynrec-cache.diff # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-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;