diff options
author | Reiko Asakura | 2020-09-14 20:50:22 -0400 |
---|---|---|
committer | Reiko Asakura | 2020-09-14 20:50:22 -0400 |
commit | 2428d5e52368aa174ad228c7f23da843fb728ef3 (patch) | |
tree | f5007577e14969e1b75108ab329548544fb04efa /include | |
parent | Add noreturn attribute to sceClibAbort (diff) | |
parent | Revert vitasdk commits (diff) | |
download | vds-libraries-2428d5e52368aa174ad228c7f23da843fb728ef3.tar.gz |
Merge Vitasdk
Diffstat (limited to 'include')
-rw-r--r-- | include/kernel/kernel/cpu.h | 53 | ||||
-rw-r--r-- | include/kernel/kernel/proc_event.h | 73 | ||||
-rw-r--r-- | include/user/kernel/threadmgr.h | 23 |
3 files changed, 112 insertions, 37 deletions
diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index ec2f14e..b53cb10 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -3,6 +3,7 @@ #include <psp2common/kernel/cpu.h> #include <psp2kern/types.h> +#include <string.h> #ifdef __cplusplus extern "C" { @@ -35,10 +36,8 @@ extern "C" { * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheWritebackRange(const void *ptr, SceSize len); /** @@ -92,15 +91,13 @@ static inline int sceKernelCpuUnrestrictedMemcpy(void *dst, const void *src, Sce { int prev_dacr; - asm ("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr)); - asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000)); + asm volatile("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr)); + asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000)); - for (size_t i=0; i < len; i++) { - ((char *) dst)[i] = ((char *) src)[i]; - } + memcpy(dst, src, len); sceKernelCpuDcacheWritebackRange((void *)((uintptr_t)dst & ~0x1F), (len + 0x1F) & ~0x1F); - asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr)); + asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr)); return 0; } @@ -132,61 +129,47 @@ int sceKernelCpuEnableInterrupts(int flags); * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheInvalidateRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache (without L2) * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheWritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheInvalidateAll(void); +void sceKernelCpuDcacheInvalidateAll(void); /** * @brief Writeback all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackAll(void); +void sceKernelCpuDcacheWritebackAll(void); /** * @brief Writeback and invalidate all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackInvalidateAll(void); +void sceKernelCpuDcacheWritebackInvalidateAll(void); /** * @brief Writeback a range of L1 dcache and L2 * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheAndL2WritebackRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2WritebackRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache and L2 * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache and L2 @@ -196,17 +179,15 @@ int sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); * * @return Zero on success */ -int sceKernelCpuDcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate a range of L1 icache (without L2) * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuIcacheInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuIcacheInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate all the L1 icache (without L2) @@ -220,10 +201,8 @@ int sceKernelCpuIcacheInvalidateAll(void); * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuIcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuIcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Suspend all interrupts (disables IRQs) diff --git a/include/kernel/kernel/proc_event.h b/include/kernel/kernel/proc_event.h new file mode 100644 index 0000000..37af5f9 --- /dev/null +++ b/include/kernel/kernel/proc_event.h @@ -0,0 +1,73 @@ +#ifndef _PSP2_KERNEL_PROC_EVENT_H_ +#define _PSP2_KERNEL_PROC_EVENT_H_ + +#include <psp2kern/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SceProcEventInvokeParam1 { + SceSize size; // SceProcEventInvokeParam1 struct size : 0x10 + int unk_0x04; + int unk_0x08; + int unk_0x0C; +} SceProcEventInvokeParam1; + +typedef struct SceProcEventInvokeParam2 { + SceSize size; // SceProcEventInvokeParam2 struct size : 0x14 + SceUID pid; + int unk_0x08; + int unk_0x0C; + int unk_0x10; +} SceProcEventInvokeParam2; + +typedef struct SceProcEventHandler { + SceSize size; // SceProcEventHandler struct size : 0x1C + int (* create)(SceUID pid, SceProcEventInvokeParam2 *a2, int a3); + int (* exit)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3); // current process exit + int (* kill)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3); // by SceShell + int (* stop)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4); + int (* start)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4); + int (* switch_process)(int event_id, int event_type, SceProcEventInvokeParam2 *a3, int a4); // switch display frame? +} SceProcEventHandler; + +/** + * Register process event handler + * + * @param[in] name - Name of handler + * @param[in] handler - The pointer of handler + * @param[in] a3 - unknown, set to 0 + * + * @return uid on success, < 0 on error. + */ +SceUID sceKernelRegisterProcEventHandler(const char *name, const SceProcEventHandler *handler, int a3); + +/** + * Unregister process event handler + * + * @param[in] uid - ProcEvent uid + * + * @return uid on success, < 0 on error. + */ +int sceKernelUnregisterProcEventHandler(SceUID uid); + +/** + * Invoke process event handler + * + * @param[in] pid - The ProccessId + * @param[in] event_id - event_id, [1, 2, 3, 4, 5, 0x10, 0x11] + * @param[in] event_type - Various event types + * @param[in] param - The pointer of invoke parameter + * @param[in] a5 - Unknown + * @param[in] a6 - Unknown + * + * @return uid on success, < 0 on error. + */ +int sceKernelInvokeProcEventHandler(SceUID pid, int event_id, int event_type, void *param, void *a5, int a6); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_PROC_EVENT_H_ */ diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h index ccc44da..f2840d6 100644 --- a/include/user/kernel/threadmgr.h +++ b/include/user/kernel/threadmgr.h @@ -1552,6 +1552,29 @@ SceInt32 sceKernelGetLwCondInfo (SceKernelLwCondWork *pWork, SceKernelLwCondInfo SceInt32 sceKernelGetLwCondInfoById(SceUID lwCondId, SceKernelLwCondInfo *pInfo); +typedef struct SceKernelWaitSignalOptParam { + SceUInt32 unk; +} SceKernelWaitSignalOptParam; + +/** + * @brief Sleep current thread and wait for a signal. After it receives a signal, the thread wakes up. + * + * This is like a semphore with limit 1. + * If signal was sent before and not consumed before, the function will immediately return. + * + * @param params - extra parameters + * @return 0 on success + */ +int sceKernelWaitSignal(SceUInt32 unk0, SceUInt32 unk1, SceKernelWaitSignalOptParam *params); + +/** + * @brief Send a signal to another thread specified by thid. + * + * @param thid - the id of the thread to send a signal to + * @return 0 on success + * @return SCE_KERNEL_ERROR_ALREADY_SENT if the last signal was not consumed by sceKernelWaitSignal + */ +int sceKernelSendSignal(SceUID thid); /** * Get the system time (wide version) |