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;
23 static void ctr_enable_all_svc(void)
25 svcBackdoor((ctr_callback_type)ctr_enable_all_svc_kernel);
28 static void ctr_clean_invalidate_kernel(void)
32 "cpsid aif\n" // disable interrupts
34 "mcr p15, 0, r0, c7, c10, 0\n" // clean dcache
35 "mcr p15, 0, r0, c7, c10, 4\n" // DSB
36 "mcr p15, 0, r0, c7, c5, 0\n" // invalidate icache+BTAC
37 "msr cpsr_cx, r1\n" // restore interrupts
41 void ctr_flush_invalidate_cache(void)
43 // __asm__ volatile("svc 0x2E\n\t");
44 // __asm__ volatile("svc 0x4B\n\t");
45 svcBackdoor((ctr_callback_type)ctr_clean_invalidate_kernel);
48 int ctr_svchack_init(void)
50 extern unsigned int __service_ptr;