4 typedef int (*ctr_callback_type)(void);
6 int srvGetServiceHandle(unsigned int* out, const char* name);
7 int svcCloseHandle(unsigned int handle);
8 int svcBackdoor(ctr_callback_type);
11 static void ctr_enable_all_svc_kernel(void)
13 __asm__ volatile("cpsid aif");
15 unsigned int* svc_access_control = *(*(unsigned int***)0xFFFF9000 + 0x22) - 0x6;
17 svc_access_control[0]=0xFFFFFFFE;
18 svc_access_control[1]=0xFFFFFFFF;
19 svc_access_control[2]=0xFFFFFFFF;
20 svc_access_control[3]=0x3FFFFFFF;
24 static void ctr_invalidate_ICache_kernel(void)
29 "mcr p15, 0, r0, c7, c5, 0\n\t");
32 static void ctr_flush_DCache_kernel(void)
37 "mcr p15, 0, r0, c7, c10, 0\n\t");
42 static void ctr_enable_all_svc(void)
44 svcBackdoor((ctr_callback_type)ctr_enable_all_svc_kernel);
47 void ctr_invalidate_ICache(void)
49 // __asm__ volatile("svc 0x2E\n\t");
50 svcBackdoor((ctr_callback_type)ctr_invalidate_ICache_kernel);
54 void ctr_flush_DCache(void)
56 // __asm__ volatile("svc 0x4B\n\t");
57 svcBackdoor((ctr_callback_type)ctr_flush_DCache_kernel);
61 void ctr_flush_invalidate_cache(void)
64 ctr_invalidate_ICache();
67 int ctr_svchack_init(void)
69 extern unsigned int __service_ptr;