Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 80 additions & 13 deletions src/kernel/pspmodulemgr_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,75 @@
#include <pspmodulemgr.h>

/** @defgroup ModuleMgrKern Kernel Module Manager Library
* This module contains the imports for the kernel's module management routines.
*/
* This module contains the imports for the kernel's module management routines.
*/

enum SceModuleMgrExecModes {
MODULE_EXEC_CMD_LOAD,
MODULE_EXEC_CMD_RELOCATE,
MODULE_EXEC_CMD_START,
MODULE_EXEC_CMD_STOP,
MODULE_EXEC_CMD_UNLOAD,
};

/**
* Structure used internally for many `sceModuleManager` module functions.
*
* Also seems to be passed to `sceKernelStartThread` eventually by those internal functions.
* */
typedef struct {
/** The Operation to start on. One of the `SceModuleMgrExecModes` modes. */
u8 mode_start;
/** The Operation to finish on. One of the `SceModuleMgrExecModes` modes. */
u8 mode_finish;
/** The module placement policy in memory. One of `PspSysMemBlockTypes`. */
u8 position;
u8 access;
SceUID *result;
SceUID *new_block_id;
/** The module in memory. */
SceModule *mod;
/** The executable information of the module. */
SceLoadCoreExecFileInfo *exec_info;
/** The API type of the module. */
u32 api_type;
/** The file ID for module file. */
SceUID fd;
/** The module thread priority. */
s32 thread_priority;
/** The module thread attributes. */
u32 thread_attr;
/** The memory partition where the program of the module will be stored. */
SceUID mpid_text;
/** The memory partition where the data of the module will be stored. */
SceUID mpid_data;
SceUID thread_mpid_stack;
SceSize stack_size;
/** The module ID. */
SceUID mod_id;
SceUID caller_mod_id;
SceSize mod_size;
void *file_base;
SceSize arg_size;
void *argp;
u32 unk1;
u32 unk2;
s32 *status;
SceUID event_id;
u32 unk3;
u32 unk4;
u32 unk5;
SceUID extern_mem_block_id_kernel;
SceUID extern_mem_block_partition_id;
SceSize extern_mem_block_size;
u32 unk6;
void *block_gzip;
u32 unk7;
char secure_install_id[SCE_SECURE_INSTALL_ID_LEN];
SceUID extern_mem_block_id_user;
u32 unk8;
SceOff mem_block_offset;
} SceModuleMgrParam;

#ifdef __cplusplus
extern "C" {
Expand All @@ -30,20 +97,20 @@ extern "C" {
/**@{*/

/**
* Gets the current module list.
*
* @param readbufsize - The size of the read buffer.
* @param readbuf - Pointer to a buffer to store the IDs
*
* @return < 0 on error.
*/
* Gets the current module list.
*
* @param readbufsize - The size of the read buffer.
* @param readbuf - Pointer to a buffer to store the IDs
*
* @return < 0 on error.
*/
int sceKernelGetModuleList(int readbufsize, SceUID *readbuf);

/**
* Get the number of loaded modules.
*
* @return The number of loaded modules.
*/
* Get the number of loaded modules.
*
* @return The number of loaded modules.
*/
int sceKernelModuleCount(void);

/**
Expand Down
2 changes: 2 additions & 0 deletions src/user/pspmodulemgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ extern "C" {
#define PSP_MEMORY_PARTITION_KERNEL 1
#define PSP_MEMORY_PARTITION_USER 2

#define SCE_SECURE_INSTALL_ID_LEN (16)

typedef struct SceKernelLMOption {
SceSize size;
SceUID mpidtext;
Expand Down