From fb7ca09b019248b9a0aba481ea55386f71053d73 Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Wed, 17 Mar 2021 18:33:02 +0100 Subject: Remove BIOS reserved translation area This is not really necessary since it can share area with ROM. Performance impact should be very minimal (haven't noticed it myself) and could be compensated (even by a positive offset) if we bump the ROM cache area size. Tested with several dynarecs. --- cpu_threaded.c | 79 ++-------------------------------------------------------- 1 file changed, 2 insertions(+), 77 deletions(-) (limited to 'cpu_threaded.c') diff --git a/cpu_threaded.c b/cpu_threaded.c index 4d93e55..c66fa5e 100644 --- a/cpu_threaded.c +++ b/cpu_threaded.c @@ -29,30 +29,23 @@ u8 *last_rom_translation_ptr = NULL; u8 *last_ram_translation_ptr = NULL; -u8 *last_bios_translation_ptr = NULL; #if defined(HAVE_MMAP) u8* rom_translation_cache; u8* ram_translation_cache; -u8* bios_translation_cache; u8 *rom_translation_ptr; u8 *ram_translation_ptr; -u8 *bios_translation_ptr; #elif defined(VITA) u8* rom_translation_cache; u8* ram_translation_cache; -u8* bios_translation_cache; u8 *rom_translation_ptr; u8 *ram_translation_ptr; -u8 *bios_translation_ptr; int sceBlock; #elif defined(_3DS) u8* rom_translation_cache_ptr; u8* ram_translation_cache_ptr; -u8* bios_translation_cache_ptr; u8 *rom_translation_ptr = rom_translation_cache; u8 *ram_translation_ptr = ram_translation_cache; -u8 *bios_translation_ptr = bios_translation_cache; #else #ifdef __ANDROID__ @@ -72,10 +65,6 @@ u8 ram_translation_cache[RAM_TRANSLATION_CACHE_SIZE] __attribute__ ((aligned(4),section(".jit"))); u8 *ram_translation_ptr = ram_translation_cache; -u8 bios_translation_cache[BIOS_TRANSLATION_CACHE_SIZE] - __attribute__ ((aligned(4),section(".jit"))); -u8 *bios_translation_ptr = bios_translation_cache; - __asm__(".section .text"); #endif @@ -277,10 +266,6 @@ void translate_icache_sync() { platform_cache_sync(last_ram_translation_ptr, ram_translation_ptr); last_ram_translation_ptr = ram_translation_ptr; } - if (last_bios_translation_ptr < bios_translation_ptr) { - platform_cache_sync(last_bios_translation_ptr, bios_translation_ptr); - last_bios_translation_ptr = bios_translation_ptr; - } } /* End of Cache invalidation */ @@ -2703,9 +2688,6 @@ void translate_icache_sync() { u8 *ram_block_ptrs[1024 * 64]; u32 ram_block_tag_top = 0x0101; -u8 *bios_block_ptrs[1024 * 8]; -u32 bios_block_tag_top = 0x0101; - // This function will return a pointer to a translated block of code. If it // doesn't exist it will translate it, if it does it will pass it back. @@ -2735,7 +2717,6 @@ u32 bios_block_tag_top = 0x0101; #define ram_translation_region TRANSLATION_REGION_RAM #define rom_translation_region TRANSLATION_REGION_ROM -#define bios_translation_region TRANSLATION_REGION_BIOS #define block_lookup_translate_arm(mem_type, smc_enable) \ translation_result = translate_block_arm(pc, mem_type##_translation_region, \ @@ -2831,28 +2812,17 @@ u8 function_cc *block_lookup_address_##type(u32 pc) \ \ switch(pc >> 24) \ { \ - case 0x0: \ - bios_region_read_allow(); \ - location = (u16 *)(bios_rom + pc + 0x4000); \ - block_lookup_translate(type, bios, 0); \ - if(translation_recursion_level == 0) \ - bios_region_read_allow(); \ - break; \ - \ case 0x2: \ location = (u16 *)(ewram + (pc & 0x7FFF) + ((pc & 0x38000) * 2)); \ block_lookup_translate(type, ram, 1); \ - if(translation_recursion_level == 0) \ - bios_region_read_protect(); \ break; \ \ case 0x3: \ location = (u16 *)(iwram + (pc & 0x7FFF)); \ block_lookup_translate(type, ram, 1); \ - if(translation_recursion_level == 0) \ - bios_region_read_protect(); \ break; \ \ + case 0x0: \ case 0x8 ... 0xD: \ { \ u32 hash_target = ((pc * 2654435761U) >> 16) & \ @@ -2876,7 +2846,7 @@ u8 function_cc *block_lookup_address_##type(u32 pc) \ \ redo: \ \ - translation_recursion_level++; \ + translation_recursion_level++; \ ((u32 *)rom_translation_ptr)[0] = pc; \ ((u32 **)rom_translation_ptr)[1] = NULL; \ *block_ptr_address = (u32 *)rom_translation_ptr; \ @@ -2898,8 +2868,6 @@ u8 function_cc *block_lookup_address_##type(u32 pc) \ if(translation_recursion_level == 0) \ translate_icache_sync(); \ } \ - if(translation_recursion_level == 0) \ - bios_region_read_protect(); \ break; \ } \ \ @@ -3310,12 +3278,6 @@ s32 translate_block_arm(u32 pc, translation_region_type rom_translation_cache + ROM_TRANSLATION_CACHE_SIZE - TRANSLATION_CACHE_LIMIT_THRESHOLD; break; - - case TRANSLATION_REGION_BIOS: - translation_ptr = bios_translation_ptr; - translation_cache_limit = bios_translation_cache + - BIOS_TRANSLATION_CACHE_SIZE; - break; } generate_block_prologue(); @@ -3378,10 +3340,6 @@ s32 translate_block_arm(u32 pc, translation_region_type case TRANSLATION_REGION_ROM: flush_translation_cache_rom(); break; - - case TRANSLATION_REGION_BIOS: - flush_translation_cache_bios(); - break; } return -1; } @@ -3449,10 +3407,6 @@ s32 translate_block_arm(u32 pc, translation_region_type case TRANSLATION_REGION_ROM: rom_translation_ptr = translation_ptr; break; - - case TRANSLATION_REGION_BIOS: - bios_translation_ptr = translation_ptr; - break; } for(i = 0; i < external_block_exit_position; i++) @@ -3526,12 +3480,6 @@ s32 translate_block_thumb(u32 pc, translation_region_type rom_translation_cache + ROM_TRANSLATION_CACHE_SIZE - TRANSLATION_CACHE_LIMIT_THRESHOLD; break; - - case TRANSLATION_REGION_BIOS: - translation_ptr = bios_translation_ptr; - translation_cache_limit = bios_translation_cache + - BIOS_TRANSLATION_CACHE_SIZE; - break; } generate_block_prologue(); @@ -3594,10 +3542,6 @@ s32 translate_block_thumb(u32 pc, translation_region_type case TRANSLATION_REGION_ROM: flush_translation_cache_rom(); break; - - case TRANSLATION_REGION_BIOS: - flush_translation_cache_bios(); - break; } return -1; } @@ -3665,10 +3609,6 @@ s32 translate_block_thumb(u32 pc, translation_region_type case TRANSLATION_REGION_ROM: rom_translation_ptr = translation_ptr; break; - - case TRANSLATION_REGION_BIOS: - bios_translation_ptr = translation_ptr; - break; } for(i = 0; i < external_block_exit_position; i++) @@ -3746,16 +3686,6 @@ void flush_translation_cache_rom(void) memset(rom_branch_hash, 0, sizeof(rom_branch_hash)); } -void flush_translation_cache_bios(void) -{ - bios_block_tag_top = 0x0101; - - last_bios_translation_ptr = bios_translation_cache; - bios_translation_ptr = bios_translation_cache; - - memset(bios_rom + 0x4000, 0, 0x4000); -} - #define cache_dump_prefix "" void dump_translation_cache(void) @@ -3769,11 +3699,6 @@ void dump_translation_cache(void) fwrite(rom_translation_cache, 1, rom_translation_ptr - rom_translation_cache, fd); fclose(fd); - - fd = fopen(cache_dump_prefix "bios_cache.bin", "wb"); - fwrite(bios_translation_cache, 1, - bios_translation_ptr - bios_translation_cache, fd); - fclose(fd); } -- cgit v1.2.3