From e2bbada9afb8710e91043b216a46ab4ec4fcb647 Mon Sep 17 00:00:00 2001 From: TheOfficialFloW Date: Sat, 17 Feb 2018 13:27:04 +0100 Subject: Added inline ksceKernelCpuUnrestrictedMemcpy because this doesn't exist in newer FWs --- include/kernel/kernel/cpu.h | 37 ++++++++++++++++++++++++------------- nids/360/SceSysmem.yml | 3 --- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index 09d144d..f6b60f7 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -64,6 +64,30 @@ static inline void sceKernelCpuRestoreContext(int context[3]) asm volatile ("cpsie i" ::: "memory"); } +/** + * @brief MMU permission bypassing memcpy + * + * This works by writing to the DACR before and after the memcpy. + * + * @param dst The destination + * @param[in] src The source + * @param[in] len The length + * + * @return Zero on success. + */ +static inline int sceKernelCpuUnrestrictedMemcpy(void *dst, const void *src, size_t len) +{ + int prev_dacr; + + asm ("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr)); + asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000)); + + memcpy(dst, src, len); + + asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr)); + return 0; +} + /** * @brief Returns the CPU ID of the calling processor * @@ -195,19 +219,6 @@ int sceKernelCpuIcacheInvalidateAll(void); */ int sceKernelCpuIcacheAndL2WritebackInvalidateRange(const void *ptr, size_t len); -/** - * @brief MMU permission bypassing memcpy - * - * This works by writing to the DACR before and after the memcpy. - * - * @param dst The destination - * @param[in] src The source - * @param[in] len The length - * - * @return Zero on success. - */ -int sceKernelCpuUnrestrictedMemcpy(void *dst, const void *src, size_t len); - /** * @brief Suspend all interrupts (disables IRQs) * diff --git a/nids/360/SceSysmem.yml b/nids/360/SceSysmem.yml index f79b80c..8db85c3 100644 --- a/nids/360/SceSysmem.yml +++ b/nids/360/SceSysmem.yml @@ -27,9 +27,6 @@ modules: sceKernelCpuIcacheAndL2WritebackInvalidateRange: 0x19F17BD0 sceKernelCpuIcacheInvalidateAll: 0x264DA250 sceKernelCpuIcacheInvalidateRange: 0xF4C7F578 - sceKernelCpuRestoreContext: 0x0A4F0FB9 - sceKernelCpuSaveContext: 0x211B89DA - sceKernelCpuUnrestrictedMemcpy: 0x8C683DEC SceDebugForDriver: nid: 0x88758561 functions: -- cgit v1.2.3