vitasdk
Documentation of the vitasdk
modulemgr.h
Go to the documentation of this file.
1 
6 #ifndef _PSP2KERN_KERNEL_MODULEMGR_H_
7 #define _PSP2KERN_KERNEL_MODULEMGR_H_
8 
9 #include <vitasdk/build_utils.h>
11 #include <psp2kern/types.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef struct SceKernelModuleName {
19  char s[0x1C];
22 
23 typedef struct {
25  int perm;
26  void *vaddr;
27  uint32_t memsz;
28  int unk_10;
31 
32 typedef struct {
35  uint32_t version;
36  uint32_t module_version;
37  uint32_t unk10;
38  void *unk14;
39  uint32_t unk18;
40  void *unk1C;
41  void *unk20;
42  char module_name[28];
43  uint32_t unk40;
44  uint32_t unk44;
45  uint32_t nid;
47  union {
48  struct {
49  SceKernelSegmentInfo2 SegmentInfo[1];
50  uint32_t addr[4];
51  } seg1;
52  struct {
53  SceKernelSegmentInfo2 SegmentInfo[2];
54  uint32_t addr[4];
55  } seg2;
56  struct {
57  SceKernelSegmentInfo2 SegmentInfo[3];
58  uint32_t addr[4];
59  } seg3;
60  struct {
61  SceKernelSegmentInfo2 SegmentInfo[4];
62  uint32_t addr[4];
63  } seg4;
64  };
67 
70  void *entry; // function ptr. or vars?
73 
75  SceSize size; // 0x124
78  char libname[0x100];
87 
88 typedef struct SceSelfAppInfo {
89  int vendor_id;
90  int self_type;
93 
94 typedef struct SceLoadProcessParam { // size is 0x7C-bytes
96  char thread_name[0x20];
102  int unk_0x50;
103  char process_name[0x20]; // not titleid
108 
109 typedef struct _SceKernelFunctionShimInfo {
114 
115 typedef struct _SceKernelLibraryShimInfo {
116  const char *library_name;
122 
123 typedef struct _SceKernelCompatibilityShimInfo {
124  const char *title_id;
130 
131 
140 void ksceKernelRegisterSyscall(SceSize syscall_id, const void *func);
141 
150 
162 int ksceKernelGetModuleList(SceUID pid, int flags1, int flags2, SceUID *modids, SceSize *num);
163 
193 
204 
216 int ksceKernelGetModuleInfoMinByAddr(SceUID pid, const void *module_addr, uint32_t *module_nid, const void **program_text_addr, SceKernelModuleName *module_name);
217 
226 int ksceKernelGetModuleCB(SceUID modid, void **info);
227 
237 int ksceKernelGetModuleCBByAddr(SceUID pid, const void *module_addr, void **info);
238 
248 
256 SceUID ksceKernelSearchModuleByName(const char *module_name);
257 
266 
276 SceUID ksceKernelLoadModule(const char *path, int flags, SceKernelLMOption *option);
277 
290 int ksceKernelStartModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
291 
304 SceUID ksceKernelLoadStartModule(const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
305 
318 int ksceKernelStopModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
319 
330 
343 int ksceKernelStopUnloadModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
344 
356 
370 int ksceKernelStartModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
371 
385 SceUID ksceKernelLoadStartModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
386 
400 int ksceKernelStopModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
401 
413 
427 int ksceKernelStopUnloadModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
428 
442 SceUID ksceKernelLoadStartSharedModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status);
443 
457 int ksceKernelStopUnloadSharedModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status);
458 
466 int ksceKernelMountBootfs(const char *bootImagePath);
467 
474 
481 
491 int ksceKernelGetModulePath(SceUID modid, char *path, SceSize pathlen);
492 
503 
504 
510 int ksceKernelGetLibraryClientList(SceUID pid, SceUID library_id, SceUID *modids, SceSize *num, SceSize cpy_skip_num);
516 int ksceKernelGetMetaDataForDebugger(SceUID pid, SceUID uModuleId, void **start, void **stop);
518 int ksceKernelGetModuleFingerprint(SceUID moduleId, SceUInt32 *pFingerprint);
520 int ksceKernelGetProgramIdentificationInfo(const char *path, SceUInt64 *pAuthid, SceSelfAppInfo *pInfo);
523 int ksceKernelGetStubNidTableForDebugger(SceUID pid, SceUID stubid, void *a3, SceSize *num, SceSize cpy_skip_num);
526 int ksceKernelLoadPtLoadSegForFwloader(const char *path, int e_phnum, void *buffer, SceSize bufsize, int zero_unk, SceSize *bytes_read);
530 
531 
532 /* For backwards compatibility */
533 
534 #define ksceKernelGetModuleInternal ksceKernelGetModuleCB
535 #define ksceKernelGetProcessMainModule ksceKernelGetModuleIdByPid
536 
537 
538 #ifdef __cplusplus
539 }
540 #endif
541 
542 #endif /* _PSP2KERN_KERNEL_MODULEMGR_H_ */
void * buffer
Definition: bt.h:6
int flags
Event flags.
Definition: debug.h:3
SceUID pid
Definition: debug.h:1
void * entry
Definition: modulemgr.h:70
int ksceKernelGetExportedLibraryListInModule(SceUID pid, SceUID modid, SceUID *library_ids, SceSize *num)
SceUInt32 preload_disabled
Definition: modulemgr.h:104
const char * title_id
TitleID (process name) of the app this shim applies to.
Definition: modulemgr.h:124
int ksceKernelGetStubInfoForDebugger(SceUID pid, SceUID stubid, void *a3)
SceUID ksceKernelGetModuleIdByPid(SceUID pid)
Get the main module id for a given process.
SceSize size
sizeof(SceKernelSegmentInfo2) (0x14)
Definition: modulemgr.h:24
SceNID libnid
Definition: modulemgr.h:77
int data_0x110
Definition: modulemgr.h:80
void * module_proc_param
Definition: modulemgr.h:105
SceUInt32 unk_04
Always 0 ?
Definition: modulemgr.h:125
SceUID ksceKernelLoadModule(const char *path, int flags, SceKernelLMOption *option)
load module (kernel only)
SceUID ksceKernelLoadStartModule(const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status)
load and start module (kernel only)
char thread_name[0x20]
Definition: modulemgr.h:96
int ksceKernelGetLostLibraryInfo(SceUID pid, SceUID modid, SceNID libnid, SceKernelModuleImportNonlinkedInfo *info)
int ksceKernelGetModuleFingerprint(SceUID moduleId, SceUInt32 *pFingerprint)
int ksceKernelGetStubList(SceUID pid, SceUID *stub, SceSize *num)
SceNID replaced_function_nid
NID of the function that needs to be replaced.
Definition: modulemgr.h:110
int ksceKernelGetModuleIsSharedByAddr(SceUID pid, void *addr)
SceKernelFunctionShimInfo * function_shims
Definition: modulemgr.h:119
int ksceKernelGetModuleCBByAddr(SceUID pid, const void *module_addr, void **info)
Get module info by address (internal)
uint32_t nid
Definition: modulemgr.h:45
void * unk14
Definition: modulemgr.h:38
int ksceKernelStopModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status)
stop module (kernel only)
int perm
Definition: modulemgr.h:25
int ksceKernelLoadPtLoadSegForFwloader(const char *path, int e_phnum, void *buffer, SceSize bufsize, int zero_unk, SceSize *bytes_read)
int ksceKernelUnloadModule(SceUID modid, int flags, SceKernelULMOption *option)
unload module (kernel only)
SceUInt32 sysver
Definition: modulemgr.h:95
int self_type
Definition: modulemgr.h:90
int unk_10
Definition: modulemgr.h:28
int ksceKernelGetLostLibraryListInModule(SceUID pid, SceUID modid, void *pList, SceSize *num)
int ksceKernelGetModuleInfoMinByAddr(SceUID pid, const void *module_addr, uint32_t *module_nid, const void **program_text_addr, SceKernelModuleName *module_name)
Get module info mini by module address.
uint32_t unk40
Definition: modulemgr.h:43
SceSize size
Definition: modulemgr.h:33
int ksceKernelGetModuleList(SceUID pid, int flags1, int flags2, SceUID *modids, SceSize *num)
Get module id list.
void ksceKernelRegisterModulesAfterBoot(void)
Setup kernel for modulemgr.
int ksceKernelGetProgramIdentificationInfo(const char *path, SceUInt64 *pAuthid, SceSelfAppInfo *pInfo)
uint32_t version
Definition: modulemgr.h:35
char libname[0x100]
Definition: modulemgr.h:78
void ksceKernelRegisterSyscall(SceSize syscall_id, const void *func)
Register syscall function.
int ksceKernelMountBootfs(const char *bootImagePath)
mount bootfs (load bootfs module)
SceUID ksceKernelSearchModuleByName(const char *module_name)
search kernel module by module name
SceUInt32 initial_thread_priority
Definition: modulemgr.h:97
uint32_t unk10
Definition: modulemgr.h:37
int data_0x10C
Definition: modulemgr.h:79
char process_name[0x20]
Definition: modulemgr.h:103
uint32_t unk44
Definition: modulemgr.h:44
int ksceKernelGetImportedLibraryListInModule(SceUID pid, SceUID modid, SceUID *library_ids, SceSize *num)
SceNID libnid
Definition: modulemgr.h:69
int ksceKernelUnloadModuleForPid(SceUID pid, SceUID modid, int flags, SceKernelULMOption *option)
unload module
int ksceKernelStopModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status)
stop module
void * vaddr
Definition: modulemgr.h:26
int ksceKernelGetModuleInfoForDebugger(SceUID pid, SceKernelModuleListInfo *infolists, SceSize *num)
int ksceKernelGetLibraryExportInfoForDebugger(SceUID pid, SceUID library_id, SceKernelModuleExportEntry *list, SceSize *num, SceSize cpy_skip_num)
SceUInt32 unk_0x30
Definition: modulemgr.h:100
SceSize size
Definition: modulemgr.h:75
SceUID modid
Definition: modulemgr.h:34
uint32_t module_version
Definition: modulemgr.h:36
char s[0x1C]
Definition: modulemgr.h:19
SceNID replacing_function_nid
NID of the function that will serve as a replacement - must probably come from same library as replac...
Definition: modulemgr.h:111
int ksceKernelStopUnloadSharedModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status)
stop and unload module as shared module
int unk_0x50
Definition: modulemgr.h:102
VITASDK_BUILD_ASSERT_EQ(4, SceKernelPreloadInhibit)
void ksceKernelFinalizeKbl(void)
SceUID ksceKernelGetModuleIdByAddrForDebugger(SceUID pid, const void *module_addr)
Get module id by module address.
int ksceKernelGetLibraryInfoForDebugger(SceUID pid, SceUID library_id, SceKernelModuleLibraryInfo *info)
Get library info.
int data_0x120
Definition: modulemgr.h:84
int ksceKernelGetLostLibraryList(SceUID pid, void *a2, SceSize *num)
int ksceKernelStartModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status)
start module (kernel only)
SceKernelThreadOptParam threadOptParam
Definition: modulemgr.h:101
uint32_t unk18
Definition: modulemgr.h:39
int data_0x11C
Definition: modulemgr.h:83
int ksceKernelGetStubNidTableForDebugger(SceUID pid, SceUID stubid, void *a3, SceSize *num, SceSize cpy_skip_num)
SceUInt32 function_shims_count
Size of the array pointed to by next field.
Definition: modulemgr.h:118
SceUInt32 library_shims_count
Size of the array pointed to by next field.
Definition: modulemgr.h:126
int ksceKernelStopUnloadModule(SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status)
stop and unload module (kernel only)
int ksceKernelGetMetaDataForDebugger(SceUID pid, SceUID uModuleId, void **start, void **stop)
int ksceKernelGetModulePath(SceUID modid, char *path, SceSize pathlen)
Get the module path.
void * unk1C
Definition: modulemgr.h:40
int ksceKernelGetLibEntCBListForSyslibtrace(void **ppList, SceSize *num)
int data_0x114
Definition: modulemgr.h:81
int ksceKernelUmountBootfs(void)
unmount bootfs (unload bootfs module)
int ksceKernelStartModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status)
start module
SceSize initial_thread_stack_size
Definition: modulemgr.h:98
int data_0x118
Definition: modulemgr.h:82
const char * library_name
Name of the library the shimmed functions come from (i.e.
Definition: modulemgr.h:116
SceUInt32 unk_04
Always 0 ?
Definition: modulemgr.h:117
uint32_t memsz
Definition: modulemgr.h:27
int ksceKernelLoadPreloadingModules(SceUID pid, const SceLoadProcessParam *pParam, int flags)
int ksceKernelStartPreloadingModules(SceUID pid)
int ksceKernelGetModuleInfo(SceUID pid, SceUID modid, SceKernelModuleInfo *info)
Get module info.
SceUID modid
Definition: modulemgr.h:76
SceKernelLibraryShimInfo * library_shims
Definition: modulemgr.h:127
int ksceKernelStopUnloadModuleForPid(SceUID pid, SceUID modid, SceSize args, void *argp, int flags, SceKernelULMOption *option, int *status)
stop and unload module
int ksceKernelUnloadProcessModules(SceUID pid)
void * unk20
Definition: modulemgr.h:41
int ksceKernelGetModuleCB(SceUID modid, void **info)
Get module info (internal)
int ksceKernelModuleUnloadMySelf(void)
void * ksceKernelGetModuleEntryPoint(SceUID modid)
SceUID ksceKernelLoadModuleForPid(SceUID pid, const char *path, int flags, SceKernelLMOption *option)
load module
SceUID ksceKernelLoadStartModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status)
load and start module
SceUID ksceKernelLoadProcessImage(SceUID pid, const char *path, int flags, SceSelfAuthInfo *auth_info, SceLoadProcessParam *param, SceKernelCompatibilityShimInfo *shim_info)
SceUInt32 unk_0x2C
Definition: modulemgr.h:99
int ksceKernelGetLibraryClientList(SceUID pid, SceUID library_id, SceUID *modids, SceSize *num, SceSize cpy_skip_num)
SceUID ksceKernelLoadStartSharedModuleForPid(SceUID pid, const char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status)
load and start module as shared module
int vendor_id
Definition: modulemgr.h:89
int ksceKernelGetSystemSwVersion(SceKernelFwInfo *data)
Get fw info.
SceSize segments_num
Definition: modulemgr.h:46
int ksceKernelGetLibraryDBFlags(SceUID pid, int *pFlags)
int ksceKernelGetLibraryList(SceUID pid, SceUID *library_ids, SceSize *num)
Definition: modulemgr.h:123
Definition: modulemgr.h:109
Definition: modulemgr.h:98
Definition: modulemgr.h:115
Definition: modulemgr.h:68
Definition: modulemgr.h:74
Definition: modulemgr.h:75
Definition: modulemgr.h:119
Definition: modulemgr.h:32
Definition: modulemgr.h:18
Definition: modulemgr.h:23
Definition: modulemgr.h:108
Definition: modulemgr.h:103
Definition: modulemgr.h:94
Definition: modulemgr.h:88
Additional options used when creating threads.
Definition: threadmgr.h:65
unsigned int SceSize
Definition: types.h:56
int SceUID
UIDs are used to describe many different kernel objects.
Definition: types.h:90
uint64_t SceUInt64
Definition: types.h:51
unsigned int SceNID
Library/Function NID.
Definition: types.h:92
uint32_t SceUInt32
Definition: types.h:45
Definition: types.h:160