From ac14d60c291cc5b5512ddf5c20eff4049e5df4f8 Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Sat, 23 Jan 2021 19:35:43 -0500 Subject: Port to Vita Development Suite --- lib/dis.h | 6 ++++++ lib/execmem.h | 1 - lib/hook-functions.c | 1 - lib/substitute-internal.h | 1 + lib/vita/execmem.c | 14 +++++++------- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/dis.h b/lib/dis.h index ba2a6c7..bb7ec94 100644 --- a/lib/dis.h +++ b/lib/dis.h @@ -6,6 +6,12 @@ #include #include +#ifdef __GNUC__ +#define alloca(size) __builtin_alloca(size) +#else +extern void * alloca (size_t __size); +#endif + #define INLINE __attribute__((always_inline)) #define NOINLINE __attribute__((noinline)) diff --git a/lib/execmem.h b/lib/execmem.h index 07e9fa4..9e2f8ca 100644 --- a/lib/execmem.h +++ b/lib/execmem.h @@ -1,5 +1,4 @@ #pragma once -#include /* For allocating trampolines - this is just a mmap wrapper. */ int execmem_alloc_unsealed(uintptr_t hint, void **page_p, uintptr_t *vma_p, size_t *size_p, void *opt); int execmem_seal(void *page, void *opt); diff --git a/lib/hook-functions.c b/lib/hook-functions.c index d2fabe9..c38b92a 100644 --- a/lib/hook-functions.c +++ b/lib/hook-functions.c @@ -6,7 +6,6 @@ #include "execmem.h" #include stringify(TARGET_DIR/jump-patch.h) #include -#include #ifndef NO_PTHREADS #include #endif diff --git a/lib/substitute-internal.h b/lib/substitute-internal.h index 8859436..a35cd93 100644 --- a/lib/substitute-internal.h +++ b/lib/substitute-internal.h @@ -2,6 +2,7 @@ #include #include +#include #define substitute_panic(...) do { \ fprintf(stderr, __VA_ARGS__); \ diff --git a/lib/vita/execmem.c b/lib/vita/execmem.c index 73c5fdc..2af1430 100644 --- a/lib/vita/execmem.c +++ b/lib/vita/execmem.c @@ -2,9 +2,9 @@ #include "dis.h" #include "execmem.h" #include stringify(TARGET_DIR/jump-patch.h) -#include -#include -#include +#include +#include +#include #include "../../../patches.h" #include "../../../slab.h" #include "../../../taihen_internal.h" @@ -126,14 +126,14 @@ int execmem_foreign_write_with_pc_patch(struct execmem_foreign_write *writes, struct slab_chain *slab = (struct slab_chain *)writes[i].opt; SceUID pid = slab->pid; if (pid == SHARED_PID) { - pid = ksceKernelGetProcessId(); - LOG("ksceKernelGetProcessId: %x", pid); + pid = sceKernelGetProcessId(); + LOG("sceKernelGetProcessId: %x", pid); } LOG("PID:%x, dst:%p, src:%p, len:%x", pid, writes[i].dst, writes[i].src, writes[i].len); if (pid == KERNEL_PID) { - ksceKernelCpuUnrestrictedMemcpy(writes[i].dst, writes[i].src, writes[i].len); + sceKernelCpuUnrestrictedMemcpy(writes[i].dst, writes[i].src, writes[i].len); } else { - ksceKernelRxMemcpyKernelToUserForPid(pid, (uintptr_t)writes[i].dst, writes[i].src, writes[i].len); + sceKernelRxMemcpyKernelToUserForPid(pid, (uintptr_t)writes[i].dst, writes[i].src, writes[i].len); } cache_flush(pid, (uintptr_t)writes[i].dst, writes[i].len); } -- cgit v1.2.3