summaryrefslogtreecommitdiff
path: root/include/kernel
diff options
context:
space:
mode:
authorPrincess of Sleeping2019-10-06 15:31:06 +0900
committerSunguk Lee2019-10-06 15:31:06 +0900
commit2bbc0b511606eaf35a5c32985d7c68c25b73a796 (patch)
treeac5b42cc35590e71b209ed4fce4e3478a4803866 /include/kernel
parentMerge pull request #426 from Princess-of-Sleeping/master (diff)
downloadvds-libraries-2bbc0b511606eaf35a5c32985d7c68c25b73a796.tar.gz
psp2kern: Added some function and description of the modulemgr (#427)
* Added some function and description * update ksceKernelGetModuleInfoMinByAddr * update ksceKernelGetModuleInfoMinByAddr * fix SceKernelModuleName
Diffstat (limited to 'include/kernel')
-rw-r--r--include/kernel/kernel/modulemgr.h354
1 files changed, 320 insertions, 34 deletions
diff --git a/include/kernel/kernel/modulemgr.h b/include/kernel/kernel/modulemgr.h
index 3432b3d..5b8c53f 100644
--- a/include/kernel/kernel/modulemgr.h
+++ b/include/kernel/kernel/modulemgr.h
@@ -21,6 +21,8 @@ extern "C" {
#define SCE_KERNEL_STOP_CANCEL SCE_KERNEL_STOP_FAIL
/** @} */
+typedef char SceKernelModuleName[0x1C];
+
typedef struct
{
SceUInt size; //!< this structure size (0x18)
@@ -127,42 +129,37 @@ typedef struct {
SceUID modid2;
} SceKernelModuleInfo2;
-int sceKernelGetModuleList(SceUID pid, int flags1, int flags2, SceUID *modids, size_t *num);
-int sceKernelGetModuleInfo(SceUID pid, SceUID modid, SceKernelModuleInfo *info);
-int sceKernelGetModuleInternal(SceUID modid, void **module);
-
-int sceKernelGetSystemSwVersion(SceKernelFwInfo *data);
-
-SceUID sceKernelLoadModule(const char *path, int flags, SceKernelLMOption *option);
-int sceKernelStartModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
-SceUID sceKernelLoadStartModule(const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
-
-int sceKernelUnloadModule(SceUID modid, int flags, SceKernelULMOption *option);
-int sceKernelStopModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
-int sceKernelStopUnloadModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
-
-SceUID sceKernelLoadModuleForPid(SceUID pid, const char *path, int flags, SceKernelLMOption *option);
-int sceKernelStartModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
-SceUID sceKernelLoadStartModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
-
-int sceKernelUnloadModuleForPid(SceUID pid, SceUID modid, int flags, SceKernelULMOption *option);
-int sceKernelStopModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
-int sceKernelStopUnloadModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
-
-SceUID sceKernelLoadStartSharedModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
-int sceKernelStopUnloadSharedModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
-
-int sceKernelMountBootfs(const char *bootImagePath);
-int sceKernelUmountBootfs(void);
+/**
+ * @brief Register syscall function
+ *
+ * @param[in] syscall_id - register syscall id (Must be less than 0x1000)
+ * @param[in] func - syscall function
+ *
+ * @return none
+ */
+void sceKernelRegisterSyscall(int syscall_id, const void *func);
-SceUID sceKernelSearchModuleByName(const char *module_name);
+/**
+ * @brief Setup kernel for modulemgr
+ *
+ * @note - allocate and initialize syscall table
+ *
+ * @return none
+ */
+void sceKernelSetupForModulemgr(void);
/**
- * @brief Get the main module for a given process.
- * @param pid The process to query.
- * @return the UID of the module else < 0 for an error.
+ * @brief Get module id list
+ *
+ * @param[in] pid - target pid
+ * @param[in] flags1 - unknown, use 0x7FFFFFFF
+ * @param[in] flags2 - unknown, use 1
+ * @param[out] modids - info output pointer
+ * @param[inout] num - in:list max num, out:get modid num
+ *
+ * @return 0 on success, < 0 on error.
*/
-SceUID sceKernelGetProcessMainModule(SceUID pid);
+int sceKernelGetModuleList(SceUID pid, int flags1, int flags2, SceUID *modids, size_t *num);
/**
* @par Example1: Get max to 10 kernel module info
@@ -195,18 +192,307 @@ SceUID sceKernelGetProcessMainModule(SceUID pid);
int sceKernelGetModuleList2(SceUID pid, SceKernelModuleListInfo *infolists, size_t *num);
/**
+ * @brief Get module info
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[out] info - info output pointer
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelGetModuleInfo(SceUID pid, SceUID modid, SceKernelModuleInfo *info);
+
+/**
+ * @brief Get module info2
+ *
* @param[in] pid - target pid
- * @param[in] modid - target modid
+ * @param[in] modid - target module id
* @param[out] info - info output
*
* @return 0 on success, < 0 on error.
*/
int sceKernelGetModuleInfo2(SceUID pid, SceUID modid, SceKernelModuleInfo2 *info);
+/**
+ * @brief Get module info mini by module address
+ *
+ * @param[in] pid - target pid
+ * @param[in] module_addr - target module address, Also possible with data segment address
+ * @param[out] module_nid - can also set NULL, module nid output
+ * @param[out] program_text_addr - can also set NULL, program text addr output
+ * @param[out] module_name - can also set NULL, module name output
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelGetModuleInfoMinByAddr(SceUID pid, const void *module_addr, uint32_t *module_nid, const void **program_text_addr, SceKernelModuleName *module_name);
+
+/**
+ * @brief Get module info (internal)
+ *
+ * @param[in] modid - target module id
+ * @param[out] module_info - module_info output pointer
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelGetModuleInternal(SceUID modid, void **module_info);
+
+/**
+ * @brief Get module id by module address
+ *
+ * @param[in] pid - target pid
+ * @param[in] module_addr - target module address
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelGetModuleIdByAddr(SceUID pid, const void *module_addr);
+
+/**
+ * @brief search kernel module by module name
+ *
+ * @param[in] module_name - target module name
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelSearchModuleByName(const char *module_name);
+
+/**
+ * @brief Get fw info
+ *
+ * @param[out] data - fw info output pointer
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelGetSystemSwVersion(SceKernelFwInfo *data);
+
+/**
+ * @brief load module (kernel only)
+ *
+ * @param[in] path - module path
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelLoadModule(const char *path, int flags, SceKernelLMOption *option);
+
+/**
+ * @brief start module (kernel only)
+ *
+ * @param[in] modid - target module id
+ * @param[in] args - module start args
+ * @param[in] argp - module start argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_start res, SCE_KERNEL_START_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStartModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
+
+/**
+ * @brief load and start module (kernel only)
+ *
+ * @param[in] path - module path
+ * @param[in] args - module start args
+ * @param[in] argp - module start argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_start res, SCE_KERNEL_START_SUCCESS etc...
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelLoadStartModule(const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
+
+/**
+ * @brief stop module (kernel only)
+ *
+ * @param[in] modid - target module id
+ * @param[in] args - module stop args
+ * @param[in] argp - module stop argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_stop res, SCE_KERNEL_STOP_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStopModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
+
+/**
+ * @brief unload module (kernel only)
+ *
+ * @param[in] modid - target module id
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelUnloadModule(SceUID modid, int flags, SceKernelULMOption *option);
+
+/**
+ * @brief stop and unload module (kernel only)
+ *
+ * @param[in] modid - target module id
+ * @param[in] args - module stop args
+ * @param[in] argp - module stop argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_stop res, SCE_KERNEL_STOP_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStopUnloadModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
+
+/**
+ * @brief load module
+ *
+ * @param[in] pid - target pid
+ * @param[in] path - module path
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelLoadModuleForPid(SceUID pid, const char *path, int flags, SceKernelLMOption *option);
+
+/**
+ * @brief start module
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[in] args - module start args
+ * @param[in] argp - module start argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_start res, SCE_KERNEL_START_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStartModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
+
+/**
+ * @brief load and start module
+ *
+ * @param[in] pid - target pid
+ * @param[in] path - module path
+ * @param[in] args - module start args
+ * @param[in] argp - module start argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_start res, SCE_KERNEL_START_SUCCESS etc...
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelLoadStartModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
+
+/**
+ * @brief stop module
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[in] args - module stop args
+ * @param[in] argp - module stop argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_stop res, SCE_KERNEL_STOP_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStopModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
+
+/**
+ * @brief unload module
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelUnloadModuleForPid(SceUID pid, SceUID modid, int flags, SceKernelULMOption *option);
+
+/**
+ * @brief stop and unload module
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[in] args - module stop args
+ * @param[in] argp - module stop argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_stop res, SCE_KERNEL_STOP_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStopUnloadModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
+
+/**
+ * @brief load and start module as shared module
+ *
+ * @param[in] pid - target pid
+ * @param[in] path - module path
+ * @param[in] args - module start args
+ * @param[in] argp - module start argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_start res, SCE_KERNEL_START_SUCCESS etc...
+ *
+ * @return modid on success, < 0 on error.
+ */
+SceUID sceKernelLoadStartSharedModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
+
+/**
+ * @brief stop and unload module as shared module
+ *
+ * @param[in] pid - target pid
+ * @param[in] modid - target module id
+ * @param[in] args - module stop args
+ * @param[in] argp - module stop argp
+ * @param[in] flags - unknown, set zero
+ * @param[in] option - unknown
+ * @param[out] status - module_stop res, SCE_KERNEL_STOP_SUCCESS etc...
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelStopUnloadSharedModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
+
+/**
+ * @brief mount bootfs (load bootfs module)
+ *
+ * @param[in] bootImagePath - bootfs module path
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelMountBootfs(const char *bootImagePath);
+
+/**
+ * @brief unmount bootfs (unload bootfs module)
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelUmountBootfs(void);
+
+/**
+ * @brief Get the main module for a given process.
+ * @param pid The process to query.
+ * @return the UID of the module else < 0 for an error.
+ */
+SceUID sceKernelGetProcessMainModule(SceUID pid);
+
+/**
+ * @brief Get the main module path for a given process.
+ *
+ * @param[in] pid - target pid
+ * @param[out] path - module path output
+ * @param[in] pathlen - path output max len
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int sceKernelGetProcessMainModulePath(SceUID pid, char *path, int pathlen);
+
int sceKernelGetModuleLibraryInfo(SceUID pid, SceUID modid, void *unk1, const void *unk2, int unk3);
int sceKernelGetModuleUid(SceUID pid, SceUID modid, SceUID *modid_out, const void *unk1, int unk2);
int sceKernelGetModuleUidList(SceUID pid, SceUID *modids, size_t *num);
-int sceKernelGetProcessMainModulePath(SceUID pid, char *path, int pathlen);
#ifdef __cplusplus
}