10 void* linearMemAlign(size_t size, size_t alignment);
11 void linearFree(void* mem);
13 int32_t svcDuplicateHandle(uint32_t* out, uint32_t original);
14 int32_t svcCloseHandle(uint32_t handle);
15 int32_t svcControlMemory(void* addr_out, void* addr0, void* addr1, uint32_t size, uint32_t op, uint32_t perm);
16 int32_t svcControlProcessMemory(uint32_t process, void* addr0, void* addr1, uint32_t size, uint32_t op, uint32_t perm);
18 int32_t svcCreateThread(int32_t* thread, void *(*entrypoint)(void*), void* arg, void* stack_top, int32_t thread_priority, int32_t processor_id);
19 int32_t svcWaitSynchronization(int32_t handle, int64_t nanoseconds);
20 void svcExitThread(void) __attribute__((noreturn));
22 int32_t svcBackdoor(int32_t (*callback)(void));
24 #define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0)
26 void wait_for_input(void);
28 extern __attribute__((weak)) int __ctr_svchax;
30 typedef int32_t (*ctr_callback_type)(void);
32 static inline void ctr_invalidate_ICache_kernel(void)
37 "mcr p15, 0, r0, c7, c5, 0\n\t");
40 static inline void ctr_flush_DCache_kernel(void)
45 "mcr p15, 0, r0, c7, c10, 0\n\t");
48 static inline void ctr_invalidate_ICache(void)
50 svcBackdoor((ctr_callback_type)ctr_invalidate_ICache_kernel);
53 static inline void ctr_flush_DCache(void)
55 svcBackdoor((ctr_callback_type)ctr_flush_DCache_kernel);
59 static inline void ctr_flush_invalidate_cache(void)
62 ctr_invalidate_ICache();
66 #endif // _3DS_UTILS_H