#ifndef _3DS_UTILS_H
#define _3DS_UTILS_H
-#include <stdio.h>
-#include <stdbool.h>
-#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
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
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) {
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));