From 4d987004e3b82a3f26d1d59cb69e18672ec09043 Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 24 Oct 2024 02:33:38 +0300 Subject: [PATCH] 3ds: drop pre-rosalina code no reason not to run an up-to-date cfw --- frontend/3ds/3ds_utils.h | 63 +-------------------------- frontend/3ds/sys/mman.h | 1 + libpcsxcore/new_dynarec/new_dynarec.c | 5 +-- 3 files changed, 4 insertions(+), 65 deletions(-) diff --git a/frontend/3ds/3ds_utils.h b/frontend/3ds/3ds_utils.h index 2fc44f2a..bde9c491 100644 --- a/frontend/3ds/3ds_utils.h +++ b/frontend/3ds/3ds_utils.h @@ -1,13 +1,8 @@ #ifndef _3DS_UTILS_H #define _3DS_UTILS_H -#include -#include -#include <3ds/os.h> -#include <3ds/svc.h> - -#ifdef OS_HEAP_AREA_BEGIN // defined in libctru 2.0+ -#define USE_CTRULIB_2 1 +#ifndef USE_CTRULIB_2 +#error CTRULIB_2 is required #endif #define MEMOP_PROT 6 @@ -23,58 +18,4 @@ void ctr_clear_cache_range(void *start, void *end); extern __attribute__((weak)) int __ctr_svchax; -static bool has_rosalina; - -static inline void check_rosalina() { - int64_t version; - uint32_t major; - - has_rosalina = false; - - if (!svcGetSystemInfo(&version, 0x10000, 0)) { - major = GET_VERSION_MAJOR(version); - - if (major >= 8) - has_rosalina = true; - } -} - -typedef int32_t (*ctr_callback_type)(void); - -static inline void ctr_invalidate_ICache_kernel(void) -{ - __asm__ volatile( - "cpsid aif\n\t" - "mov r0, #0\n\t" - "mcr p15, 0, r0, c7, c5, 0\n\t"); -} - -static inline void ctr_flush_DCache_kernel(void) -{ - __asm__ volatile( - "cpsid aif\n\t" - "mov r0, #0\n\t" - "mcr p15, 0, r0, c7, c10, 0\n\t"); -} - -static inline void ctr_invalidate_ICache(void) -{ - svcBackdoor((ctr_callback_type)ctr_invalidate_ICache_kernel); -} - -static inline void ctr_flush_DCache(void) -{ - svcBackdoor((ctr_callback_type)ctr_flush_DCache_kernel); -} - -static inline void ctr_flush_invalidate_cache(void) -{ - if (has_rosalina) { - ctr_clear_cache(); - } else { - ctr_flush_DCache(); - ctr_invalidate_ICache(); - } -} - #endif // _3DS_UTILS_H diff --git a/frontend/3ds/sys/mman.h b/frontend/3ds/sys/mman.h index 4ba90db2..e53968c5 100644 --- a/frontend/3ds/sys/mman.h +++ b/frontend/3ds/sys/mman.h @@ -8,6 +8,7 @@ extern "C" { #include #include +#include <3ds/svc.h> #include "3ds_utils.h" #define PROT_READ 0b001 diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 37caf473..2b2e6634 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -498,7 +498,7 @@ static void end_tcache_write(void *start, void *end) if ((char *)end - (char *)start <= 2*1024) ctr_clear_cache_range(start, end); else - ctr_flush_invalidate_cache(); + ctr_clear_cache(); ndrc_g.thread.cache_dirty = 1; #elif defined(HAVE_LIBNX) if (g_jit.type == JitType_CodeMemory) { @@ -6314,9 +6314,6 @@ void new_dynarec_init(void) SysPrintf("Init new dynarec, ndrc size %x, pgsize %d\n", (int)sizeof(*ndrc), align + 1); -#ifdef _3DS - check_rosalina(); -#endif #ifdef BASE_ADDR_DYNAMIC #ifdef VITA sceBlock = getVMBlock(); //sceKernelAllocMemBlockForVM("code", sizeof(*ndrc)); -- 2.39.5