uofw/include/sysmem_kernel.h
Felix-Dev b0146f24a2
Add Module Manager (#69)
* src/modulemgr: sceKernelQueryModuleInfo(): Improved documentation

* src/modulemgr: Fixed various incorrect SDK versions

* src/modulemgr.c: sceKernelQueryModuleInfo(): Fixed two syntax errors.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleWithBlockOffset().

* src/modulemgr/modulemgr.c: Fixed wrong handling of various sceIoIoctl() status values.

* src/modulemgr/modulemgr.c: Added missing sysmem_kernel.h include.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleByIDWithBlockOffset().

* src/modulemgr/modulemgr.c: Fixed register K1 permission checks in various user-exported loadModule() functions.

* src/modulemgr/modulemgr.c: sceKernelLoadModuleForUser(): Fixed handling of parameter "opt" when being NULL.

* src/modulemgr/modulemgr.c: Fixed sdkVersion return codes in various LoadModule() functions.

* include/iofilemgr_kernel.h: Added back SCE_O_UNKNOWN0.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleDNAS().

* src/modulemgr: Updated and added documentation

- Added documentation for sceKernelLoadModuleById(),
sceKernelLoadModuleWithBlockOffset(), and sceKernelLoadModuleDNAS
- Updated documentation of ModuleMgrForKernel_2B7FC10D(),
sceKernelLoadModule(), sceKernelGetModuleIdList(),
sceKernelQueryModuleInfo(), sceKernelGetModuleId(),
sceKernelGetModuleIdByAddress(), and sceKernelGetModuleGPByAddress()

* src/modulemgr: Updated documentation: case when SCE_ERROR_KERNEL_ILLEGAL_ADDRESS is returned

Affects sceKernelLoadModuleWithBlockOffset() and
sceKernelLoadModuleByIDWithBlockOffset().

* src/modulemgr: sceKernelLoadModuleDNAS(): Forgot a word in documentation

* src/modulemgr: sceKernelLoadModuleDNAS(): Forgot quotation marks in documentation

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleNpDrm().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleMs().

* src/modulemgr/modulemgr.c: Added sceKernelSelfStopUnloadModule().

* src/modulemgr/modulemgr.c: Added sceKernelStopModule().

* src/modulemgr: sceKernelLoadModuleNpDrm(): Fixed a pointer issue

* include/common/memory.h: Added pspClearMemory*() functions. These functions should be used as an alternative to corresponding memset calls.

* src/modulemgr/modulemgr.c: Replaced the variable <modParams> clearing-for-loops with the pspClearMemory32() function.

* src/modulemgr: sceKernelLoadModuleNpDrm(): Added documentation

* src/modulemgr: Added sceKernelLoadModuleBufferUsbWlan()

* src/modulemgr: sceKernelLoadModuleBufferUsbWlan(): Fixed return type

* src/modulemgr: Added _LoadModuleByBufferID()

* src/modulemgr: Added _start_exe_thread()

* src/modulemgr: Added sub_00007620()

* src/modulemgr: Added sub_00007698()

* src/modulemgr: Rename sub_00007620() to _CheckOption()

* src/modulemgr: _CheckOption(): Fix return type

* src/modulemgr: Added _SelfStopUnloadModule()

* src/modulemgr/: Added loadModuleChecks_inline.h containing commonly used checks in loadModule() functions. The check functions introduced there should be used in loadModule() functions.

* src/modulemgr/modulemgr.c: Preparations for the use of _check functions().

* src/modulemgr/modulemgr.c: Removed _CheckOptions(). Its equivalent function is _checkLMOptionConditions() defined in loadModuleChecks_inline.h.

* src/modulemgr/modulemgr.c: loadModule _check() functions are now being used.

* src/modulemgr/loadModuleChecks_inline.h: Removed _setupChecks() and _terminateChecks().

* src/modulemgr/modulemgr.c: Fixed _SelfStopUnloadModule().

* src/modulemgr/modulemgr.c: Forgot to fix pointer errors in _SelfStopUnloadModule() in previous commit.

* src/modulemgr/modulemgr.c: Added _EpilogueModule().

* src/modulemgr: Added sub_000077F0()

* src/modulemgr: _EpilogueModule(): Replaced hardcoded size by sizeof()

* modulemgr: renamed sub_000077F0 to _StopUnloadSelfModuleWithStatus()

* src/modulemgr/modulemgr.c: Added _ModuleReleaseLibraries().

* src/modulemgr: Added _checkSMOptionConditions() and fixed small issues in _StopUnloadSelfModuleWithStatus().

* src/modulemgr/modulemgr.c: Added sceKernelStartModule().

* include/threadman_kernel: Added more thread attribute values.

* src/modulemgr/modulemgr.c: Added sceKernelRebootBeforeForUser().

* src/modulemgr/modulemgr.c: Added sceKernelRebootPhaseForKernel().

* src/modulemgr/modulemgr.c: Added sceKernelRebootBeforeForKernel().

* include/modulemgr_user.h: Added documentation for sceKernelLoadModuleMs().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDisc().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscUpdater().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscDebug().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscEmu().

* src/modulemgr/modulemgr.c: Added ModuleMgrForKernel_C2A5E6CA().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs1().

* added current work from months ago

* src/modulemgr: Cleaned modulemgr directory and added first code.

* src/modulemgr: Finished ModuleMgrInit().

* src/modulemgr: ModuleMgrInit(): Added ChunkInit() call.

* src/modulemgr: Added _ModuleMgrRebootBefore().

* include/threadman_kernel.h: Added sceKernelSuspendThread().

* src\modulemgr\modulemgr.c: Added functions to reverse

* src/modulemgr: Fixed ModuleMgrRebootBefore prefix

ModuleMgrRebootBefore was prefixed with _ although it's not an internal
function

* src/modulmgr: Added ModuleMgrRebootPhase().

* src/modulemgr: Added exe_thread().

* src/modulemgr: Added_UnloadModule().

* src/modulemgr: Fixed a mistake in_UnloadModule().

* src/modulemgr: Added sceKernelGetModuleId().

* src/modulemgr: sceKernelGetModuleId(): Clarified variable name and type.

* src/modulemgr: sceKernelGetModuleId(): Changed return type (forgot it in last commit) for clarification reasons.

* src/modulemgr: sceKernelGetModuleId(): Fixed K1 register handling.

* include/iofilemgr_kernel.h: Added more sceIoOpen() flags.

* src/modulemgr: Added sceKernelGetModuleIdByAddress()

* src/modulemgr: Documentation for sceKernelGetModuleId()

* src/modulemgr: sceKernelGetModuleIdByAddress():  Fixed pspK1PtrOk() argument

* src/modulemgr: Added sceKernelGetModuleGPByAddress()

* src/modulemgr: Fixed missing const statement in arguments

* include/iofilemgr_kernel.h: Added sceKernelLoadModuleForLoadExecForUser().

* src/modulemgr.c: sceKernelGetModuleGPByAddress(): Added retVal declaration.

* src/modulemgr.c: sceKernelLoadModuleForLoadExecForUser(): Added back SCeUID fd declaration (it was eaten by some ghosts I guess).

* src/modulemgr: Added sceKernelGetModuleIdList()

* src/modulemgr: Added sceKernelLoadModule()

* src/modulemgr: sceKernelLoadModuleForLoadExecForUser(): Fixed pointer issues, added some comments

* src/modulemgr: sceKernelLoadModule(): Fixed missing structure field set

* src/modulemgr: sceKernelLoadModuleForLoadExecForUser() and sceKernelLoadModule(): Added documentation

* src/modulemgr: struct SceKernelLMOption: Added documentation

* src/modulemgr: sceKernelLoadModule(): Fixed return value

* src/modulemgr.c: Removed SceKernelLMOption declaration (it is already declared in include/modulemgr_options.h).

* include/modulemgr_options.h: Added back the doxygen documentation for SceKernelLMOption.

* src/modulemgr.c: Added sceKernelLoadModuleByID().

* src/modulemgr.c: sceKernelLoadModule(): Fixed ioctl command.

* src/modulemgr.c: Renamed sceKernelLoadModule() -> sceKernelLoadModuleForUser().

* src/modulemgr.c: sceKernelLoadModuleForUser(): Fixed ioctl command (another one).

* src/modulemgr: Added sceKernelQueryModuleInfo()

* src/modulemgr: sceKernelQueryModuleInfo(): Improved documentation

* src/modulemgr: Fixed various incorrect SDK versions

* src/modulemgr.c: sceKernelQueryModuleInfo(): Fixed two syntax errors.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleWithBlockOffset().

* src/modulemgr/modulemgr.c: Fixed wrong handling of various sceIoIoctl() status values.

* src/modulemgr/modulemgr.c: Added missing sysmem_kernel.h include.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleByIDWithBlockOffset().

* src/modulemgr/modulemgr.c: Fixed register K1 permission checks in various user-exported loadModule() functions.

* src/modulemgr/modulemgr.c: sceKernelLoadModuleForUser(): Fixed handling of parameter "opt" when being NULL.

* src/modulemgr/modulemgr.c: Fixed sdkVersion return codes in various LoadModule() functions.

* include/iofilemgr_kernel.h: Added back SCE_O_UNKNOWN0.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleDNAS().

* src/modulemgr: Updated and added documentation

- Added documentation for sceKernelLoadModuleById(),
sceKernelLoadModuleWithBlockOffset(), and sceKernelLoadModuleDNAS
- Updated documentation of ModuleMgrForKernel_2B7FC10D(),
sceKernelLoadModule(), sceKernelGetModuleIdList(),
sceKernelQueryModuleInfo(), sceKernelGetModuleId(),
sceKernelGetModuleIdByAddress(), and sceKernelGetModuleGPByAddress()

* src/modulemgr: Updated documentation: case when SCE_ERROR_KERNEL_ILLEGAL_ADDRESS is returned

Affects sceKernelLoadModuleWithBlockOffset() and
sceKernelLoadModuleByIDWithBlockOffset().

* src/modulemgr: sceKernelLoadModuleDNAS(): Forgot a word in documentation

* src/modulemgr: sceKernelLoadModuleDNAS(): Forgot quotation marks in documentation

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleNpDrm().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleMs().

* src/modulemgr/modulemgr.c: Added sceKernelSelfStopUnloadModule().

* src/modulemgr/modulemgr.c: Added sceKernelStopModule().

* src/modulemgr: sceKernelLoadModuleNpDrm(): Fixed a pointer issue

* include/common/memory.h: Added pspClearMemory*() functions. These functions should be used as an alternative to corresponding memset calls.

* src/modulemgr/modulemgr.c: Replaced the variable <modParams> clearing-for-loops with the pspClearMemory32() function.

* src/modulemgr: sceKernelLoadModuleNpDrm(): Added documentation

* src/modulemgr: Added sceKernelLoadModuleBufferUsbWlan()

* src/modulemgr: sceKernelLoadModuleBufferUsbWlan(): Fixed return type

* src/modulemgr: Added _LoadModuleByBufferID()

* src/modulemgr: Added _start_exe_thread()

* src/modulemgr: Added sub_00007620()

* src/modulemgr: Added sub_00007698()

* src/modulemgr: Rename sub_00007620() to _CheckOption()

* src/modulemgr: _CheckOption(): Fix return type

* src/modulemgr: Added _SelfStopUnloadModule()

* src/modulemgr/: Added loadModuleChecks_inline.h containing commonly used checks in loadModule() functions. The check functions introduced there should be used in loadModule() functions.

* src/modulemgr/modulemgr.c: Preparations for the use of _check functions().

* src/modulemgr/modulemgr.c: Removed _CheckOptions(). Its equivalent function is _checkLMOptionConditions() defined in loadModuleChecks_inline.h.

* src/modulemgr/modulemgr.c: loadModule _check() functions are now being used.

* src/modulemgr/loadModuleChecks_inline.h: Removed _setupChecks() and _terminateChecks().

* src/modulemgr/modulemgr.c: Fixed _SelfStopUnloadModule().

* src/modulemgr/modulemgr.c: Forgot to fix pointer errors in _SelfStopUnloadModule() in previous commit.

* src/modulemgr/modulemgr.c: Added _EpilogueModule().

* src/modulemgr: Added sub_000077F0()

* src/modulemgr: _EpilogueModule(): Replaced hardcoded size by sizeof()

* modulemgr: renamed sub_000077F0 to _StopUnloadSelfModuleWithStatus()

* src/modulemgr/modulemgr.c: Added _ModuleReleaseLibraries().

* src/modulemgr: Added _checkSMOptionConditions() and fixed small issues in _StopUnloadSelfModuleWithStatus().

* src/modulemgr/modulemgr.c: Added sceKernelStartModule().

* include/threadman_kernel: Added more thread attribute values.

* src/modulemgr/modulemgr.c: Added sceKernelRebootBeforeForUser().

* src/modulemgr/modulemgr.c: Added sceKernelRebootPhaseForKernel().

* src/modulemgr/modulemgr.c: Added sceKernelRebootBeforeForKernel().

* include/modulemgr_user.h: Added documentation for sceKernelLoadModuleMs().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDisc().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscUpdater().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscDebug().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHDiscEmu().

* src/modulemgr/modulemgr.c: Added ModuleMgrForKernel_C2A5E6CA().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs1().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs2().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs3().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs4().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs5().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecVSHMs6().

* src/modulemgr/modulemgr.c: Added ModuleMgrForKernel_8DD336D4().

* src/modulemgr: Simplified ModuleMgrRebootBefore(()

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForLoadExecNpDrm().

* src/modulemgr/modulemgr.c: Minor line indentation corrections.

* src/modulemgr/modulemgr.c: option-> pOpt name change in several functions.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleVSH().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleVSHByID().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleForKernel().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleByIDForKernel().

* src/modulemgr/modulemgr.c: Added more functions.

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferForExitGame() and sceKernelLoadModuleBufferMs().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferApp().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferVSH().

* src/modulemgr/modulemgr.c: Added sceKernelLoadModuleBufferForExitVSHVSH().

* src/modulemgr/modulemgr.c: Added more functions.

* src/modulemgr/modulemgr.c: Added sceKernelUnloadModule().

* src/modulemgr/modulemgr.c: Added sceKernelSearchModuleByName().

* src/modulemgr/modulemgr.c: Added sceKernelSearchModuleByAddress().

* src/modulemgr/modulemgr.c: Added sceKernelSetNpDrmGetModuleKeyFunction().

* src/modulemgr/modulemgr.c: Added sceKernelNpDrmGetModuleKey().

* src/modulemgr/modulemgr.c: Added sceKernelModuleMgrMode().

* src/modulemgr/modulemgr.c: Added _StartModule().

* src/modulemgr/modulemgr.c: Added __StopModule().

* src/modulemgr/modulemgr.c: Added _PrologueModule().

* src/modulemgr/modulemgr.c: Added _ModuleRegisterLibraries().

* src/modulemgr/modulemgr.c: Fixed error in _ModuleReleaseLibraries().

* Moved NID_MODULE_* NIDs from src/loadcore/nid.h -> include/modulemgr_nids.h.

* src/modulemgr/modulemgr.c: Added _ProcessModuleExportEnt().

* include/loadcore.h: Renamed SceLoadCoreExecFileInfo.unk104 -> SceLoadCoreExecFileInfo.secureInstallId.

* include/sysmem_user.h: SceSysMemBlockType: Added more members.

* src/modulemgr/modulemgr.c: Added _LoadModule().

* src/modulemgr/modulemgr.c: Added _PartitionCheck().

* src/modulemgr/modulemgr.c: Added _CheckSkipPbpHeader().

* src/modulemgr/modulemgr.c: Fixes and reduced use of magic numbers

* src/modulemgr/modulemgr.c: Fixes and reduced use of magic numbers (2)

* src/modulemgr/modulemgr.c: Fixed mistake in sceKernelQueryModuleInfo().

* src/modulemgr/modulemgr.c: More small fixes and code cleanup.

* Modulemgr: Remove already reverse-engineered function

* src/modulemgr/modulemgr.c: Fixed a few compilation issues.

* src/modulemgr: Broke up modulemgr.c into several .c files.

* modulemgr: Reverse _CheckOverride()

- Move _CheckOverride() into a separate file

- Reverse _CheckOverride()

- Add the rules for overriding modules' file descriptors

* src/modulemgr/modulemgr.c: Fixed _CheckSkipPbpHeader.

* src/modulemgr/override.c: Fixed syntax errors.

* modulemgr: Fix more mistakes in override

* src/modulemgr: Added pbp.h ( .PBP header description).

* src/modulemgr/modulemgr.c: Added _RelocateModule().

* src/modulemgr/modulemgr.c: Fixed mistake in ModuleRegisterLibraries().

* include/sysmem_kernel.h: Updated prototype of sceKernelGetId().

* src/modulemgr/modulemgr.c: Added ModuleMgrForUser_CDE1C1FE().

* src/modulemgr/modulemgr.c: Added allocate_module_block().

* src/modulemgr/override.c: Fixed mistakes in _CheckOverride() and added more documentation about its purpose.

* modulemgr/rebootModule: Replace hexa with constant

* modulemgr/modulemgr: ModuleMgrForUser_CDE1C1FE(): s32 -> SceBool

* modulemgr: Fixes, re-writes, improved naming, added some documentation. It does not compile yet!

* modulemgr: Make it compilable.

* Removed include/modulemgr.h.

* src/modulemgr: Added missing Makefile.

* modulemgr: Updated its static libraries to reflect name changes of its exported functions.

* modulemgr: Made Loadcore and Loadexec compilable again. They were broken after changes have been made for modulemgr.

* modulemgr: Fixed a few mistakes.

* modulemgr: More fixes and updated some documentation.

* modulemgr: Added .PBP file layout and PARAM.SFO information.

* include/modulemgr_init.h: Added more SCE_EXEC_FILE_* members.

* include/common/errors.h: Added error-value format description.

* modulemgr: More fixes. Also added debug code for modulemgr (dbg.c). It will be removed before merging into 'master'.

* modulemgr: Added missing debug code.

* src/modulemgr: Fixed more errors.

* update .gitignore with version on master

* update .gitignore

* update .gitignore

* Module manager: Remove debug code

* Revert changes made to debug header.

* Add modulemgr to global makefile.

Co-authored-by: devnoname120 <devnoname120@gmail.com>
Co-authored-by: Felix-Dev <FelixDev91.gmail.com>
Co-authored-by: Kern Walster <wals0323@umn.edu>
Co-authored-by: Martin Charles <martincharles07@gmail.com>
Co-authored-by: devnoname120 <devnoname120+gh@gmail.com>
2021-01-02 16:30:44 +01:00

395 lines
13 KiB
C

/* Copyright (C) 2011, 2012, 2013 The uOFW team
See the file COPYING for copying permission.
*/
#ifndef SYSMEM_KERNEL_H
#define SYSMEM_KERNEL_H
#include <stdarg.h>
#include "common_header.h"
#include "sysmem_user.h"
#include "loadcore.h"
typedef struct {
s32 unk0; //0
u32 numExportLibs; //4 -- number of sysmem's export libraries - set in SysMemInit (from utopia)
SceResidentLibraryEntryTable *kernelLibs[8]; //8 --array of sysmem's export tables set in SysMemInit (from utopia)
u32 loadCoreAddr; // 40 -- allocated in SysMemInit (from utopia)
u32 numKernelLibs; // 44 -- offset in export_lib at which user libraries begin - set in SysMemInit (from utopia)
s32 unk48; //48
SceUID (*AllocPartitionMemory)(s32 mpid, char *name, u32 type, u32 size, u32 addr); // 52
void * (*GetBlockHeadAddr)(SceUID id); // 56
s32 (*ResizeMemoryBlock)(SceUID id, s32 leftShift, s32 rightShift); // 60
SceStubLibraryEntryTable *loadCoreImportTables; //64 -- loadcore stubs - set in kactivate before booting loadcore (from utopia)
u32 loadCoreImportTablesSize; //68 -- total size of stubs - set in kactivate before booting loadcore (from utopia)
void *initThreadStack; //72 -- allocated in SysMemInit (from utopia)
SceLoadCoreExecFileInfo *sysMemExecInfo; //76 -- set in kactivate before booting loadcore (from utopia)
SceLoadCoreExecFileInfo *loadCoreExecInfo; //80 -- set in kactivate before booting loadcore (from utopia)
s32 (*CompareSubType)(u32 tag); //84
u32 (*CompareLatestSubType)(u32 tag); //88
s32 (*SetMaskFunction)(u32 unk1, vs32 *addr); //92
void (*Kprintf)(const char *fmt, ...); //96 -- set by sysmem (from utopia)
s32 (*GetLengthFunction)(u8 *file, u32 size, u32 *newSize); //100 -- set in kactivate before booting loadcore (from utopia)
s32 (*PrepareGetLengthFunction)(u8 *buf, u32 size); //104
SceResidentLibraryEntryTable *userLibs[3]; //108
} SysMemThreadConfig;
/** PSP Hardware models. */
enum ScePspHwModels {
/** PSP Fat (01g). */
PSP_1000 = 0,
/** PSP Slim (02g). */
PSP_2000 = 1,
/** PSP Brite (03g). */
PSP_3000 = 2,
/** PSP Brite (04g). */
PSP_4000 = 3,
/** PSP Go (05g). */
PSP_GO = 4,
/** PSP Brite (07g). */
PSP_7000 = 6,
/** PSP Brite (09g). */
PSP_9000 = 8,
/** PSP Street E-1000 (11g). */
PSP_11000 = 10,
};
/*
* Misc
*/
typedef struct {
u32 size; // 0
u32 flags; // 4
char str8[16]; // 8
char str24[11]; // 24
// padding?
int unk36;
char qtgp2[8]; // 40
char qtgp3[16]; // 48
u32 allowReplaceUmd; // 64
char gameId[14]; // 68
// padding?
u32 unk84; // 84
char str88[8]; // 88
u32 umdCacheOn; // 96
u32 sdkVersion; // 100
u32 compilerVersion; // 104
u32 dnas; // 108
u32 unk112; // 112
char str116[64]; // 116
char str180[11]; // 180
// padding?
char str196[8]; // 196
char unk204[8]; // 204
int unk212; // 212
int unk216; // 216
} SceKernelGameInfo;
s32 SysMemForKernel_807179E7(char *gameId, int arg1, char *arg2, char *arg3, int arg4, int arg5, char *arg6);
s32 sceKernelCopyGameInfo(SceKernelGameInfo *info);
s32 SysMemForKernel_F3BDB718(char *arg0);
s32 sceKernelGetQTGP2(char *qtgp2);
s32 sceKernelSetQTGP2(char *qtgp2);
s32 sceKernelGetQTGP3(char *qtgp3);
s32 sceKernelSetQTGP3(char *qtgp3);
s32 sceKernelGetAllowReplaceUmd(u32 *allow);
s32 sceKernelSetAllowReplaceUmd(u32 allow);
s32 sceKernelSetUmdCacheOn(u32 umdCacheOn);
s32 SysMemForKernel_40B744A4(u32 unk112);
s32 SysMemForKernel_BFE08689(char *str116);
s32 SysMemForKernel_2A8B8B2D(char *unk204);
SceKernelGameInfo *sceKernelGetGameInfo(void);
u32 sceKernelGetCompiledSdkVersion(void);
s32 sceKernelSetCompiledSdkVersion100(u32 ver);
s32 sceKernelSetCompiledSdkVersion370(u32 ver);
s32 sceKernelSetCompiledSdkVersion380_390(u32 ver);
s32 sceKernelSetCompiledSdkVersion395(u32 ver);
s32 sceKernelSetCompiledSdkVersion410_420(u32 ver);
s32 sceKernelSetCompiledSdkVersion500_550(u32 ver);
s32 sceKernelSetCompiledSdkVersion570(u32 ver);
s32 sceKernelSetCompiledSdkVersion600_620(u32 ver);
s32 sceKernelSetCompiledSdkVersion630_650(u32 ver);
s32 sceKernelSetCompiledSdkVersion660(u32 ver);
s32 sceKernelGetCompilerVersion(void);
s32 sceKernelSetCompilerVersion(s32 version);
s32 sceKernelGetDNAS(void);
s32 sceKernelSetDNAS(s32 dnas);
s32 sceKernelGetInitialRandomValue(void);
s32 SysMemForKernel_A0A9185A(void);
u32 SysMemForKernel_13EE28DA(u32 flag);
u32 sceKernelGetModel(void);
s32 sceKernelSetRebootKernel(s32 (*rebootKernel)());
s32 sceKernelRebootKernel(void *arg);
s32 sceKernelRegisterGetIdFunc(void *func);
s32 sceKernelGetId(const char *path, char *id);
/*
* Debugging (disabled in release)
*/
s32 sceKernelApiEvaluationInit();
s32 sceKernelRegisterApiEvaluation();
s32 sceKernelApiEvaliationAddData();
s32 sceKernelApiEvaluationReport();
s32 sceKernelSetGcovFunction();
s32 sceKernelCallGcovFunction();
s32 sceKernelSetGprofFunction();
s32 sceKernelCallGprofFunction();
int sceKernelCheckDebugHandler();
s32 SysMemForKernel_7FF2F35A(char *arg);
s32 SysMemForKernel_A03CB480(char *arg);
/*
* Heap
*/
typedef struct SceSysmemLowheapBlock {
struct SceSysmemLowheapBlock *next;
u32 count;
} SceSysmemLowheapBlock;
typedef struct SceSysmemHeapBlock {
struct SceSysmemHeapBlock *next, *prev; // 0, 4
// followed by lowheap
} SceSysmemHeapBlock;
SceUID sceKernelCreateHeap(SceUID mpid, SceSize size, int flag, const char *name);
typedef struct {
u32 size; // 0
char name[32]; // 4
int perm; // 36
int attr; // 40
int heapSize; // 44
int totalsize; // 48
int totalfreesize; // 52
int maxfreesize; // 56
int numheaps; // 60
SceSysmemHeapBlock *heaps[];
} SceSysmemHeapInfo;
int sceKernelQueryHeapInfo(SceUID id, SceSysmemHeapInfo *info);
typedef struct SceSysmemLowheapInfoBlock {
SceSysmemLowheapBlock *block;
u32 offset;
} SceSysmemLowheapInfoBlock;
typedef struct {
u32 size; // 0
u32 heapSize; // 4
u32 usedSize; // 8
u32 freeSize; // 12
u32 maxFreeSize; // 16
u32 blockCount; // 20
SceSysmemLowheapInfoBlock infoBlocks[];
} SceSysmemLowheapInfo; // size: 24
s32 sceKernelQueryLowheapInfo(SceSysmemHeapBlock *block, SceSysmemLowheapInfo *info);
int sceKernelDeleteHeap(SceUID id);
typedef struct {
u32 size; // structure size (probably)
u32 align;
} SceSysmemHeapAllocOption;
void *sceKernelAllocHeapMemoryWithOption(SceUID id, int size, SceSysmemHeapAllocOption *opt);
void *sceKernelAllocHeapMemory(SceUID id, int size);
s32 sceKernelFreeHeapMemory(SceUID id, void *addr);
s32 sceKernelHeapTotalFreeSize(SceUID id);
/*
* Main
*/
typedef struct {
unsigned used : 1; // 0
unsigned next : 6; /* next index */ // 1
unsigned offset : 25; /* offset (from the partition start, divided by 0x100) */ // 7
unsigned isProtected : 1; // 0
unsigned sizeLocked : 1; // 1
unsigned prev : 6; // 2
unsigned checkOverflow : 1; // 8
unsigned size : 23; /* size (divided by 0x100) */ // 9
} SceSysmemSeg; // size: 8
typedef struct {
union {
u32 segCount;
u32 segAddr;
} info;
u32 size; // 4
u32 unused8; // 8
SceSysmemSeg *curSeg; // 12
} SceSysMemoryInfo;
void sceKernelGetSysMemoryInfo(s32 mpid, u32 needsInit, SceSysMemoryInfo *info);
s32 sceKernelGetSysmemIdList(s32 id, s32 *uids, s32 maxCount, s32 *totalCount);
s32 sceKernelSysMemRealMemorySize(void);
s32 sceKernelSysMemMemSize(void);
s32 sceKernelSysMemMaxFreeMemSize(void);
s32 sceKernelGetMEeDramSaveAddr(void);
s32 sceKernelGetAWeDramSaveAddr(void);
s32 sceKernelGetMEeDramSaveSize(void);
s32 sceKernelGetAWeDramSaveSize(void);
s32 sceKernelDevkitVersion(void);
s32 sceKernelGetSystemStatus(void);
s32 sceKernelSetSystemStatus(s32 newStatus);
typedef struct {
s32 dlId;
void *stall;
u32 count;
u32 max;
} SceGeLazy;
typedef struct {
u32 size;
s32 *cmdList;
s32 (*sceGeListUpdateStallAddr_lazy)(s32 dlId, void *stall);
SceGeLazy *lazySyncData;
} SceKernelUsersystemLibWork;
s32 sceKernelSetUsersystemLibWork(s32 *cmdList, s32 (*sceGeListUpdateStallAddr_lazy)(s32, void*), SceGeLazy *lazy);
SceKernelUsersystemLibWork *sceKernelGetUsersystemLibWork(void);
/*
* Memory Block
*/
typedef struct {
s32 size; // Structure size
} SceSysmemMemoryBlockAllocOption;
SceUID sceKernelAllocMemoryBlock(char *name, u32 type, u32 size, SceSysmemMemoryBlockAllocOption *opt);
s32 sceKernelFreeMemoryBlock(SceUID id);
s32 sceKernelGetMemoryBlockAddr(SceUID id, void **addrPtr);
/*
* Memory Main
*/
typedef struct {
u32 size; // 0
char name[32]; // 4
u32 attr; // 36
u32 addr; // 40
u32 memSize; // 44
u32 sizeLocked; // 48
u32 used; // 52
} SceSysmemMemoryBlockInfo;
s32 sceKernelResizeMemoryBlock(SceUID id, s32 leftShift, s32 rightShift);
s32 sceKernelJointMemoryBlock(SceUID id1, SceUID id2);
s32 sceKernelSeparateMemoryBlock(SceUID id, u32 cutBefore, u32 size);
s32 sceKernelQueryMemoryBlockInfo(SceUID id, SceSysmemMemoryBlockInfo *infoPtr);
s32 sceKernelSizeLockMemoryBlock(SceUID id);
s32 sceKernelFreePartitionMemory(SceUID id);
s32 sceKernelQueryMemoryInfo(u32 address, SceUID *partitionId, SceUID *memoryBlockId);
void *sceKernelGetBlockHeadAddr(SceUID id);
u32 SysMemForKernel_CC31DEAD(SceUID id);
void *sceKernelMemset(void *src, s8 c, u32 size);
void *sceKernelMemset32(void *src, s32 c, u32 size);
void *sceKernelMemmove(void *dst, void *src, u32 size);
void *sceKernelMemmoveWithFill(void *dst, void *src, u32 size, s32 fill);
void *sceKernelMemcpy(void *dst, const void *src, u32 n);
/*
* Memory Operations
*/
void sceKernelMemoryExtendSize(void);
void sceKernelMemoryShrinkSize(void);
u32 sceKernelMemoryOpenSize(void);
void sceKernelMemoryCloseSize(u32 state);
s32 sceKernelSetDdrMemoryProtection(u32 addr, u32 size, u32 set);
/*
* Partitions
*/
typedef struct {
SceSize size; // 0
u32 startAddr; // 4
u32 memSize; // 8
u32 attr; // 12
} SceSysmemPartitionInfo;
s32 sceKernelQueryMemoryPartitionInfo(s32 mpid, SceSysmemPartitionInfo *info);
u32 sceKernelPartitionMaxFreeMemSize(s32 mpid);
u32 sceKernelPartitionTotalMemSize(s32 mpid);
u32 sceKernelTotalMemSize(void);
u32 sceKernelPartitionTotalFreeMemSize(s32 mpid);
s32 sceKernelFillFreeBlock(s32 mpid, u32 c);
SceUID sceKernelAllocPartitionMemory(s32 mpid, char *name, u32 type, u32 size, u32 addr);
/*
* UIDs
*/
#define UID_CB_TO_DATA(uid, typeStruct, type) ((type*)((void*)uid + typeStruct->size * 4))
#define UID_DATA_TO_CB(data, typeStruct) ((SceSysmemUidCB*)((void*)data - typeStruct->size * 4))
struct SceSysmemUidLookupFunc;
typedef struct SceSysmemUidCB {
struct SceSysmemUidCB *PARENT0; // 0
struct SceSysmemUidCB *nextChild; // 4
struct SceSysmemUidCB *meta; // 8: the type UID
SceUID uid; // 12
char *name; // 16
u8 childSize; // 20
u8 size; // 21
u16 attr; // 22
union {
struct SceSysmemUidCB *next; // 24
s32 numChild; // 24
} next;
struct SceSysmemUidCB *PARENT1; // 28
struct SceSysmemUidLookupFunc *funcTable; // 32
} __attribute__((packed)) SceSysmemUidCB; // size: 36
typedef s32 (*SceSysmemUidFunc)(SceSysmemUidCB *uid, SceSysmemUidCB *uidWithFunc, s32 funcId, va_list ap);
typedef struct SceSysmemUidLookupFunc {
s32 id;
SceSysmemUidFunc func;
} SceSysmemUidLookupFunc;
s32 sceKernelCallUIDFunction(SceUID id, int funcId, ...);
s32 sceKernelCallUIDObjFunction(SceSysmemUidCB *uid, s32 funcId, ...);
int sceKernelLookupUIDFunction(SceSysmemUidCB *uid, int id, SceSysmemUidFunc *func, SceSysmemUidCB **parentUidWithFunc);
s32 sceKernelCallUIDObjCommonFunction(SceSysmemUidCB *uid, SceSysmemUidCB *uidWithFunc, s32 funcId, va_list ap);
int sceKernelCreateUIDtypeInherit(const char *parentName, const char *name, int size,
SceSysmemUidLookupFunc *funcTable, SceSysmemUidLookupFunc *metaFuncTable,
SceSysmemUidCB **uidTypeOut);
int sceKernelCreateUID(SceSysmemUidCB *type, const char *name, char k1, SceSysmemUidCB **outUid);
SceUID sceKernelSearchUIDbyName(const char *name, SceUID typeId);
int sceKernelCreateUIDtype(const char *name, int size, SceSysmemUidLookupFunc *funcTable,
SceSysmemUidLookupFunc *metaFuncTable, SceSysmemUidCB **uidTypeOut);
s32 sceKernelDeleteUIDtype(SceSysmemUidCB *uid);
s32 sceKernelGetUIDname(SceUID id, s32 len, char *out);
s32 sceKernelRenameUID(SceUID id, const char *name);
s32 sceKernelGetUIDtype(SceUID id);
s32 sceKernelDeleteUID(SceUID id);
s32 sceKernelGetUIDcontrolBlock(SceUID id, SceSysmemUidCB **uidOut);
s32 sceKernelGetUIDcontrolBlockWithType(SceUID id, SceSysmemUidCB *type, SceSysmemUidCB **outUid);
s32 sceKernelIsKindOf(SceSysmemUidCB *uid, SceSysmemUidCB *type);
s32 sceKernelPrintUidListAll(void);
typedef struct {
SceSysmemUidCB *root; // 0
SceSysmemUidCB *metaRoot; // 4
SceSysmemUidCB *basic; // 8
s32 count; // 12
} SceSysmemUidList;
SceSysmemUidList *sceKernelGetUidmanCB(void);
s32 sceKernelIsHold(SceSysmemUidCB *uid0, SceSysmemUidCB *uid1);
s32 sceKernelHoldUID(SceUID id0, SceUID id1);
s32 sceKernelReleaseUID(SceUID id0, SceUID id1);
#endif