From 6a50b8a68d5a0595dc78c90f5d0969021beb7ea1 Mon Sep 17 00:00:00 2001 From: Justin Weiss Date: Sat, 29 Feb 2020 10:50:30 -0800 Subject: [3DS] Fix dynarec prefetch aborts Similar fix to https://github.com/libretro/pcsx_rearmed/pull/390. The Nintendo svcBackdoor can cause stack corruption if an interrupt happens during it, this uses Luma3DS/Rosalina's svcCustomBackdoor instead. --- 3ds/3ds_utils.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to '3ds/3ds_utils.c') diff --git a/3ds/3ds_utils.c b/3ds/3ds_utils.c index 4f8f9be..266eca0 100644 --- a/3ds/3ds_utils.c +++ b/3ds/3ds_utils.c @@ -7,6 +7,20 @@ typedef s32 (*ctr_callback_type)(void); +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; + } +} + static void ctr_invalidate_ICache_kernel(void) { __asm__ volatile( @@ -38,6 +52,10 @@ void ctr_flush_DCache(void) void ctr_flush_invalidate_cache(void) { - ctr_flush_DCache(); - ctr_invalidate_ICache(); + if (has_rosalina) { + ctr_clear_cache(); + } else { + ctr_flush_DCache(); + ctr_invalidate_ICache(); + } } -- cgit v1.2.3