diff options
author | Reiko Asakura | 2021-02-16 10:24:28 -0500 |
---|---|---|
committer | Reiko Asakura | 2021-02-16 10:24:28 -0500 |
commit | b9aadce8bf66ce4793964663a23d4d793bc28b61 (patch) | |
tree | c7da08831e2009f2bd8b9ecd1899723abcdd05a5 /365compat/sceKernelCpuUnrestrictedMemcpy.c | |
parent | Add lint workflow (diff) | |
download | vds-libraries-b9aadce8bf66ce4793964663a23d4d793bc28b61.tar.gz |
Remove inline asm in cpu.h
Diffstat (limited to '365compat/sceKernelCpuUnrestrictedMemcpy.c')
-rw-r--r-- | 365compat/sceKernelCpuUnrestrictedMemcpy.c | 22 |
1 files changed, 22 insertions, 0 deletions
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; +} |