summaryrefslogtreecommitdiff
path: root/include/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'include/kernel')
-rw-r--r--include/kernel/kernel/cpu.h37
1 files changed, 24 insertions, 13 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