|
enum | SceExecFileAttr { SCE_EXEC_FILE_COMPRESSED = 0x1
, SCE_EXEC_FILE_ELF = 0x2
, SCE_EXEC_FILE_GZIP_OVERLAP = 0x8
, SCE_EXEC_FILE_KL4E_COMPRESSED = 0x200
} |
|
enum | SceExecFileModeAttr { SCE_EXEC_FILE_DECRYPT = 0
, SCE_EXEC_FILE_NO_HEADER_COMPRESSION = 1
, SCE_EXEC_FILE_NO_COMPRESSION = 2
} |
|
enum | SceExecFileElfType { SCE_EXEC_FILE_TYPE_INVALID_ELF = -1
, SCE_EXEC_FILE_TYPE_PRX = 1
, SCE_EXEC_FILE_TYPE_PRX_2 = 2
, SCE_EXEC_FILE_TYPE_ELF = 3
} |
|
enum | SceLibAttr {
SCE_LIB_NO_SPECIAL_ATTR = 0x0
, SCE_LIB_AUTO_EXPORT = 0x1
, SCE_LIB_WEAK_EXPORT = 0x2
, SCE_LIB_NOLINK_EXPORT = 0x4
,
SCE_LIB_WEAK_IMPORT = 0x8
, SCE_LIB_SYSCALL_EXPORT = 0x4000
, SCE_LIB_IS_SYSLIB = 0x8000
} |
|
|
s32 | sceKernelRegisterLibrary (SceResidentLibraryEntryTable *libEntryTable) |
|
s32 | sceKernelCanReleaseLibrary (SceResidentLibraryEntryTable *libEntryTable) |
|
s32 | sceKernelLinkLibraryEntries (SceStubLibraryEntryTable *libStubTable, u32 size) |
|
s32 | sceKernelUnlinkLibraryEntries (SceStubLibraryEntryTable *libStubTable, u32 size) |
|
s32 | sceKernelLoadModuleBootLoadCore (SceLoadCoreBootModuleInfo *bootModInfo, SceLoadCoreExecFileInfo *execInfo, SceUID *modMemId) |
|
s32 | sceKernelLoadCoreLock (void) |
|
void | sceKernelLoadCoreUnlock (s32 intrState) |
|
s32 | sceKernelRegisterLibraryForUser (SceResidentLibraryEntryTable *libEntryTable) |
|
s32 | sceKernelReleaseLibrary (SceResidentLibraryEntryTable *libEntryTable) |
|
s32 | sceKernelLinkLibraryEntriesForUser (SceStubLibraryEntryTable *libStubTable, u32 size) |
|
s32 | sceKernelLinkLibraryEntriesWithModule (SceModule *mod, SceStubLibraryEntryTable *libStubTable, u32 size) |
|
u32 | sceKernelMaskLibraryEntries (void) |
|
SceLoadCore * | sceKernelQueryLoadCoreCB (void) |
|
s32 | sceKernelSetBootCallbackLevel (SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *status) |
|
u32 | sceKernelLoadCoreMode (void) |
|
s32 | sceKernelCheckPspConfig (u8 *file, u32 size) |
|
s32 | sceKernelLoadRebootBin (u8 *file, u32 size) |
|
s32 | sceKernelSegmentChecksum (SceModule *mod) |
|
s32 | sceKernelCheckExecFile (u8 *buf, SceLoadCoreExecFileInfo *execInfo) |
|
s32 | sceKernelProbeExecutableObject (u8 *buf, SceLoadCoreExecFileInfo *execInfo) |
|
s32 | sceKernelLoadExecutableObject (u8 *buf, SceLoadCoreExecFileInfo *execInfo) |
|
SceModule * | sceKernelCreateModule (void) |
|
s32 | sceKernelAssignModule (SceModule *mod, SceLoadCoreExecFileInfo *execFileInfo) |
|
s32 | sceKernelReleaseModule (SceModule *mod) |
|
s32 | sceKernelGetModuleIdListForKernel (SceUID *modIdList, u32 size, u32 *modCount, u32 userModsOnly) |
|
SceModule * | sceKernelGetModuleFromUID (SceUID uid) |
|
s32 | sceKernelDeleteModule (SceModule *mod) |
|
SceModule * | sceKernelCreateAssignModule (SceLoadCoreExecFileInfo *execFileInfo) |
|
s32 | sceKernelRegisterModule (SceModule *mod) |
|
SceModule * | sceKernelFindModuleByName (const char *name) |
|
SceModule * | sceKernelFindModuleByAddress (u32 addr) |
|
s32 | sceKernelGetModuleGPByAddressForKernel (u32 addr) |
|
SceModule * | sceKernelFindModuleByUID (SceUID uid) |
|
SceUID | sceKernelGetModuleListWithAlloc (u32 *modCount) |
|
Copyright (C) 2011, 2012, 2013 The uOFW team See the file COPYING for copying permission.
Module loader and library import/export manager.
◆ LIBRARY_VERSION_MINOR
#define LIBRARY_VERSION_MINOR (0) |
Library number category minor.
◆ LIBRARY_VERSION_MAJOR
#define LIBRARY_VERSION_MAJOR (1) |
Library number category major.
◆ LIBRARY_VERSION_NUMBER_CATEGORY_SIZE
#define LIBRARY_VERSION_NUMBER_CATEGORY_SIZE (2) |
Current number category size for libraries.
◆ LIBRARY_ENTRY_TABLE_OLD_LEN
#define LIBRARY_ENTRY_TABLE_OLD_LEN (4) |
The length of the old resident library entry table format (without the members unk16 - uk19).
◆ LIBRARY_ENTRY_TABLE_NEW_LEN
#define LIBRARY_ENTRY_TABLE_NEW_LEN (5) |
The length of the new resident library entry table format (including the members unk16 - unk19).
◆ STUB_LIBRARY_ENTRY_TABLE_OLD_LEN
#define STUB_LIBRARY_ENTRY_TABLE_OLD_LEN (6) |
The length of the old stub library entry table format (without the member unk24).
◆ STUB_LIBRARY_ENTRY_TABLE_NEW_LEN
#define STUB_LIBRARY_ENTRY_TABLE_NEW_LEN (7) |
The length of the new stub library entry table format (including the member unk24).
◆ LOADCORE_LIB_HASH_TABLE_SIZE
#define LOADCORE_LIB_HASH_TABLE_SIZE (128) |
The possible number of libraries with different hash values.
◆ SCE_BOOT_CALLBACK_FUNCTION_QUEUED
#define SCE_BOOT_CALLBACK_FUNCTION_QUEUED (1) |
Indicates that a boot callback function was added to the internal boot callback queue.
◆ SCE_PROTECT_INFO_STATE_IS_ALLOCATED
#define SCE_PROTECT_INFO_STATE_IS_ALLOCATED (1 << 0) |
The protected information block is allocated.
◆ SCE_PROTECT_INFO_TYPE_FILE_NAME
#define SCE_PROTECT_INFO_TYPE_FILE_NAME (0x2) |
Indicates the type of the protected information block is a file name.
◆ SCE_PROTECT_INFO_TYPE_VSH_PARAM
#define SCE_PROTECT_INFO_TYPE_VSH_PARAM (0x4) |
Indicates the type of the protected information block is a VSH param.
◆ SCE_PROTECT_INFO_TYPE_DISC_IMAGE
#define SCE_PROTECT_INFO_TYPE_DISC_IMAGE (0x40) |
Indicates the type of the protected information block is a disc image.
◆ SCE_PROTECT_INFO_TYPE_NPDRM_DATA
#define SCE_PROTECT_INFO_TYPE_NPDRM_DATA (0x80) |
Indicates protected information block belongs to a NPDRM package.
◆ SCE_PROTECT_INFO_TYPE_USER_PARAM
#define SCE_PROTECT_INFO_TYPE_USER_PARAM (0x100) |
Indicates the type of the protected information block is a user param.
◆ SCE_PROTECT_INFO_TYPE_PARAM_SFO
#define SCE_PROTECT_INFO_TYPE_PARAM_SFO (0x400) |
Indicates the type of the protected information block is a param.sfo.
◆ GET_PROTECT_INFO_STATE
#define GET_PROTECT_INFO_STATE |
( |
|
attr | ) |
((u32)(attr) >> 16) |
Get the state of a protected information block.
- Parameters
-
◆ SET_PROTECT_INFO_STATE
#define SET_PROTECT_INFO_STATE |
( |
|
state, |
|
|
|
src |
|
) |
| (((state) << 16) | (src)) |
Set a new state of a protected information block.
- Parameters
-
◆ REMOVE_PROTECT_INFO_STATE
#define REMOVE_PROTECT_INFO_STATE |
( |
|
state, |
|
|
|
src |
|
) |
| ((~((state) << 16)) & (src)) |
Remove a state entry of a protected information block.
- Parameters
-
◆ GET_PROTECT_INFO_TYPE
#define GET_PROTECT_INFO_TYPE |
( |
|
attr | ) |
((attr) & 0xFFFF) |
Get the type of a protected information block.
- Parameters
-
◆ SET_PROTECT_INFO_TYPE
#define SET_PROTECT_INFO_TYPE |
( |
|
type, |
|
|
|
src |
|
) |
| (((type) & 0xFFFF) | (src)) |
Set the type of a protected information block.
- Parameters
-
◆ SCE_MODULE_USER_MODULE
#define SCE_MODULE_USER_MODULE (0x100) |
◆ GET_MCB_STATUS
#define GET_MCB_STATUS |
( |
|
status | ) |
(status & 0xF) |
◆ SceKernelBootCallbackFunction
typedef s32(* SceKernelBootCallbackFunction) (void *data, s32 arg, void *opt) |
◆ SceKernelRebootBeforeForKernel
typedef s32(* SceKernelRebootBeforeForKernel) (void *arg1, s32 arg2, s32 arg3, s32 arg4) |
Reboot preparation functions
◆ SceStubLibrary
This structure represents a stub library control block. This control block is used to manage a stub library entry table internal.
◆ SceResidentLibrary
This structure represents a resident library control block. This control block is used to manage a resident library entry table registered to the system.
◆ SceModule
The SceModule structure represents a loaded module in memory.
◆ SceSyscallTable
This structure represents a system call table. Such a table takes care of the exported system calls registered to the system.
◆ SceExecFileAttr
Executable File Attributes.
Enumerator |
---|
SCE_EXEC_FILE_COMPRESSED | The file is compressed. If SCE_EXEC_FILE_KL4E_COMPRESSED is not set, the file is GZIP compressed.
|
SCE_EXEC_FILE_ELF | The file is a static ELF.
|
SCE_EXEC_FILE_GZIP_OVERLAP | The file has GZIP overlap.
|
SCE_EXEC_FILE_KL4E_COMPRESSED | The file is KL4E compressed.
|
◆ SceExecFileModeAttr
Executable File Mode Attributes.
Enumerator |
---|
SCE_EXEC_FILE_DECRYPT | The file is decrypted.
|
SCE_EXEC_FILE_NO_HEADER_COMPRESSION | The file header is not compressed.
|
SCE_EXEC_FILE_NO_COMPRESSION | The file is not compressed.
|
◆ SceExecFileElfType
The possible ELF type of an executable.
Enumerator |
---|
SCE_EXEC_FILE_TYPE_INVALID_ELF | The executable file is not an ELF. Such a file cannot be loaded.
|
SCE_EXEC_FILE_TYPE_PRX | The executable file is a PRX, a relocatable ELF.
|
SCE_EXEC_FILE_TYPE_PRX_2 | The executable file is a PRX, a relocatable ELF.
|
SCE_EXEC_FILE_TYPE_ELF | The executable file is a static ELF.
|
◆ SceLibAttr
Resident/Stub library attributes. Several members can be bitwise OR'ed together. Every library needs to have at least one of those attributes. Resident libraries can have the members SCE_LIB_AUTO_EXPORT, SCE_LIB_WEAK_EXPORT, (SCE_LIB_NOLINK_EXPORT), SCE_LIB_SYSCALL_EXPORT and SCE_LIB_IS_SYSLIB. Stub libraries can have SCE_LIB_NO_SPECIAL_ATTR or SCE_LIB_WEAK_IMPORT.
Enumerator |
---|
SCE_LIB_NO_SPECIAL_ATTR | The library has no special attributes.
|
SCE_LIB_AUTO_EXPORT | Automatically register the library to the system.
|
SCE_LIB_WEAK_EXPORT | Indicates resident library can be overwritten.
|
SCE_LIB_NOLINK_EXPORT | Indicates resident library is NOT being linked.
|
SCE_LIB_WEAK_IMPORT | Load module that references this library even if this library is not registered.
|
SCE_LIB_SYSCALL_EXPORT | Indicates the use of the SYSCALL technique for linking.
|
SCE_LIB_IS_SYSLIB | The library is a system library (a mandatory library for all modules).
|
◆ sceKernelRegisterLibrary()
Register a resident library's entry table in the system. A resident module can register any number of resident libraries. Note that this function is only meant to register kernel mode resident libraries. In order to register user mode libraries, use sceKernelRegisterLibraryForUser().
- Parameters
-
libEntryTable | Pointer to the resident library's entry table. |
- Returns
- 0 on success.
◆ sceKernelCanReleaseLibrary()
Check if a resident library can be released. This check returns "true" when all corresponding stub libraries at the time of the check have one the following status: a) unlinked b) have the the attribute SCE_LIB_WEAK_IMPORT (they can exist without the resident library being registered).
- Parameters
-
libEntryTable | Pointer to the resident library's entry table. |
- Returns
- 0 indicates the library can be released.
◆ sceKernelLinkLibraryEntries()
Link kernel mode stub libraries with the corresponding registered resident libraries. Note that this function assumes that the resident libraries linked with reside in kernel memory. Linking with user mode resident libraries will result in failure.
- Parameters
-
libStubTable | Pointer to a stub library's entry table. If you want to link an array of entry tables, make libStubTable a pointer to the first element of that array. |
size | The number of entry tables to link. |
- Returns
- 0 on success.
◆ sceKernelUnlinkLibraryEntries()
Unlink stub libraries from their corresponding registered resident libraries.
- Parameters
-
libStubTable | Pointer to a stub library's entry table. If you want to unlink an array of entry tables, make libStubTable a pointer to the first element of that array. |
size | The number of entry tables to unlink. |
- Returns
◆ sceKernelLoadModuleBootLoadCore()
Load a module. This function is used to boot modules during the start of Loadcore. In order for a module to be loaded, it has to be a kernel module.
- Parameters
-
bootModInfo | Pointer to module information (including the file content of the module, its size,...) used to boot the module. |
execInfo | Pointer an allocated execInfo structure used to handle load-checks against the program module. Furthermore, it collects various information about the module, such as its elfType, its segments (.text, .data, .bss), the locations of its exported functions. |
modMemId | The memory id of the allocated kernelPRX memory block used for the program module sections. The memory block specified by the ID holds the .text segment of the module. |
- Returns
- 0 on success.
◆ sceKernelLoadCoreLock()
s32 sceKernelLoadCoreLock |
( |
void |
| ) |
|
Save interrupts state and disable all interrupts.
- Returns
- The current state of the interrupt controller. Use sceKernelLoadCoreUnlock() to return to that state.
◆ sceKernelLoadCoreUnlock()
void sceKernelLoadCoreUnlock |
( |
s32 |
intrState | ) |
|
Return interrupt state.
- Parameters
-
◆ sceKernelRegisterLibraryForUser()
Register a user mode resident library's entry table in the system. A resident module can register any number of resident libraries. In order to register kernel mode libraries, use sceKernelRegisterLibrary().
Restrictions on user mode resident libraries: 1) The resident library has to live in user memory. 2) Functions cannot be exported via the SYSCALL technique. 3) The resident library cannot be linked with stub libraries living in kernel memory.
- Parameters
-
libEntryTable | Pointer to the resident library's entry table. |
- Returns
- 0 on success.
◆ sceKernelReleaseLibrary()
Delete a registered resident library from the system. Deletion cannot be performed if there are loaded modules using the resident library. These modules must be deleted first.
- Parameters
-
libEntryTable | Pointer to the resident library's entry table. |
- Returns
- 0 on success.
◆ sceKernelLinkLibraryEntriesForUser()
- Parameters
-
libStubTable | Pointer to a stub library's entry table. If you want to link an array of entry tables, make libStubTable a pointer to the first element of that array. |
size | The number of entry tables to link. |
- Returns
- 0 on success.
◆ sceKernelLinkLibraryEntriesWithModule()
- Parameters
-
mod | Pointer to a module. Should not be NULL. The module seems not to be used for anything useful. |
libStubTable | Pointer to a stub library's entry table. If you want to link an array of entry tables, make libStubTable a pointer to the first element of that array. |
size | The number of entry tables to link. |
- Returns
- 0 on success.
◆ sceKernelMaskLibraryEntries()
u32 sceKernelMaskLibraryEntries |
( |
void |
| ) |
|
Does nothing but a simple return.
- Returns
- 0.
◆ sceKernelQueryLoadCoreCB()
Get Loadcore's control block. The block takes care of the registered libraries, the unlinked stub libraries living in memory and the currently loaded modules.
- Returns
- A pointer to Loadcore's internal control block.
◆ sceKernelSetBootCallbackLevel()
Set a boot callback. Call this function during a module boot process.
- Parameters
-
bootCBFunc | The boot callback function to execute once the important system modules (up to init.prx) have been booted. |
flag | Defines the execute order of the callbacks. Pass 0 for earliest execution, 3 for latest. 1 and 2 are between these two. |
status | The returned status of bootCBFunc in case it was executed directly. |
- Returns
- 0 for directly executing the boot callback function. 1 indicates boot callback function was enqueued into other existing boot callbacks and will be called after init.prx got booted.
◆ sceKernelLoadCoreMode()
u32 sceKernelLoadCoreMode |
( |
void |
| ) |
|
Does nothing but a simple return, probably a debug function.
- Returns
- 0.
◆ sceKernelCheckPspConfig()
s32 sceKernelCheckPspConfig |
( |
u8 * |
file, |
|
|
u32 |
size |
|
) |
| |
Check and decrypt a PSP configuration file.
- Parameters
-
file | The configuration file (i.e. pspbtcnf.bin) to decrypt. |
size | The size of the file. |
- Returns
- The size of the decrypted file on success.
◆ sceKernelLoadRebootBin()
s32 sceKernelLoadRebootBin |
( |
u8 * |
file, |
|
|
u32 |
size |
|
) |
| |
Decrypt and load a reboot file used to boot the system. Reboot.bin is only used for kernel reboots (warm reboots only).
- Parameters
-
file | The reboot file to use (i.e. reboot.bin). |
size | The size of the file |
- Returns
- 0 on success.
◆ sceKernelSegmentChecksum()
s32 sceKernelSegmentChecksum |
( |
SceModule * |
mod | ) |
|
Compute a checksum of every segment of a module.
- Parameters
-
mod | The module to create the checksum for. |
- Returns
- The checksum. Shouldn't be 0.
◆ sceKernelCheckExecFile()
Check an executable file. This contains scanning its ELF header and ~PSP header (if it has one) and filling the execInfo structure with basic information, like the ELF type, segment information, the size of the executable. The file is also uncompressed, if it was compressed before.
- Parameters
-
buf | Pointer to the file's contents. |
execInfo | Pointer to the executionInfo belonging to that executable. |
- Returns
- 0 on success.
◆ sceKernelProbeExecutableObject()
Probe an executable file. This contains calculating the sizes for the three segments TEXT, DATA and BSS, filling the execInfo structure with information about the location and sizes of the resident/stub library entry tables. Furthermore, it is checked whether the executable has valid API type or not.
- Parameters
-
buf | Pointer to the file's contents. |
execInfo | Pointer to the executionInfo belonging to that executable. |
- Returns
- 0 on success.
◆ sceKernelLoadExecutableObject()
Load an executable file. This contains allocating s memory block containing the three segments TEXT, DATA and BSS (in case the executable consists of only these three sections). Furthermore, relocation of the executable file, if needed, is also taken care off.
- Parameters
-
buf | Pointer to the file's contents. |
execInfo | Pointer to the executionInfo belonging to that executable. |
- Returns
- 0 on success.
◆ sceKernelCreateModule()
Allocate memory for a new SceModule structure and fill it with default values. This function is called during the loading process of a module.
- Returns
- A pointer to the allocated SceModule structure on success, otherwise NULL.
◆ sceKernelAssignModule()
Assign a module and check if it can be loaded, is a valid module and copy the moduleInfo section of the execution file over to the SceModule structure.
- Parameters
-
mod | The module to receive the moduleInfo section data based on the provided execution file information. |
execFileInfo | The execution file information used to copy over the moduleInfo section for the specified module. |
- Returns
- 0 on success.
◆ sceKernelReleaseModule()
s32 sceKernelReleaseModule |
( |
SceModule * |
mod | ) |
|
Unlink a module from the internal loaded-modules-linked-list. The module has to be stopped before.
- Parameters
-
mod | The module to release. |
- Returns
- 0 on success.
◆ sceKernelGetModuleIdListForKernel()
s32 sceKernelGetModuleIdListForKernel |
( |
SceUID * |
modIdList, |
|
|
u32 |
size, |
|
|
u32 * |
modCount, |
|
|
u32 |
userModsOnly |
|
) |
| |
Receive a list of UIDs of loaded modules.
- Parameters
-
modIdList | Pointer to a SceUID array which will receive the UIDs of the loaded modules. |
size | Size of modIdList. Specifies the number of entries that can be stored into modIdList. |
modCount | A pointer which will receive the total number of loaded modules. |
userModsOnly | Set to 1 to only receive UIDs from user mode modules. Set to 0 to receive UIDs from all loaded modules. |
- Returns
- 0 on success.
◆ sceKernelGetModuleFromUID()
SceModule * sceKernelGetModuleFromUID |
( |
SceUID |
uid | ) |
|
Get a loaded module from its UID.
- Parameters
-
uid | The UID (of a module) to check for. |
- Returns
- Pointer to the found SceModule structure on success, otherwise NULL.
◆ sceKernelDeleteModule()
Delete a module from the system. The module has to be stopped and released before.
- Parameters
-
- Returns
- 0 on success.
◆ sceKernelCreateAssignModule()
Create and assign a module. It provides the same result as a sceKernelCreateModule() call followed by a sceKernelAssignModule() call.
- Parameters
-
execFileInfo | The execution file information used to copy over the moduleInfo section for the specified module. |
- Returns
- Pointer to the created SceModule structure on success, otherwise NULL.
◆ sceKernelRegisterModule()
s32 sceKernelRegisterModule |
( |
SceModule * |
mod | ) |
|
Register a module in the system and link it into the internal loaded-modules-linked-list.
- Parameters
-
mod | The module to register. |
- Returns
- 0.
◆ sceKernelFindModuleByName()
SceModule * sceKernelFindModuleByName |
( |
const char * |
name | ) |
|
Find a loaded module by its name. If more than one module with the same name is loaded, return the module which was loaded last.
- Parameters
-
name | The name of the module to find. |
- Returns
- Pointer to the found SceModule structure on success, otherwise NULL.
◆ sceKernelFindModuleByAddress()
SceModule * sceKernelFindModuleByAddress |
( |
u32 |
addr | ) |
|
Find a loaded module containing the specified address.
- Parameters
-
addr | Memory address belonging to the module, i.e. the address of a function/global variable within the module. |
- Returns
- Pointer to the found SceModule structure on success, otherwise NULL.
◆ sceKernelGetModuleGPByAddressForKernel()
s32 sceKernelGetModuleGPByAddressForKernel |
( |
u32 |
addr | ) |
|
Get the global pointer value of a module.
- Parameters
-
addr | Memory address belonging to the module, i.e. the address of a function/global variable within the module. |
- Returns
- The global pointer value (greater than 0) of the found module on success.
◆ sceKernelFindModuleByUID()
SceModule * sceKernelFindModuleByUID |
( |
SceUID |
uid | ) |
|
Find a loaded module by its UID.
- Parameters
-
uid | The UID of the module to find. |
- Returns
- Pointer to the found SceModule structure on success, otherwise NULL.
◆ sceKernelGetModuleListWithAlloc()
SceUID sceKernelGetModuleListWithAlloc |
( |
u32 * |
modCount | ) |
|
Receive a list of UIDs of all loaded modules.
- Parameters
-
modCount | A pointer which will receive the total number of loaded modules. |
- Returns
- The UID of the allocated array containing UIDs of the loaded modules on success. It should be greater than 0.