@@ -26,32 +26,178 @@ extern "C" {
2626/** @addtogroup LoadCore Interface to the LoadCoreForKernel library. */
2727/**@{*/
2828
29- /** Describes a module. This structure could change in future firmware revisions. */
29+ #ifndef __THREADMAN_H__
30+ typedef s32 (* SceKernelThreadEntry )(SceSize args , void * argp );
31+ #endif
32+
33+
34+ /** Reboot preparation functions */
35+ typedef s32 (* SceKernelRebootBeforeForKernel )(void * arg1 , s32 arg2 , s32 arg3 , s32 arg4 );
36+ typedef s32 (* SceKernelRebootPhaseForKernel )(s32 arg1 , void * arg2 , s32 arg3 , s32 arg4 );
37+
38+ /** Module type attributes. */
39+ enum SceModuleAttribute {
40+ /** No module attributes. */
41+ SCE_MODULE_ATTR_NONE = 0x0000 ,
42+ /** Resident module - stays in memory. You cannot unload such a module. */
43+ SCE_MODULE_ATTR_CANT_STOP = 0x0001 ,
44+ /**
45+ * Only one instance of the module (one version) can be loaded into the system. If you want to load another
46+ * version of that module, you have to delete the loaded version first.
47+ */
48+ SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002 ,
49+ /**
50+ * Only one instance of the module (one version) can be started. If you want to start another
51+ * version of that module, you have to stop the currently running version first.
52+ */
53+ SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004 ,
54+ };
55+
56+ /**
57+ * Module Privilege Levels - These levels define the permissions a
58+ * module can have.
59+ */
60+ enum SceModulePrivilegeLevel {
61+ /** Lowest permission. */
62+ SCE_MODULE_USER = 0x0000 ,
63+ /** POPS/Demo. */
64+ SCE_MODULE_MS = 0x0200 ,
65+ /** Module Gamesharing. */
66+ SCE_MODULE_USB_WLAN = 0x0400 ,
67+ /** Application module. */
68+ SCE_MODULE_APP = 0x0600 ,
69+ /** VSH module. */
70+ SCE_MODULE_VSH = 0x0800 ,
71+ /** Highest permission. */
72+ SCE_MODULE_KERNEL = 0x1000 ,
73+ /** The module uses KIRK's memlmd resident library. */
74+ SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000 ,
75+ /** The module uses KIRK's semaphore resident library. */
76+ SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000 ,
77+ };
78+
79+ /** Describes a loaded module in memory. This structure could change in future firmware revisions. */
3080typedef struct SceModule {
31- struct SceModule * next ;
32- unsigned short attribute ;
33- unsigned char version [2 ];
34- char modname [27 ];
35- char terminal ;
36- unsigned int unknown1 ;
37- unsigned int unknown2 ;
38- SceUID modid ;
39- unsigned int unknown3 [4 ];
40- void * ent_top ;
41- unsigned int ent_size ;
42- void * stub_top ;
43- unsigned int stub_size ;
44- unsigned int unknown4 [4 ];
45- unsigned int entry_addr ;
46- unsigned int gp_value ;
47- unsigned int text_addr ;
48- unsigned int text_size ;
49- unsigned int data_size ;
50- unsigned int bss_size ;
51- unsigned int nsegment ;
52- unsigned int segmentaddr [4 ];
53- unsigned int segmentsize [4 ];
54- } __attribute__((packed )) SceModule ;
81+ /** Pointer to the next registered module. Modules are connected via a linked list. */
82+ struct SceModule * next ;
83+ /** The attributes of a module. One or more of ::SceModuleAttribute and ::SceModulePrivilegeLevel. */
84+ u16 attribute ;
85+ /**
86+ * The version of the module. Consists of a major and minor part. There can be several modules
87+ * loaded with the same name and version.
88+ */
89+ u8 version [2 ];
90+ /** The module's name. There can be several modules loaded with the same name. */
91+ char modname [27 ];
92+ /** String terminator (always '\0'). */
93+ char terminal ;
94+ /**
95+ * The status of the module. Contains information whether the module has been started, stopped,
96+ * is a user module, etc.
97+ */
98+ u16 mod_state ;
99+ char padding [2 ];
100+ /** A secondary ID for the module. */
101+ SceUID sec_id ;
102+ /** The module's UID. */
103+ SceUID modid ;
104+ /** The thread ID of a user module. */
105+ SceUID user_mod_thid ;
106+ /** The ID of the memory block belonging to the module. */
107+ SceUID mem_id ;
108+ /** The ID of the TEXT segment's memory partition. */
109+ u32 mpid_text ;
110+ /** The ID of the DATA segment's memory partition. */
111+ u32 mpid_data ;
112+ /** Pointer to the first resident library entry table of the module. */
113+ void * ent_top ;
114+ /** The size of all resident library entry tables of the module. */
115+ SceSize ent_size ;
116+ /** Pointer to the first stub library entry table of the module. */
117+ void * stub_top ;
118+ /** The size of all stub library entry tables of the module. */
119+ SceSize stub_size ;
120+ /**
121+ * A pointer to the (required) module's start entry function. This function is executed during
122+ * the module's startup.
123+ */
124+ SceKernelThreadEntry module_start ;
125+ /**
126+ * A pointer to the (required) module's stop entry function. This function is executed during
127+ * the module's stopping phase.
128+ */
129+ SceKernelThreadEntry module_stop ;
130+ /**
131+ * A pointer to a module's Bootstart entry function. This function is probably executed after
132+ * a reboot.
133+ */
134+ SceKernelThreadEntry module_bootstart ;
135+ /**
136+ * A pointer to a module's rebootBefore entry function. This function is probably executed
137+ * before a reboot.
138+ */
139+ SceKernelRebootBeforeForKernel module_reboot_before ;
140+ /**
141+ * A pointer to a module's rebootPhase entry function. This function is probably executed
142+ * during a reboot.
143+ */
144+ SceKernelRebootPhaseForKernel module_reboot_phase ;
145+ /**
146+ * The entry address of the module. It is the offset from the start of the TEXT segment to the
147+ * program's entry point.
148+ */
149+ u32 entry_addr ;
150+ /** Contains the offset from the start of the TEXT segment of the program's GP register value. */
151+ u32 gp_value ;
152+ /** The start address of the TEXT segment. */
153+ u32 text_addr ;
154+ /** The size of the TEXT segment. */
155+ u32 text_size ;
156+ /** The size of the DATA segment. */
157+ u32 data_size ;
158+ /** The size of the BSS segment. */
159+ u32 bss_size ;
160+ /** The number of segments the module consists of. */
161+ u8 nsegment ;
162+ /** Reserved. */
163+ u8 padding2 [3 ];
164+ /** An array containing the start address of each segment. */
165+ u32 segmentaddr [4 ];
166+ /** An array containing the size of each segment. */
167+ SceSize segmentsize [4 ];
168+ /** An array containing the alignment information of each segment. */
169+ u32 segmentalign [4 ];
170+ /** The priority of the module start thread. */
171+ s32 module_start_thread_priority ;
172+ /** The stack size of the module start thread. */
173+ SceSize module_start_thread_stacksize ;
174+ /** The attributes of the module start thread. */
175+ SceUInt module_start_thread_attr ;
176+ /** The priority of the module stop thread. */
177+ s32 module_stop_thread_priority ;
178+ /** The stack size of the module stop thread. */
179+ SceSize module_stop_thread_stacksize ;
180+ /** The attributes of the module stop thread. */
181+ SceUInt module_stop_thread_attr ;
182+ /** The priority of the module reboot before thread. */
183+ s32 module_reboot_before_thread_priority ;
184+ /** The stack size of the module reboot before thread. */
185+ SceSize module_reboot_before_thread_stacksize ;
186+ /** The attributes of the module reboot before thread. */
187+ SceUInt module_reboot_before_thread_attr ;
188+ /** The value of the coprocessor 0's count register when the module is created. */
189+ u32 count_reg_val ;
190+ /** The segment checksum of the module's segments. */
191+ u32 segment_checksum ;
192+ /** TEXT segment checksum of the module. */
193+ u32 text_segment_checksum ;
194+ /**
195+ * Whether to compute the text segment checksum before starting the module (see prologue).
196+ * If non-zero, the text segment checksum will be computed after the module's resident libraries
197+ * have been registered, and its stub libraries have been linked.
198+ */
199+ u32 compute_text_segment_checksum ;
200+ } SceModule ;
55201
56202/** Defines a library and its exported functions and variables. Use the len
57203 member to determine the real size of the table (size = len * 4). */
0 commit comments