diff options
-rw-r--r-- | include/kernel/kernel/cpu.h | 37 | ||||
-rw-r--r-- | 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 @@ -65,6 +65,30 @@ static inline void sceKernelCpuRestoreContext(int context[3]) } /** + * @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 * * @return The CPU ID @@ -196,19 +220,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) * * @param[in] addr Mutex associated to the suspend-resume pair 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: |