summaryrefslogtreecommitdiff
path: root/365compat
diff options
context:
space:
mode:
authorReiko Asakura2021-02-16 10:24:28 -0500
committerReiko Asakura2021-02-16 10:24:28 -0500
commitb9aadce8bf66ce4793964663a23d4d793bc28b61 (patch)
treec7da08831e2009f2bd8b9ecd1899723abcdd05a5 /365compat
parentAdd lint workflow (diff)
downloadvds-libraries-b9aadce8bf66ce4793964663a23d4d793bc28b61.tar.gz
Remove inline asm in cpu.h
Diffstat (limited to '365compat')
-rw-r--r--365compat/CMakeLists.txt19
-rw-r--r--365compat/sceKernelCpuUnrestrictedMemcpy.c22
2 files changed, 41 insertions, 0 deletions
diff --git a/365compat/CMakeLists.txt b/365compat/CMakeLists.txt
new file mode 100644
index 0000000..7c76538
--- /dev/null
+++ b/365compat/CMakeLists.txt
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2021 Reiko Asakura. All Rights Reserved.
+#
+# Vita Development Suite Libraries
+#
+
+include_directories(SYSTEM
+ ../include/kernel
+ ../include/common
+)
+
+add_library(365compat STATIC
+ sceKernelCpuUnrestrictedMemcpy.c
+)
+
+install(TARGETS
+ 365compat
+ ARCHIVE DESTINATION lib/vdsuite
+)
diff --git a/365compat/sceKernelCpuUnrestrictedMemcpy.c b/365compat/sceKernelCpuUnrestrictedMemcpy.c
new file mode 100644
index 0000000..5a4e4ce
--- /dev/null
+++ b/365compat/sceKernelCpuUnrestrictedMemcpy.c
@@ -0,0 +1,22 @@
+/*
+ Vita Development Suite Libraries
+*/
+
+#include <string.h>
+#include <kernel/cpu.h>
+
+#define ALIGN(x) ((((x) + 0x1F) >> 5) << 5)
+#define ALIGN_BACK(x) (((x) >> 5) << 5)
+
+// Copied from sysmem.skprx 3.600
+// Unavailable in 3.650
+int sceKernelCpuUnrestrictedMemcpy(void *dst, const void *src, SceSize len) {
+ int dacr = __builtin_mrc(15, 0, 3, 0, 0);
+ __builtin_mcr(15, 0, 3, 0, 0, 0xFFFF0000);
+ memcpy(dst, src, len);
+ len = ALIGN((SceSize)dst + len) - ALIGN_BACK((SceSize)dst);
+ dst = (void*)ALIGN_BACK((SceSize)dst);
+ sceKernelCpuDcacheWritebackRange(dst, len);
+ __builtin_mcr(15, 0, 3, 0, 0, dacr);
+ return 0;
+}