PSPSDK 2026-01-22
Loading...
Searching...
No Matches
psploadcore.h
Go to the documentation of this file.
1/*
2 * PSP Software Development Kit - https://github.com/pspdev
3 * -----------------------------------------------------------------------
4 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5 *
6 * psploadcore.h - Interface to LoadCoreForKernel.
7 *
8 * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
9 * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
10 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
11 *
12 */
13
14#ifndef PSPLOADCORE_H
15#define PSPLOADCORE_H
16
17#include <pspkerneltypes.h>
18#include <pspmoduleinfo.h>
19
23#ifdef __cplusplus
24extern "C" {
25#endif
26
30#define SCE_KERNEL_MAX_MODULE_SEGMENT (4)
31
33typedef s32 (*SceKernelRebootBeforeForKernel)(void *arg1, s32 arg2, s32 arg3, s32 arg4);
34typedef s32 (*SceKernelRebootPhaseForKernel)(s32 arg1, void *arg2, s32 arg3, s32 arg4);
35
53
76
199
200typedef struct {
201 char *name;
202 void *buf;
203 int size;
205 int attr;
210
213typedef struct SceLibraryEntryTable {
215 const char * libname;
217 unsigned char version[2];
219 unsigned short attribute;
221 unsigned char len;
223 unsigned char vstubcount;
225 unsigned short stubcount;
230
233typedef struct SceLibraryStubTable {
234 /* The name of the library we're importing from. */
235 const char * libname;
237 unsigned char version[2];
238 /* Import attributes. */
239 unsigned short attribute;
241 unsigned char len;
243 unsigned char vstubcount;
245 unsigned short stubcount;
247 unsigned int * nidtable;
249 void * stubtable;
253
354
355
364
373
382
389
394
406
420
431int sceKernelGetModuleIdListForKernel(SceUID *mod_id_list, u32 size, u32 *mod_count, u32 user_mods_only);
432
433
434int sceKernelCheckPspConfig(void *buf, int size, int flag);
435
438#ifdef __cplusplus
439}
440#endif
441
442#endif /* PSPLOADCORE_H */
int sceKernelProbeExecutableObject(void *buf, SceLoadCoreExecFileInfo *execInfo)
Probe an executable file.
int sceKernelCheckExecFile(void *buf, SceLoadCoreExecFileInfo *execInfo)
Check an executable file.
struct SceLibraryEntryTable SceLibraryEntryTable
Defines a library and its exported functions and variables.
void sceKernelIcacheClearAll(void)
Invalidate the CPU's instruction cache.
s32(* SceKernelRebootBeforeForKernel)(void *arg1, s32 arg2, s32 arg3, s32 arg4)
Reboot preparation functions.
Definition psploadcore.h:33
s32(* SceKernelRebootPhaseForKernel)(s32 arg1, void *arg2, s32 arg3, s32 arg4)
Definition psploadcore.h:34
int sceKernelGetModuleIdListForKernel(SceUID *mod_id_list, u32 size, u32 *mod_count, u32 user_mods_only)
Receive a list of UIDs of loaded modules.
SceModule * sceKernelFindModuleByName(const char *modname)
Find a module by it's name.
SceModule * sceKernelFindModuleByAddress(unsigned int addr)
Find a module from an address.
int sceKernelCheckPspConfig(void *buf, int size, int flag)
SceModulePrivilegeLevel
Module Privilege Levels - These levels define the permissions a module can have.
Definition psploadcore.h:58
int sceKernelModuleCount(void)
Return the count of loaded modules.
SceModule * sceKernelFindModuleByUID(SceUID modid)
Find a module by it's UID.
struct SceLoadCoreExecFileInfo SceLoadCoreExecFileInfo
struct SceModule SceModule
Describes a loaded module in memory.
#define SCE_KERNEL_MAX_MODULE_SEGMENT
Definition psploadcore.h:30
SceModuleAttribute
Module type attributes.
Definition psploadcore.h:37
struct SceLibraryStubTable SceLibraryStubTable
Specifies a library and a set of imports from that library.
@ SCE_MODULE_KIRK_MEMLMD_LIB
The module uses KIRK's memlmd resident library.
Definition psploadcore.h:72
@ SCE_MODULE_VSH
VSH module.
Definition psploadcore.h:68
@ SCE_MODULE_MS
POPS/Demo.
Definition psploadcore.h:62
@ SCE_MODULE_APP
Application module.
Definition psploadcore.h:66
@ SCE_MODULE_USER
Lowest permission.
Definition psploadcore.h:60
@ SCE_MODULE_USB_WLAN
Module Gamesharing.
Definition psploadcore.h:64
@ SCE_MODULE_KERNEL
Highest permission.
Definition psploadcore.h:70
@ SCE_MODULE_KIRK_SEMAPHORE_LIB
The module uses KIRK's semaphore resident library.
Definition psploadcore.h:74
@ SCE_MODULE_ATTR_NONE
No module attributes.
Definition psploadcore.h:39
@ SCE_MODULE_ATTR_EXCLUSIVE_LOAD
Only one instance of the module (one version) can be loaded into the system.
Definition psploadcore.h:46
@ SCE_MODULE_ATTR_CANT_STOP
Resident module - stays in memory.
Definition psploadcore.h:41
@ SCE_MODULE_ATTR_EXCLUSIVE_START
Only one instance of the module (one version) can be started.
Definition psploadcore.h:51
unsigned int SceUInt
Definition pspkerneltypes.h:31
int SceUID
UIDs are used to describe many different kernel objects.
Definition pspkerneltypes.h:24
unsigned int SceSize
Definition psptypes.h:103
uint8_t u8
Definition psptypes.h:38
uint16_t u16
Definition psptypes.h:39
int32_t s32
Definition psptypes.h:47
int(* SceKernelThreadEntry)(SceSize args, void *argp)
Definition psptypes.h:431
uint32_t u32
Definition psptypes.h:41
Defines a library and its exported functions and variables.
Definition psploadcore.h:213
unsigned short attribute
Library attributes.
Definition psploadcore.h:219
void * entrytable
Pointer to the entry table; an array of NIDs followed by pointers to functions and variables.
Definition psploadcore.h:228
unsigned char vstubcount
The number of variables exported by the library.
Definition psploadcore.h:223
unsigned short stubcount
The number of functions exported by the library.
Definition psploadcore.h:225
unsigned char version[2]
Library version.
Definition psploadcore.h:217
unsigned char len
Length of this entry table in 32-bit WORDs.
Definition psploadcore.h:221
const char * libname
The library's name.
Definition psploadcore.h:215
Specifies a library and a set of imports from that library.
Definition psploadcore.h:233
unsigned char version[2]
Minimum required version of the library we want to import.
Definition psploadcore.h:237
const char * libname
Definition psploadcore.h:235
unsigned short stubcount
The number of functions imported from the library.
Definition psploadcore.h:245
void * vstubtable
Pointer to the imported variable stubs.
Definition psploadcore.h:251
unsigned short attribute
Definition psploadcore.h:239
unsigned char len
Length of this stub table in 32-bit WORDs.
Definition psploadcore.h:241
unsigned int * nidtable
Pointer to an array of NIDs.
Definition psploadcore.h:247
void * stubtable
Pointer to the imported function stubs.
Definition psploadcore.h:249
unsigned char vstubcount
The number of variables imported from the library.
Definition psploadcore.h:243
Definition psploadcore.h:200
int attr
Definition psploadcore.h:205
char * name
Definition psploadcore.h:201
int unk_20
Definition psploadcore.h:206
int argSize
Definition psploadcore.h:207
int size
Definition psploadcore.h:203
int argPartId
Definition psploadcore.h:208
void * buf
Definition psploadcore.h:202
int unk_12
Definition psploadcore.h:204
Definition psploadcore.h:254
u32 is_decompressed
Indicates whether the module is decompressed or not.
Definition psploadcore.h:318
u8 padding[3]
Reserved.
Definition psploadcore.h:342
void * imports_info
Pointer to the first stub library entry table of the module.
Definition psploadcore.h:334
u32 entry_addr
The entry address of the module.
Definition psploadcore.h:279
u8 num_segments
The number of segments in the executable.
Definition psploadcore.h:340
SceSize data_size
The size of the DATA segment.
Definition psploadcore.h:290
u16 mod_info_attribute
The module's attributes.
Definition psploadcore.h:312
u32 max_seg_align
The largest value of the segment_align array.
Definition psploadcore.h:352
u32 segment_size[(4)]
An array containing the size of each segment.
Definition psploadcore.h:346
u32 partition_id
The memory partition of the executable.
Definition psploadcore.h:294
void * strtab_offset
Pointer to the string table section.
Definition psploadcore.h:338
SceSize dec_size
The size of the decompressed module, including its headers.
Definition psploadcore.h:316
u32 unk104
Unknown.
Definition psploadcore.h:326
SceSize text_size
The size of the TEXT segment.
Definition psploadcore.h:288
void * exports_info
Pointer to the first resident library entry table of the module.
Definition psploadcore.h:330
void * file_base
Pointer to the compressed module data.
Definition psploadcore.h:270
u32 segment_addr[(4)]
An array containing the start address of each segment.
Definition psploadcore.h:344
SceSize imports_size
The size of all stub library entry tables of the module.
Definition psploadcore.h:336
SceUID mem_block_id
The ID of the ELF memory block containing the TEXT, DATA and BSS segment.
Definition psploadcore.h:348
u32 unk44
Unknown.
Definition psploadcore.h:281
SceSize exports_size
The size of all resident library entry tables of the module.
Definition psploadcore.h:332
u32 is_compressed
Indicates whether the module is compressed or not.
Definition psploadcore.h:310
u32 is_sign_checked
Indicates whether the module was signChecked or not.
Definition psploadcore.h:324
SceSize overlap_size
The size of the GZIP compression overlap.
Definition psploadcore.h:328
u32 unk12
Unknown.
Definition psploadcore.h:262
u32 segment_align[(4)]
An array containing the alignment information of each segment.
Definition psploadcore.h:350
SceSize largest_seg_size
The size of the largest module segment.
Definition psploadcore.h:286
void * top_addr
The start address of the TEXT segment of the executable in memory.
Definition psploadcore.h:274
u32 module_info_offset
The offset from the start address of the TEXT segment to the SceModuleInfo section.
Definition psploadcore.h:306
u32 unk0
Unknown.
Definition psploadcore.h:256
u16 exec_attribute
The attributes of the executable file.
Definition psploadcore.h:314
SceSize exec_size
The size of the executable, including the ~PSP header.
Definition psploadcore.h:264
SceUID decompression_mem_id
The memory ID of the decompression buffer.
Definition psploadcore.h:268
SceSize bss_size
The size of the BSS segment.
Definition psploadcore.h:292
u32 api_type
The API type.
Definition psploadcore.h:260
u32 elf_type
Indicates the ELF type of the executable.
Definition psploadcore.h:272
u32 is_kernel_mod
Indicates whether the executable is a kernel module or not.
Definition psploadcore.h:299
SceSize max_alloc_size
The maximum size needed for the decompression.
Definition psploadcore.h:266
u32 is_decrypted
Indicates whether the executable is decrypted or not.
Definition psploadcore.h:304
SceModuleInfo * module_info
The pointer to the module's SceModuleInfo section.
Definition psploadcore.h:308
u32 mode_attr
The mode attribute of the executable file.
Definition psploadcore.h:258
Describes a loaded module in memory.
Definition psploadcore.h:78
u32 segmentaddr[4]
An array containing the start address of each segment.
Definition psploadcore.h:163
SceUInt module_stop_thread_attr
The attributes of the module stop thread.
Definition psploadcore.h:179
char terminal
String terminator (always '\0').
Definition psploadcore.h:91
u32 text_addr
The start address of the TEXT segment.
Definition psploadcore.h:151
SceUID modid
The module's UID.
Definition psploadcore.h:101
u32 bss_size
The size of the BSS segment.
Definition psploadcore.h:157
SceUID mem_id
The ID of the memory block belonging to the module.
Definition psploadcore.h:105
SceSize ent_size
The size of all resident library entry tables of the module.
Definition psploadcore.h:113
u16 mod_state
The status of the module.
Definition psploadcore.h:96
u32 text_size
The size of the TEXT segment.
Definition psploadcore.h:153
u32 text_segment_checksum
TEXT segment checksum of the module.
Definition psploadcore.h:191
SceKernelThreadEntry module_bootstart
A pointer to a module's Bootstart entry function.
Definition psploadcore.h:132
char modname[27]
The module's name.
Definition psploadcore.h:89
u32 count_reg_val
The value of the coprocessor 0's count register when the module is created.
Definition psploadcore.h:187
SceKernelRebootBeforeForKernel module_reboot_before
A pointer to a module's rebootBefore entry function.
Definition psploadcore.h:137
u32 mpid_data
The ID of the DATA segment's memory partition.
Definition psploadcore.h:109
u8 padding2[3]
Reserved.
Definition psploadcore.h:161
u32 data_size
The size of the DATA segment.
Definition psploadcore.h:155
SceSize module_reboot_before_thread_stacksize
The stack size of the module reboot before thread.
Definition psploadcore.h:183
SceUInt module_reboot_before_thread_attr
The attributes of the module reboot before thread.
Definition psploadcore.h:185
void * stub_top
Pointer to the first stub library entry table of the module.
Definition psploadcore.h:115
u32 segmentalign[4]
An array containing the alignment information of each segment.
Definition psploadcore.h:167
SceUInt module_start_thread_attr
The attributes of the module start thread.
Definition psploadcore.h:173
s32 module_reboot_before_thread_priority
The priority of the module reboot before thread.
Definition psploadcore.h:181
SceSize stub_size
The size of all stub library entry tables of the module.
Definition psploadcore.h:117
u32 mpid_text
The ID of the TEXT segment's memory partition.
Definition psploadcore.h:107
u16 attribute
The attributes of a module.
Definition psploadcore.h:82
u32 gp_value
Contains the offset from the start of the TEXT segment of the program's GP register value.
Definition psploadcore.h:149
u32 segment_checksum
The segment checksum of the module's segments.
Definition psploadcore.h:189
SceUID sec_id
A secondary ID for the module.
Definition psploadcore.h:99
s32 module_start_thread_priority
The priority of the module start thread.
Definition psploadcore.h:169
SceSize segmentsize[4]
An array containing the size of each segment.
Definition psploadcore.h:165
SceKernelRebootPhaseForKernel module_reboot_phase
A pointer to a module's rebootPhase entry function.
Definition psploadcore.h:142
s32 module_stop_thread_priority
The priority of the module stop thread.
Definition psploadcore.h:175
SceSize module_start_thread_stacksize
The stack size of the module start thread.
Definition psploadcore.h:171
struct SceModule * next
Pointer to the next registered module.
Definition psploadcore.h:80
u8 nsegment
The number of segments the module consists of.
Definition psploadcore.h:159
u32 compute_text_segment_checksum
Whether to compute the text segment checksum before starting the module (see prologue).
Definition psploadcore.h:197
SceUID user_mod_thid
The thread ID of a user module.
Definition psploadcore.h:103
SceKernelThreadEntry module_start
A pointer to the (required) module's start entry function.
Definition psploadcore.h:122
void * ent_top
Pointer to the first resident library entry table of the module.
Definition psploadcore.h:111
SceKernelThreadEntry module_stop
A pointer to the (required) module's stop entry function.
Definition psploadcore.h:127
u32 entry_addr
The entry address of the module.
Definition psploadcore.h:147
u8 version[2]
The version of the module.
Definition psploadcore.h:87
SceSize module_stop_thread_stacksize
The stack size of the module stop thread.
Definition psploadcore.h:177
char padding[2]
Definition psploadcore.h:97
Definition pspmoduleinfo.h:21