sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
loadcore.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
17
#ifndef __LOADCORE_H__
18
#define __LOADCORE_H__
19
20
#include <
types.h
>
21
#include <
irx.h
>
22
23
#define MODULE_RESIDENT_END 0
24
#define MODULE_NO_RESIDENT_END 1
25
#define MODULE_REMOVABLE_END 2
// Only for 'modload' > v1.2
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
32
typedef
struct
_ModuleInfo
{
33
struct
_ModuleInfo
*next;
34
char
*name;
35
u16 version;
37
u16
newflags
;
38
u16 id;
40
u16
flags
;
42
u32
entry
;
43
u32 gp;
44
u32 text_start;
45
u32 text_size;
46
u32 data_size;
47
u32 bss_size;
48
u32 unused1;
49
u32 unused2;
50
}
ModuleInfo_t
;
51
52
typedef
struct
_IopModuleID
{
53
const
char
*name;
54
unsigned
short
int
version;
55
} IopModuleID_t;
56
57
typedef
struct
_FileInfo
{
58
u32 ModuleType;
59
void
*EntryPoint;
60
void
*gp;
61
void
*text_start;
62
u32 text_size;
63
u32 data_size;
64
u32 bss_size;
65
u32 MemSize;
66
IopModuleID_t *mod_id;
67
} FileInfo_t;
68
69
typedef
struct
_iop_library
{
70
struct
_iop_library
*prev;
71
struct
irx_import_table
*caller;
72
u16 version;
73
u16 flags;
74
char
name[8];
75
void
*exports[];
76
} iop_library_t;
77
79
typedef
struct
tag_LC_internals
{
80
iop_library_t* let_next, *let_prev;
//let_next = tail, let_prev = head. I don't know what "let" and "mda" stand for.
81
iop_library_t* mda_next, *mda_prev;
83
ModuleInfo_t
*
image_info
;
84
int
module_count;
85
int
module_index;
86
/* The following members may change depending on the version of the module. */
87
void
*reboot_handlers;
88
void
*intr_suspend_tbl;
89
int
bootmodes[16];
90
int
bootmodes_size;
91
}
lc_internals_t
;
92
93
typedef
struct
{
94
u16 value;
95
u8 id;
96
u8 len;
97
u32 data[];
98
}
iop_bootmode_t
;
99
100
101
typedef
struct
{
//FIXME: Incomplete structure definition. Provided only for compatibility, as I don't know what the full structure is like.
102
void
*callback;
103
}
iop_init_entry_t
;
104
105
typedef
int (*BootupCallback_t)(
iop_init_entry_t
* next,
int
delayed);
106
110
typedef
struct
{
111
struct
_iop_library
*tail;
112
struct
_iop_library
*head;
113
}
iop_library_table_t
__attribute__
((deprecated));
114
118
extern
iop_library_table_t
*
GetLibraryEntryTable
(
void
)
__attribute__
((deprecated));
119
extern
lc_internals_t
*GetLoadcoreInternalData(
void
);
120
121
extern
void
FlushIcache(
void
);
122
extern
void
FlushDcache(
void
);
123
124
extern
int
RegisterLibraryEntries(
struct
irx_export_table
*exports);
125
extern
int
ReleaseLibraryEntries(
struct
irx_export_table
*exports);
126
127
// In liberx, the following is LinkLibraryClients
128
extern
int
LinkLibraryEntries(
void
* addr,
int
size);
129
// In liberx, the following is UnLinkLibraryClients
130
extern
int
UnLinkLibraryEntries(
void
* addr,
int
size);
131
132
extern
int
RegisterNonAutoLinkEntries(
struct
irx_export_table
*exports);
133
134
// In liberx, the following is SearchLibraryEntries
135
extern
void
*QueryLibraryEntryTable(iop_library_t *library);
136
extern
int
* QueryBootMode(
int
mode);
137
extern
void
RegisterBootMode(
iop_bootmode_t
*b);
138
139
extern
void
LockLibraryClient(
struct
irx_export_table
*export);
140
extern
void
UnLockLibraryClient(
struct
irx_export_table
*export);
141
142
extern
void
RegisterModule(
ModuleInfo_t
*mi);
143
extern
void
ReleaseModule(
ModuleInfo_t
*mi);
144
145
extern
int
AddRebootNotifyHandler(BootupCallback_t func,
int
priority,
int
*stat);
146
147
extern
void
SetCacheCtrl(u32 val);
148
149
extern
int
ProbeExecutableObject(
void
* image, FileInfo_t *result);
150
extern
int
LoadExecutableObject(
void
* image, FileInfo_t *fi);
151
extern
ModuleInfo_t
*SearchModuleCBByAddr(
void
* addr);
152
153
#define loadcore_IMPORTS \
154
loadcore_IMPORTS_start \
155
\
156
I_GetLibraryEntryTable \
157
\
158
I_FlushIcache \
159
I_FlushDcache \
160
\
161
I_RegisterLibraryEntries \
162
I_ReleaseLibraryEntries \
163
\
164
I_QueryLibraryEntryTable \
165
I_QueryBootMode \
166
\
167
loadcore_IMPORTS_end
168
169
#define loadcore_IMPORTS_start DECLARE_IMPORT_TABLE(loadcore, 1, 1)
170
#define loadcore_IMPORTS_end END_IMPORT_TABLE
171
172
#define I_GetLibraryEntryTable DECLARE_IMPORT(3, GetLibraryEntryTable)
173
#define I_GetLoadcoreInternalData DECLARE_IMPORT(3, GetLoadcoreInternalData)
174
#define I_FlushIcache DECLARE_IMPORT(4, FlushIcache)
175
#define I_FlushDcache DECLARE_IMPORT(5, FlushDcache)
176
#define I_RegisterLibraryEntries DECLARE_IMPORT(6, RegisterLibraryEntries)
177
#define I_ReleaseLibraryEntries DECLARE_IMPORT(7, ReleaseLibraryEntries)
178
#define I_LinkLibraryEntries DECLARE_IMPORT(8, LinkLibraryEntries)
179
#define I_UnLinkLibraryEntries DECLARE_IMPORT(9, UnLinkLibraryEntries)
180
#define I_RegisterNonAutoLinkEntries DECLARE_IMPORT(10, RegisterNonAutoLinkEntries)
181
#define I_QueryLibraryEntryTable DECLARE_IMPORT(11, QueryLibraryEntryTable)
182
#define I_QueryBootMode DECLARE_IMPORT(12, QueryBootMode)
183
#define I_RegisterBootMode DECLARE_IMPORT(13, RegisterBootMode)
184
#define I_LockLibraryClient DECLARE_IMPORT(14, LockLibraryClient)
185
#define I_UnLockLibraryClient DECLARE_IMPORT(15, UnLockLibraryClient)
186
#define I_RegisterModule DECLARE_IMPORT(16, RegisterModule)
187
#define I_ReleaseModule DECLARE_IMPORT(17, ReleaseModule)
188
#define I_AddRebootNotifyHandler DECLARE_IMPORT(20, AddRebootNotifyHandler)
189
#define I_SetCacheCtrl DECLARE_IMPORT(21, SetCacheCtrl)
190
#define I_ProbeExecutableObject DECLARE_IMPORT(22, ProbeExecutableObject)
191
#define I_LoadExecutableObject DECLARE_IMPORT(23, LoadExecutableObject)
192
#define I_SearchModuleCBByAddr DECLARE_IMPORT(24, SearchModuleCBByAddr)
193
194
// For backwards compatibility
195
#define LinkImports(...) LinkLibraryEntries(__VA_ARGS__)
196
#define UnlinkImports(...) UnLinkLibraryEntries(__VA_ARGS__)
197
#define SetNonAutoLinkFlag(...) LockLibraryClient(__VA_ARGS__)
198
#define UnsetNonAutoLinkFlag(...) UnLockLibraryClient(__VA_ARGS__)
199
#define LinkModule(...) RegisterModule(__VA_ARGS__)
200
#define UnlinkModule(...) ReleaseModule(__VA_ARGS__)
201
#define RegisterPostBootCallback(...) AddRebootNotifyHandler(__VA_ARGS__)
202
#define ReadModuleHeader(...) ProbeExecutableObject(__VA_ARGS__)
203
#define LoadModuleImage(...) LoadExecutableObject(__VA_ARGS__)
204
#define FindImageInfo(...) SearchModuleCBByAddr(__VA_ARGS__)
205
#define I_LinkImports I_LinkLibraryEntries
206
#define I_UnlinkImports I_UnLinkLibraryEntries
207
#define I_SetNonAutoLinkFlag I_LockLibraryClient
208
#define I_UnsetNonAutoLinkFlag I_UnLockLibraryClient
209
#define I_LinkModule I_RegisterModule
210
#define I_UnlinkModule I_ReleaseModule
211
#define I_RegisterPostBootCallback I_AddRebootNotifyHandler
212
#define I_ReadModuleHeader I_ProbeExecutableObject
213
#define I_LoadModuleImage I_LoadExecutableObject
214
#define I_FindImageInfo I_SearchModuleCBByAddr
215
216
#ifdef __cplusplus
217
}
218
#endif
219
220
#endif
/* __LOADCORE_H__ */
irx.h
ModuleInfo_t
struct _ModuleInfo ModuleInfo_t
lc_internals_t
struct tag_LC_internals lc_internals_t
GetLibraryEntryTable
iop_library_table_t * GetLibraryEntryTable(void) __attribute__((deprecated))
_FileInfo
Definition
loadcore.h:57
_IopModuleID
Definition
loadcore.h:52
_ModuleInfo
Definition
loadcore.h:32
_ModuleInfo::newflags
u16 newflags
Definition
loadcore.h:37
_ModuleInfo::flags
u16 flags
Definition
loadcore.h:40
_ModuleInfo::entry
u32 entry
Definition
loadcore.h:42
__attribute__
Definition
gif_registers.h:40
_iop_library
Definition
loadcore.h:69
iop_bootmode_t
Definition
loadcore.h:93
iop_init_entry_t
Definition
loadcore.h:101
iop_library_table_t
Definition
loadcore.h:110
irx_export_table
Definition
irx.h:117
irx_import_table
Definition
irx.h:44
tag_LC_internals
Definition
loadcore.h:79
tag_LC_internals::image_info
ModuleInfo_t * image_info
Definition
loadcore.h:83
types.h
core
loadcore
include
loadcore.h
Generated by
1.18.0