summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/kernel/kernel/sysmem.h106
-rw-r--r--include/kernel/kernel/sysmem/debug.h55
-rw-r--r--include/kernel/kernel/sysmem/sysroot.h75
3 files changed, 134 insertions, 102 deletions
diff --git a/include/kernel/kernel/sysmem.h b/include/kernel/kernel/sysmem.h
index 45d15e8..4f5ca6c 100644
--- a/include/kernel/kernel/sysmem.h
+++ b/include/kernel/kernel/sysmem.h
@@ -7,12 +7,10 @@
#include_next <kernel/sysmem.h>
-#include <stddef.h>
-#include <stdint.h>
+#include <kernel/sysmem/debug.h>
+#include <kernel/sysmem/sysroot.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+SCE_CDECL_BEGIN
#define SCE_KERNEL_MEMBLOCK_TYPE_SHARED_RX 0x0390D050
#define SCE_KERNEL_MEMBLOCK_TYPE_USER_RX 0x0C20D050
@@ -140,18 +138,6 @@ typedef struct SceKernelProcessContext {
SceUInt32 CONTEXTIDR;
} SceKernelProcessContext;
-typedef enum SceKernelSysrootSelfIndex {
- SCE_KERNEL_SYSROOT_SELF_INDEX_GCAUTHMGR_SM = 0,
- SCE_KERNEL_SYSROOT_SELF_INDEX_RMAUTH_SM = 1,
- SCE_KERNEL_SYSROOT_SELF_INDEX_ENCDEC_W_PORTABILITY_SM = 2
-} SceKernelSysrootSelfIndex;
-
-typedef struct SceKernelSysrootSelfInfo {
- uint32_t size;
- void *self_data;
- uint32_t self_size;
-} SceKernelSysrootSelfInfo;
-
/**
* Gets the memory block type of a memory block
*
@@ -247,12 +233,9 @@ int sceKernelDeleteUserUid(SceUID pid, SceUID user_uid);
int sceKernelDeleteUid(SceUID uid);
int sceKernelFindClassByName(const char *name, SceClass **cls);
-void *sceKernelGetSysrootBuffer(void);
int sceKernelGetPidContext(SceUID pid, SceKernelProcessContext **ctx);
int sceKernelSwitchPidContext(SceKernelProcessContext *ctx, SceKernelProcessContext *current_ctx);
-int sceKernelGetProcessTitleId(SceUID pid, char *titleid, SceSize len);
-
int sceKernelMapBlockUserVisible(SceUID uid);
int sceKernelMapUserBlock(const char *name, int permission, int type,
const void *user_buf, SceSize size, void **kernel_page,
@@ -264,8 +247,6 @@ int sceKernelMapUserBlockDefaultTypeForPid(int pid, const char *name, int permis
const void *user_buf, SceSize size, void **kernel_page,
SceSize *kernel_size, unsigned int *kernel_offset);
-int sceSysrootGetSelfInfo(SceKernelSysrootSelfIndex index, SceKernelSysrootSelfInfo *info);
-
/**
* Get the physical address of a given virtual address
*
@@ -385,85 +366,6 @@ int sceKernelMemRangeReleaseForPid(SceUID pid, void *addr, SceSize size);
*/
int sceKernelMemRangeReleaseWithPerm(SceKernelMemoryRefPerm perm, void *addr, SceSize size);
-int sceSysrootUseExternalStorage(void);
-
-#define sceSysrootIsManufacturingMode() sceSysrootUseExternalStorage()
-
-int sceSysrootUseInternalStorage(void);
-
-__attribute__((__format__(__printf__, 1, 2)))
-int sceDebugPrintf(const char *fmt, ...);
-
-typedef struct SceKernelDebugMessageContext {
- int hex_value0_hi;
- int hex_value0_lo;
- int hex_value1;
- char *msg0;
- SceSize num;
- char *msg1;
-} SceKernelDebugMessageContext;
-
-// msg_type_flag : 0 or 0xB
-__attribute__((__format__(__printf__, 3, 4)))
-int sceDebugPrintf2(int msg_type_flag, const SceKernelDebugMessageContext *ctx, const char *fmt, ...);
-
-int sceDebugVprintf(const char *fmt, va_list args);
-
-int sceDebugPrintKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address);
-
-__attribute__((__format__(__printf__, 3, 4)))
-int sceDebugPrintfKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address, const char *fmt, ...);
-
-int sceDebugPrintKernelAssertion(int condition, const SceKernelDebugMessageContext *ctx, void *some_address);
-
-__attribute__((__format__(__printf__, 5, 6)))
-int sceDebugPrintfKernelAssertion(int unk, int condition, const SceKernelDebugMessageContext *ctx, int some_address, const char *fmt, ...);
-
-int sceDebugSetHandlers(int (*func)(int unk, const char *format, const va_list args), void *args);
-
-int sceDebugRegisterPutcharHandler(int (*func)(void *args, char c), void *args);
-
-void *sceDebugGetPutcharHandler(void);
-
-int sceDebugPutchar(int character);
-
-int sceDebugDisableInfoDump(int flag);
-
-typedef struct
-{
- size_t size; //!< sizeof(SceSysrootProcessHandler)
- int (* unk_4)(void);
- int (* unk_8)(void);
- int (* unk_C)(void);
- int (* unk_10)(void);
- int (* unk_14)(void);
- int (* unk_18)(void);
- int (* on_process_created)(void); //!< called when process is created
- int (* unk_20)(void);
- int (* unk_24)(void);
-} SceSysrootProcessHandler;
-
-/**
- * Set handlers for the process lifecycle.
- *
- * This internal function allows a developer to introspect and receive events based
- * on the process lifecycle.
- *
- * @param[in] handlers Pointer to struct containing the handlers. This function does not copy the handlers, so this pointer must remain valid after a successful call.
- *
- * @return 0 on success, < 0 on error.
- */
-int sceKernelSysrootSetProcessHandler(const SceSysrootProcessHandler *handlers);
-
-/**
- * Get the process UID of shell.
- *
- * @return UID or -1 if shell is not started.
- */
-SceUID sceKernelSysrootGetShellPid(void);
-
-#ifdef __cplusplus
-}
-#endif
+SCE_CDECL_END
#endif /* _VDSUITE_KERNEL_KERNEL_SYSMEM_H */
diff --git a/include/kernel/kernel/sysmem/debug.h b/include/kernel/kernel/sysmem/debug.h
new file mode 100644
index 0000000..5d5335b
--- /dev/null
+++ b/include/kernel/kernel/sysmem/debug.h
@@ -0,0 +1,55 @@
+/*
+ Vita Development Suite Libraries
+*/
+
+#ifndef _VDSUITE_KERNEL_KERNEL_SYSMEM_DEBUG_H
+#define _VDSUITE_KERNEL_KERNEL_SYSMEM_DEBUG_H
+
+#include <stdarg.h>
+
+#include <cdefs.h>
+#include <scetypes.h>
+
+SCE_CDECL_BEGIN
+
+__attribute__((__format__(__printf__, 1, 2)))
+int sceDebugPrintf(const char *fmt, ...);
+
+typedef struct SceKernelDebugMessageContext {
+ int hex_value0_hi;
+ int hex_value0_lo;
+ int hex_value1;
+ char *msg0;
+ SceSize num;
+ char *msg1;
+} SceKernelDebugMessageContext;
+
+// msg_type_flag : 0 or 0xB
+__attribute__((__format__(__printf__, 3, 4)))
+int sceDebugPrintf2(int msg_type_flag, const SceKernelDebugMessageContext *ctx, const char *fmt, ...);
+
+int sceDebugVprintf(const char *fmt, va_list args);
+
+int sceDebugPrintKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address);
+
+__attribute__((__format__(__printf__, 3, 4)))
+int sceDebugPrintfKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address, const char *fmt, ...);
+
+int sceDebugPrintKernelAssertion(int condition, const SceKernelDebugMessageContext *ctx, void *some_address);
+
+__attribute__((__format__(__printf__, 5, 6)))
+int sceDebugPrintfKernelAssertion(int unk, int condition, const SceKernelDebugMessageContext *ctx, int some_address, const char *fmt, ...);
+
+int sceDebugSetHandlers(int (*func)(int unk, const char *format, const va_list args), void *args);
+
+int sceDebugRegisterPutcharHandler(int (*func)(void *args, char c), void *args);
+
+void *sceDebugGetPutcharHandler(void);
+
+int sceDebugPutchar(int character);
+
+int sceDebugDisableInfoDump(int flag);
+
+SCE_CDECL_END
+
+#endif /* _VDSUITE_KERNEL_KERNEL_SYSMEM_DEBUG_H */
diff --git a/include/kernel/kernel/sysmem/sysroot.h b/include/kernel/kernel/sysmem/sysroot.h
new file mode 100644
index 0000000..f59546e
--- /dev/null
+++ b/include/kernel/kernel/sysmem/sysroot.h
@@ -0,0 +1,75 @@
+/*
+ Vita Development Suite Libraries
+*/
+
+#ifndef _VDSUITE_KERNEL_KERNEL_SYSMEM_SYSROOT_H
+#define _VDSUITE_KERNEL_KERNEL_SYSMEM_SYSROOT_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <cdefs.h>
+#include <scetypes.h>
+
+SCE_CDECL_BEGIN
+
+typedef enum SceKernelSysrootSelfIndex {
+ SCE_KERNEL_SYSROOT_SELF_INDEX_GCAUTHMGR_SM = 0,
+ SCE_KERNEL_SYSROOT_SELF_INDEX_RMAUTH_SM = 1,
+ SCE_KERNEL_SYSROOT_SELF_INDEX_ENCDEC_W_PORTABILITY_SM = 2
+} SceKernelSysrootSelfIndex;
+
+typedef struct SceKernelSysrootSelfInfo {
+ uint32_t size;
+ void *self_data;
+ uint32_t self_size;
+} SceKernelSysrootSelfInfo;
+
+void *sceKernelGetSysrootBuffer(void);
+
+int sceKernelGetProcessTitleId(SceUID pid, char *titleid, SceSize len);
+
+int sceSysrootGetSelfInfo(SceKernelSysrootSelfIndex index, SceKernelSysrootSelfInfo *info);
+
+int sceSysrootUseExternalStorage(void);
+
+#define sceSysrootIsManufacturingMode() sceSysrootUseExternalStorage()
+
+int sceSysrootUseInternalStorage(void);
+
+typedef struct
+{
+ size_t size; //!< sizeof(SceSysrootProcessHandler)
+ int (* unk_4)(void);
+ int (* unk_8)(void);
+ int (* unk_C)(void);
+ int (* unk_10)(void);
+ int (* unk_14)(void);
+ int (* unk_18)(void);
+ int (* on_process_created)(void); //!< called when process is created
+ int (* unk_20)(void);
+ int (* unk_24)(void);
+} SceSysrootProcessHandler;
+
+/**
+ * Set handlers for the process lifecycle.
+ *
+ * This internal function allows a developer to introspect and receive events based
+ * on the process lifecycle.
+ *
+ * @param[in] handlers Pointer to struct containing the handlers. This function does not copy the handlers, so this pointer must remain valid after a successful call.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelSysrootSetProcessHandler(const SceSysrootProcessHandler *handlers);
+
+/**
+ * Get the process UID of shell.
+ *
+ * @return UID or -1 if shell is not started.
+ */
+SceUID sceKernelSysrootGetShellPid(void);
+
+SCE_CDECL_END
+
+#endif /* _VDSUITE_KERNEL_KERNEL_SYSMEM_SYSROOT_H */