mirror of
https://github.com/joel16/uofw.git
synced 2024-11-26 21:10:38 +00:00
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>
This commit is contained in:
parent
655782496c
commit
b0146f24a2
10
.gitignore
vendored
10
.gitignore
vendored
@ -8,9 +8,13 @@ github-pages/
|
||||
*.*~
|
||||
exports.c
|
||||
/lib/libdebug.a
|
||||
/lib/build_mod.mak
|
||||
|
||||
## Ignore Visual Studio project files, Visual Studio temporary files, build results.
|
||||
|
||||
# Visual Studio project files
|
||||
*.sln
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
@ -32,8 +36,6 @@ ipch/
|
||||
*.vsp
|
||||
*.vspx
|
||||
/.vs
|
||||
|
||||
# Other VS-generated files
|
||||
/Debug
|
||||
/lib/build_mod.mak
|
||||
/uOFW.sln
|
||||
/utils/kprxgen/kprxgen.sln
|
||||
/utils/build-exports/PSP-BuildExports.sln
|
||||
|
4
Makefile
4
Makefile
@ -1,6 +1,6 @@
|
||||
MODULES=debug audio clockgen codec ctrl exceptionman ge init interruptman \
|
||||
iofilemgr led libatrac3plus loadcore loadexec mediaman me_wrapper syscon \
|
||||
sysmem systimer usersystemlib wlanfirm
|
||||
iofilemgr led libatrac3plus loadcore loadexec mediaman me_wrapper modulemgr \
|
||||
syscon sysmem systimer usersystemlib wlanfirm
|
||||
|
||||
all: $(MODULES)
|
||||
|
||||
|
@ -47,3 +47,4 @@ static inline void dbg_fbfill(u8 r, u8 g, u8 b) {
|
||||
*(int*)(0x44000000 + i * 4) = r | (g << 8) | (b << 16);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* Copyright (C) 2011 - 2016 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_asm.h, common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_asm.h, common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* uofw/include/common/errors.h
|
||||
*
|
||||
@ -357,3 +357,9 @@
|
||||
#define SCE_ERROR_KERNEL_NOT_CACHE_ALIGNED 0x8002044C
|
||||
#define SCE_ERROR_KERNEL_MAX_ERROR 0x8002044D
|
||||
|
||||
/*
|
||||
* Error-similar definitions.
|
||||
*/
|
||||
#define SCE_KERNEL_VALUE_UNITIALIZED (-1)
|
||||
#define SCE_KERNEL_PTR_UNITIALIZED ((void *)SCE_KERNEL_VALUE_UNITIALIZED)
|
||||
|
||||
|
@ -1,70 +1,86 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
inline static s32 pspMax(s32 a, s32 b)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("max %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspMin(s32 a, s32 b)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("min %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static void pspSync(void)
|
||||
{
|
||||
asm __volatile__ ("sync");
|
||||
}
|
||||
|
||||
inline static void pspCache(char op, const void *ptr)
|
||||
{
|
||||
asm __volatile__ ("cache %0, 0(%1)" : : "ri" (op), "r" (ptr));
|
||||
}
|
||||
|
||||
inline static void pspBreak(s32 op)
|
||||
{
|
||||
asm __volatile__ ("break %0" : : "ri" (op));
|
||||
}
|
||||
|
||||
inline static void pspHalt(void)
|
||||
{
|
||||
/* The 'HALT' instruction */
|
||||
asm __volatile__ (".word 0x70000000");
|
||||
}
|
||||
|
||||
inline static s32 pspMfic(void)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("mfic %0, $0" : "=r" (ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspLl(s32 *ptr)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("ll %0, (%1)" : "=r" (ret) : "r" (ptr));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspSc(s32 value, s32 *ptr)
|
||||
{
|
||||
s32 ret = value;
|
||||
asm __volatile__ ("sc %0, (%1)" : "=r" (ret) : "r" (ptr));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static u32 pspWsbw(u32 value)
|
||||
{
|
||||
asm __volatile__ ("wsbw %0, %0" : "=r" (value) : "r" (value));
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
inline static s32 pspMax(s32 a, s32 b)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("max %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspMin(s32 a, s32 b)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("min %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static void pspSync(void)
|
||||
{
|
||||
asm __volatile__ ("sync");
|
||||
}
|
||||
|
||||
inline static void pspCache(char op, const void *ptr)
|
||||
{
|
||||
asm __volatile__ ("cache %0, 0(%1)" : : "ri" (op), "r" (ptr));
|
||||
}
|
||||
|
||||
/*
|
||||
* BREAK instruction
|
||||
*
|
||||
* 31 26 25 6 5 0
|
||||
* +------+---------------------+------+
|
||||
* |000000| break code |001101|
|
||||
* +------+---------------------+------+
|
||||
*/
|
||||
|
||||
/* break codes */
|
||||
#define SCE_BREAKCODE_ZERO 0x00000
|
||||
#define SCE_BREAKCODE_ONE 0x00001
|
||||
#define SCE_BREAKCODE_DIVZERO 0x00007 /* Divide by zero check. */
|
||||
|
||||
#define MAKE_BREAKCODE_INSTR(op) ((((op) & 0xFFFFF) << 6) | 0xD)
|
||||
|
||||
inline static void pspBreak(s32 op)
|
||||
{
|
||||
asm __volatile__ ("break %0" : : "ri" (op));
|
||||
}
|
||||
|
||||
inline static void pspHalt(void)
|
||||
{
|
||||
/* The 'HALT' instruction */
|
||||
asm __volatile__ (".word 0x70000000");
|
||||
}
|
||||
|
||||
inline static s32 pspMfic(void)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("mfic %0, $0" : "=r" (ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspLl(s32 *ptr)
|
||||
{
|
||||
s32 ret;
|
||||
asm __volatile__ ("ll %0, (%1)" : "=r" (ret) : "r" (ptr));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static s32 pspSc(s32 value, s32 *ptr)
|
||||
{
|
||||
s32 ret = value;
|
||||
asm __volatile__ ("sc %0, (%1)" : "=r" (ret) : "r" (ptr));
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static u32 pspWsbw(u32 value)
|
||||
{
|
||||
asm __volatile__ ("wsbw %0, %0" : "=r" (value) : "r" (value));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,11 @@
|
||||
#define K3_SIZE 0x20000000 /* 512 MB */
|
||||
|
||||
/* Scratchpad segment base address and size */
|
||||
#define SCE_SCRATCHPAD_ADDR 0x00010000 /* Physical memory */
|
||||
#define SCE_SCRATCHPAD_ADDR_KU0 0x00010000 /* KU segment 0 (cached) */
|
||||
#define SCE_SCRATCHPAD_ADDR_KU1 0x40010000 /* KU segment 1 (uncached) */
|
||||
#define SCE_SCRATCHPAD_ADDR 0x00010000 /* Physical memory */
|
||||
#define SCE_SCRATCHPAD_ADDR_KU0 0x00010000 /* KU segment 0 (cached) */
|
||||
#define SCE_SCRATCHPAD_ADDR_KU1 0x40010000 /* KU segment 1 (uncached) */
|
||||
#define SCE_SCRATCHPAD_ADDR_K0 0x80010000 /* K0 segment (cached) */
|
||||
#define SCE_SCRATCHPAD_SIZE 0x00004000 /* 16 KB */
|
||||
#define SCE_SCRATCHPAD_SIZE 0x00004000 /* 16 KB */
|
||||
|
||||
#define REBOOT_BASE_ADDR_K0 0x88600000 /* K0 segment (cached) */
|
||||
|
||||
@ -49,3 +49,35 @@
|
||||
#define UPALIGN8(v) (((v) + 0x7) & 0xFFFFFFF8)
|
||||
#define UPALIGN4(v) (((v) + 0x3) & 0xFFFFFFFC)
|
||||
|
||||
/* Clear memory partitioned in 1-Byte blocks. */
|
||||
static inline void pspClearMemory8(void *ptr, int size) {
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
((u8 *)ptr)[i] = 0;
|
||||
}
|
||||
|
||||
/* Clear memory partitioned in 2-Byte blocks. */
|
||||
static inline void pspClearMemory16(void *ptr, int size) {
|
||||
int i;
|
||||
for (i = 0; i < (int)(size / sizeof(u16)); i++)
|
||||
((u16 *)ptr)[i] = 0;
|
||||
}
|
||||
|
||||
/* Clear memory partitioned in 4-Byte blocks. */
|
||||
static inline void pspClearMemory32(void *ptr, int size) {
|
||||
int i;
|
||||
for (i = 0; i < (int)(size / sizeof(u32)); i++)
|
||||
((u32 *)ptr)[i] = 0;
|
||||
}
|
||||
|
||||
// TODO: Remove size handling in above's clear functions.
|
||||
// Replace instances of above functions with this one.
|
||||
static inline void pspClearMemory(void *ptr, int size) {
|
||||
if (size % 4 == 0)
|
||||
pspClearMemory32(ptr, size / 4);
|
||||
else if (size % 2 == 0)
|
||||
pspClearMemory16(ptr, size / 2);
|
||||
else
|
||||
pspClearMemory8(ptr, size);
|
||||
}
|
||||
|
||||
|
@ -1,166 +1,185 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
#include "../pspmoduleexport.h"
|
||||
|
||||
/** The maximum length of a module name. */
|
||||
#define SCE_MODULE_NAME_LEN (27)
|
||||
|
||||
/** SceModuleInfo.modVersion */
|
||||
#define MODULE_VERSION_MINOR (0)
|
||||
#define MODULE_VERSION_MAJOR (1)
|
||||
#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
|
||||
|
||||
/** Module Info section data. */
|
||||
typedef struct {
|
||||
/**
|
||||
* The attributes of a module. Bitwise OR'ed values from ::SceModuleAttribute
|
||||
* and ::SceModulePrivilegeLevel.
|
||||
*/
|
||||
u16 modAttribute;
|
||||
/** The module version. Contains two number categories, minor, major. */
|
||||
u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
|
||||
/** The name of the module. */
|
||||
char modName[SCE_MODULE_NAME_LEN];
|
||||
/** Unknown. */
|
||||
s8 terminal;
|
||||
/** The global pointer of the module. */
|
||||
void *gpValue;
|
||||
/**
|
||||
* Pointer to the first resident library entry table of the module.
|
||||
* This section is known as ".lib.ent".
|
||||
*/
|
||||
void *entTop;
|
||||
/**
|
||||
* Pointer to the last line of the ,lib.ent section. This line is always 0 and
|
||||
* is known as ".lib.ent.btm".
|
||||
*/
|
||||
void *entEnd;
|
||||
/**
|
||||
* Pointer to the first stub library entry table of the module.
|
||||
* This section is known as "lib.stub".
|
||||
*/
|
||||
void *stubTop;
|
||||
/**
|
||||
* Pointer to the last line of the lib.stub section. This line is always 0 and
|
||||
* is known as ".lib.stub.btm".
|
||||
*/
|
||||
void *stubEnd;
|
||||
} SceModuleInfo;
|
||||
|
||||
/*
|
||||
* Entry thread structure - an entry thread is used for executing the
|
||||
* module entry functions.
|
||||
*/
|
||||
typedef struct {
|
||||
/* The number of entry thread parameters, typically 3. */
|
||||
u32 numParams;
|
||||
/* The initial priority of the entry thread. */
|
||||
u32 initPriority;
|
||||
/* The stack size of the entry thread. */
|
||||
u32 stackSize;
|
||||
/* The attributes of the entry thread. */
|
||||
u32 attr;
|
||||
} SceModuleEntryThread;
|
||||
|
||||
extern char _gp[];
|
||||
|
||||
/**
|
||||
* Module type attributes.
|
||||
*/
|
||||
enum SceModuleAttribute {
|
||||
/** No module attributes. */
|
||||
SCE_MODULE_ATTR_NONE = 0x0000,
|
||||
/** Resident module - stays in memory. You cannot unload such a module. */
|
||||
SCE_MODULE_ATTR_CANT_STOP = 0x0001,
|
||||
/**
|
||||
* Only one instance of the module (one version) can be loaded into the system. If you want to load another
|
||||
* version of that module, you have to delete the loaded version first.
|
||||
*/
|
||||
SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
|
||||
/**
|
||||
* Only one instance of the module (one version) can be started. If you want to start another
|
||||
* version of that module, you have to stop the currently running version first.
|
||||
*/
|
||||
SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
|
||||
};
|
||||
|
||||
/**
|
||||
* Module Privilege Levels - These levels define the permissions a
|
||||
* module can have.
|
||||
*/
|
||||
enum SceModulePrivilegeLevel {
|
||||
/** Lowest permission. */
|
||||
SCE_MODULE_USER = 0x0000,
|
||||
/** POPS/Demo. */
|
||||
SCE_MODULE_MS = 0x0200,
|
||||
/** Module Gamesharing. */
|
||||
SCE_MODULE_USB_WLAN = 0x0400,
|
||||
/** Application module. */
|
||||
SCE_MODULE_APP = 0x0600,
|
||||
/** VSH module. */
|
||||
SCE_MODULE_VSH = 0x0800,
|
||||
/** Highest permission. */
|
||||
SCE_MODULE_KERNEL = 0x1000,
|
||||
/** The module uses KIRK's memlmd resident library. */
|
||||
SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
|
||||
/** The module uses KIRK's semaphore resident library. */
|
||||
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
|
||||
};
|
||||
|
||||
#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
|
||||
|
||||
/** Release X.Y.Z -> 0xXXYYZZZZ */
|
||||
#define SDK_VERSION 0x06060010
|
||||
#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
|
||||
|
||||
#define SCE_MODULE_BOOTSTART(name) int module_start(int arglen, void *argp) __attribute__((alias(name))); \
|
||||
int module_bootstart(int arglen, void *argp) __attribute__((alias(name)))
|
||||
|
||||
#define SCE_MODULE_REBOOT_BEFORE(name) int module_reboot_before(void) __attribute__((alias(name)))
|
||||
#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(void) __attribute__((alias(name)))
|
||||
#define SCE_MODULE_STOP(name) int module_stop(void) __attribute__((alias(name)))
|
||||
|
||||
#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
|
||||
__asm__ ( \
|
||||
" .set push\n" \
|
||||
" .section .lib.ent.top, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
" .word 0\n" \
|
||||
"__lib_ent_top:\n" \
|
||||
" .section .lib.ent.btm, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
"__lib_ent_bottom:\n" \
|
||||
" .word 0\n" \
|
||||
" .section .lib.stub.top, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
" .word 0\n" \
|
||||
"__lib_stub_top:\n" \
|
||||
" .section .lib.stub.btm, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
"__lib_stub_bottom:\n" \
|
||||
" .word 0\n" \
|
||||
" .set pop\n" \
|
||||
" .text\n" \
|
||||
); \
|
||||
extern char __lib_ent_top[], __lib_ent_bottom[]; \
|
||||
extern char __lib_stub_top[], __lib_stub_bottom[]; \
|
||||
const SceModuleInfo module_info \
|
||||
__attribute__((section(SCE_MODINFO_SECTION_NAME), \
|
||||
aligned(16), unused)) = { \
|
||||
attributes, { minorVersion, majorVersion }, name, 0, _gp, \
|
||||
__lib_ent_top, __lib_ent_bottom, \
|
||||
__lib_stub_top, __lib_stub_bottom \
|
||||
}
|
||||
|
||||
#define SCE_MODULE_START_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
|
||||
const SceModuleEntryThread module_start_thread_parameter = { numParams, initPriority, stackSize, attr };
|
||||
|
||||
#define SCE_MODULE_STOP_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
|
||||
const SceModuleEntryThread module_stop_thread_parameter = { numParams, initPriority, stackSize, attr };
|
||||
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED
|
||||
# error "Only include common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
#include "../pspmoduleexport.h"
|
||||
|
||||
/** The maximum length of a module name. */
|
||||
#define SCE_MODULE_NAME_LEN (27)
|
||||
|
||||
/** SceModuleInfo.modVersion */
|
||||
#define MODULE_VERSION_MINOR (0)
|
||||
#define MODULE_VERSION_MAJOR (1)
|
||||
#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
|
||||
|
||||
/** Module Info section data. */
|
||||
typedef struct {
|
||||
/**
|
||||
* The attributes of a module. Bitwise OR'ed values from ::SceModuleAttribute
|
||||
* and ::SceModulePrivilegeLevel.
|
||||
*/
|
||||
u16 modAttribute;
|
||||
/** The module version. Contains two number categories, minor, major. */
|
||||
u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
|
||||
/** The name of the module. */
|
||||
char modName[SCE_MODULE_NAME_LEN];
|
||||
/** String terminator (always '\0'). */
|
||||
s8 terminal;
|
||||
/** The global pointer of the module. */
|
||||
void *gpValue;
|
||||
/**
|
||||
* Pointer to the first resident library entry table of the module.
|
||||
* This section is known as ".lib.ent".
|
||||
*/
|
||||
void *entTop;
|
||||
/**
|
||||
* Pointer to the last line of the .lib.ent section. This line is always 0 and
|
||||
* is known as ".lib.ent.btm".
|
||||
*/
|
||||
void *entEnd;
|
||||
/**
|
||||
* Pointer to the first stub library entry table of the module.
|
||||
* This section is known as "lib.stub".
|
||||
*/
|
||||
void *stubTop;
|
||||
/**
|
||||
* Pointer to the last line of the lib.stub section. This line is always 0 and
|
||||
* is known as ".lib.stub.btm".
|
||||
*/
|
||||
void *stubEnd;
|
||||
} SceModuleInfo;
|
||||
|
||||
/*
|
||||
* Entry thread structure - an entry thread is used for executing the
|
||||
* module entry functions.
|
||||
*/
|
||||
typedef struct {
|
||||
/* The number of entry thread parameters, typically 3. */
|
||||
u32 numParams;
|
||||
/* The initial priority of the entry thread. */
|
||||
u32 initPriority;
|
||||
/* The stack size of the entry thread. */
|
||||
u32 stackSize;
|
||||
/* The attributes of the entry thread. */
|
||||
u32 attr;
|
||||
} SceModuleEntryThread;
|
||||
|
||||
extern char _gp[];
|
||||
|
||||
/**
|
||||
* Module type attributes.
|
||||
*/
|
||||
enum SceModuleAttribute {
|
||||
/** No module attributes. */
|
||||
SCE_MODULE_ATTR_NONE = 0x0000,
|
||||
/** Resident module - stays in memory. You cannot unload such a module. */
|
||||
SCE_MODULE_ATTR_CANT_STOP = 0x0001,
|
||||
/**
|
||||
* Only one instance of the module (one version) can be loaded into the system. If you want to load another
|
||||
* version of that module, you have to delete the loaded version first.
|
||||
*/
|
||||
SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
|
||||
/**
|
||||
* Only one instance of the module (one version) can be started. If you want to start another
|
||||
* version of that module, you have to stop the currently running version first.
|
||||
*/
|
||||
SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
|
||||
};
|
||||
|
||||
/**
|
||||
* Module Privilege Levels - These levels define the permissions a
|
||||
* module can have.
|
||||
*/
|
||||
enum SceModulePrivilegeLevel {
|
||||
/** Lowest permission. */
|
||||
SCE_MODULE_USER = 0x0000,
|
||||
/** POPS/Demo. */
|
||||
SCE_MODULE_MS = 0x0200,
|
||||
/** Module Gamesharing. */
|
||||
SCE_MODULE_USB_WLAN = 0x0400,
|
||||
/** Application module. */
|
||||
SCE_MODULE_APP = 0x0600,
|
||||
/** VSH module. */
|
||||
SCE_MODULE_VSH = 0x0800,
|
||||
/** Highest permission. */
|
||||
SCE_MODULE_KERNEL = 0x1000,
|
||||
/** The module uses KIRK's memlmd resident library. */
|
||||
SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
|
||||
/** The module uses KIRK's semaphore resident library. */
|
||||
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
|
||||
};
|
||||
|
||||
#define SCE_MODULE_PRIVILEGE_LEVELS (SCE_MODULE_MS | SCE_MODULE_USB_WLAN | SCE_MODULE_APP | SCE_MODULE_VSH | SCE_MODULE_KERNEL)
|
||||
|
||||
#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
|
||||
|
||||
#define SDK_VERSION 0x06060010 /** Release X.Y.Z -> 0xXXYYZZZZ */
|
||||
#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
|
||||
|
||||
/**
|
||||
* module START thread return value
|
||||
*/
|
||||
#define SCE_KERNEL_START_SUCCESS (0) /** The module could be started successfully. */
|
||||
#define SCE_KERNEL_START_FAIL (1) /** The module could not be started successfully. */
|
||||
|
||||
#define SCE_KERNEL_RESIDENT (SCE_KERNEL_START_SUCCESS) /** After executing its start function, the module will remain in memory (resident library). */
|
||||
#define SCE_KERNEL_NO_RESIDENT (SCE_KERNEL_START_FAIL) /** The module will be unloaded after executing its start function. */
|
||||
|
||||
/**
|
||||
* module STOP thread return value
|
||||
*/
|
||||
#define SCE_KERNEL_STOP_SUCCESS (0) /** The module could be stopped successfully. */
|
||||
#define SCE_KERNEL_STOP_FAIL (1) /** The module could not be stopped successfully. */
|
||||
|
||||
/**
|
||||
* Module entry functions.
|
||||
*/
|
||||
#define SCE_MODULE_BOOTSTART(name) int module_start(int arglen, void *argp) __attribute__((alias(name))); \
|
||||
int module_bootstart(int arglen, void *argp) __attribute__((alias(name)))
|
||||
|
||||
#define SCE_MODULE_REBOOT_BEFORE(name) int module_reboot_before(void) __attribute__((alias(name)))
|
||||
#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(void) __attribute__((alias(name)))
|
||||
#define SCE_MODULE_STOP(name) int module_stop(void) __attribute__((alias(name)))
|
||||
|
||||
#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
|
||||
__asm__ ( \
|
||||
" .set push\n" \
|
||||
" .section .lib.ent.top, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
" .word 0\n" \
|
||||
"__lib_ent_top:\n" \
|
||||
" .section .lib.ent.btm, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
"__lib_ent_bottom:\n" \
|
||||
" .word 0\n" \
|
||||
" .section .lib.stub.top, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
" .word 0\n" \
|
||||
"__lib_stub_top:\n" \
|
||||
" .section .lib.stub.btm, \"a\", @progbits\n" \
|
||||
" .align 2\n" \
|
||||
"__lib_stub_bottom:\n" \
|
||||
" .word 0\n" \
|
||||
" .set pop\n" \
|
||||
" .text\n" \
|
||||
); \
|
||||
extern char __lib_ent_top[], __lib_ent_bottom[]; \
|
||||
extern char __lib_stub_top[], __lib_stub_bottom[]; \
|
||||
const SceModuleInfo module_info \
|
||||
__attribute__((section(SCE_MODINFO_SECTION_NAME), \
|
||||
aligned(16), unused)) = { \
|
||||
attributes, { minorVersion, majorVersion }, name, 0, _gp, \
|
||||
__lib_ent_top, __lib_ent_bottom, \
|
||||
__lib_stub_top, __lib_stub_bottom \
|
||||
}
|
||||
|
||||
#define SCE_MODULE_START_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
|
||||
const SceModuleEntryThread module_start_thread_parameter = { numParams, initPriority, stackSize, attr };
|
||||
|
||||
#define SCE_MODULE_STOP_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
|
||||
const SceModuleEntryThread module_stop_thread_parameter = { numParams, initPriority, stackSize, attr };
|
||||
|
||||
|
@ -50,6 +50,7 @@ typedef volatile int64_t vs64;
|
||||
|
||||
/* ID of most kernel objects */
|
||||
typedef s32 SceUID;
|
||||
#define SCE_UID_NAME_LEN 31 /* Maximum name length of a kernel object. */
|
||||
|
||||
/* Size, unsigned or signed (for memory blocks, etc.) */
|
||||
typedef u32 SceSize;
|
||||
@ -83,7 +84,7 @@ typedef s32 SceBool;
|
||||
typedef void SceVoid;
|
||||
typedef void * ScePVoid;
|
||||
|
||||
/* Permission mode when creating a file (in octal, like the chmod function and UNIX command */
|
||||
/* Permission mode when creating a file (in octal, like the chmod function and UNIX command) */
|
||||
typedef s32 SceMode;
|
||||
/* An offset inside a file */
|
||||
typedef SceInt64 SceOff;
|
||||
|
@ -1,286 +1,306 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
#define SCE_O_RDONLY 0x0001
|
||||
#define SCE_O_WRONLY 0x0002
|
||||
#define SCE_O_RDWR (SCE_O_RDONLY | SCE_O_WRONLY)
|
||||
#define SCE_O_NBLOCK 0x0004
|
||||
#define SCE_O_DIROPEN 0x0008 // Internal use for dopen
|
||||
#define SCE_O_APPEND 0x0100
|
||||
#define SCE_O_CREAT 0x0200
|
||||
#define SCE_O_TRUNC 0x0400
|
||||
#define SCE_O_EXCL 0x0800
|
||||
#define SCE_O_NOWAIT 0x8000
|
||||
#define SCE_O_UNKNOWN0 0x04000000
|
||||
|
||||
/** user read/write/execute permission. */
|
||||
#define SCE_STM_RWXU 00700
|
||||
/** user read permission. */
|
||||
#define SCE_STM_RUSR 00400
|
||||
/** user write permission. */
|
||||
#define SCE_STM_WUSR 00200
|
||||
/** user execute permission. */
|
||||
#define SCE_STM_XUSR 00100
|
||||
|
||||
/** group read/write/execute permission. */
|
||||
#define SCE_STM_RWXG 00070
|
||||
/** group read permission. */
|
||||
#define SCE_STM_RGRP 00040
|
||||
/** group write permission. */
|
||||
#define SCE_STM_WGRP 00020
|
||||
/** group execute permission. */
|
||||
#define SCE_STM_XGRP 00010
|
||||
|
||||
/** other read/write/execute permission. */
|
||||
#define SCE_STM_RWXO 00007
|
||||
/** other read permission. */
|
||||
#define SCE_STM_ROTH 00004
|
||||
/** other write permission. */
|
||||
#define SCE_STM_WOTH 00002
|
||||
/** other execute permission. */
|
||||
#define SCE_STM_XOTH 00001
|
||||
|
||||
/** user/group/other - read/write/execute. */
|
||||
#define SCE_STM_RWXUGO (SCE_STM_RWXU|SCE_STM_RWXG|SCE_STM_RWXO)
|
||||
/** user/group/other - read. */
|
||||
#define SCE_STM_RUGO (SCE_STM_RUSR|SCE_STM_RGRP|SCE_STM_ROTH)
|
||||
/** user/group/other - write. */
|
||||
#define SCE_STM_WUGO (SCE_STM_WUSR|SCE_STM_WGRP|SCE_STM_WOTH)
|
||||
/** user/group/other - execute. */
|
||||
#define SCE_STM_XUGO (SCE_STM_XUSR|SCE_STM_XGRP|SCE_STM_XOTH)
|
||||
|
||||
#define SCE_SEEK_SET 0
|
||||
#define SCE_SEEK_CUR 1
|
||||
#define SCE_SEEK_END 2
|
||||
|
||||
typedef struct ScePspDateTime {
|
||||
u16 year;
|
||||
u16 month;
|
||||
u16 day;
|
||||
u16 hour;
|
||||
u16 minute;
|
||||
u16 second;
|
||||
u32 microsecond;
|
||||
} ScePspDateTime;
|
||||
|
||||
struct SceIoDeviceArg;
|
||||
typedef struct SceIoDeviceArg SceIoDeviceArg;
|
||||
struct SceIoIob;
|
||||
typedef struct SceIoIob SceIoIob;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceMode st_mode;
|
||||
u32 st_attr;
|
||||
SceOff st_size;
|
||||
ScePspDateTime st_ctime;
|
||||
ScePspDateTime st_atime;
|
||||
ScePspDateTime st_mtime;
|
||||
u32 st_private[6];
|
||||
} SceIoStat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceIoStat d_stat;
|
||||
char d_name[256];
|
||||
void *d_private;
|
||||
int dummy;
|
||||
} SceIoDirent;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*IoInit)(SceIoDeviceArg *dev);
|
||||
int (*IoExit)(SceIoDeviceArg *dev);
|
||||
int (*IoOpen)(SceIoIob *iob, char *file, int flags, SceMode mode);
|
||||
int (*IoClose)(SceIoIob *iob);
|
||||
int (*IoRead)(SceIoIob *iob, char *data, int len);
|
||||
int (*IoWrite)(SceIoIob *iob, const char *data, int len);
|
||||
SceOff (*IoLseek)(SceIoIob *iob, SceOff ofs, int whence);
|
||||
int (*IoIoctl)(SceIoIob *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int (*IoRemove)(SceIoIob *iob, const char *name);
|
||||
int (*IoMkdir)(SceIoIob *iob, const char *name, SceMode mode);
|
||||
int (*IoRmdir)(SceIoIob *iob, const char *name);
|
||||
int (*IoDopen)(SceIoIob *iob, const char *dirname);
|
||||
int (*IoDclose)(SceIoIob *iob);
|
||||
int (*IoDread)(SceIoIob *iob, SceIoDirent *dir);
|
||||
int (*IoGetstat)(SceIoIob *iob, const char *file, SceIoStat *stat);
|
||||
int (*IoChstat)(SceIoIob *iob, const char *file, SceIoStat *stat, int bits);
|
||||
int (*IoRename)(SceIoIob *iob, const char *oldname, const char *newname);
|
||||
int (*IoChdir)(SceIoIob *iob, const char *dir);
|
||||
int (*IoMount)(SceIoIob *iob, const char *fs, const char *blockDev, int mode, void *unk1, int unk2);
|
||||
int (*IoUmount)(SceIoIob *iob, const char *blockDev);
|
||||
int (*IoDevctl)(SceIoIob *iob, const char *devname, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int (*IoCancel)(SceIoIob *iob);
|
||||
} SceIoDrvFuncs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
u32 dev_type;
|
||||
u32 unk2;
|
||||
const char *name2;
|
||||
SceIoDrvFuncs *funcs;
|
||||
} SceIoDrv;
|
||||
|
||||
struct SceIoDeviceArg
|
||||
{
|
||||
SceIoDrv *drv;
|
||||
void *argp;
|
||||
int openedFiles;
|
||||
};
|
||||
|
||||
struct SceIoHookType;
|
||||
typedef struct SceIoHookType SceIoHookType;
|
||||
|
||||
struct SceIoHook;
|
||||
typedef struct SceIoHook SceIoHook;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*Add)(SceIoHookType **hook);
|
||||
int unused4;
|
||||
int (*Preobe)(SceIoHook *hook, char *file, int flags, SceMode mode);
|
||||
int (*Open)(SceIoHook *hook, char *file, int flags, SceMode mode);
|
||||
int (*Close)(SceIoHook *hook);
|
||||
int (*Read)(SceIoHook *hook, void *data, SceSize size);
|
||||
int (*Write)(SceIoHook *hook, const void *data, SceSize size);
|
||||
SceOff (*Lseek)(SceIoHook *hook, SceOff ofs, int whence);
|
||||
int (*Ioctl)(SceIoHook *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
} SceIoHookFuncs;
|
||||
|
||||
struct SceIoHookType
|
||||
{
|
||||
char *name;
|
||||
int unk4;
|
||||
int unk8;
|
||||
char *name2;
|
||||
SceIoHookFuncs *funcs;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int size; // 0
|
||||
char name[32]; // 4
|
||||
int attribute; // 36
|
||||
int unk40; // 40
|
||||
const char *drvName; // 44
|
||||
int fsNum; // 48
|
||||
char *newPath; // 52
|
||||
int retAddr; // 56
|
||||
int curThread; // 60
|
||||
int asyncThread; // 64
|
||||
int isAsync; // 68
|
||||
int asyncCmd; // 72
|
||||
SceIoIob *iob; // 76
|
||||
int unk80; // 80
|
||||
int unk84; // 84
|
||||
} SceIoFdDebugInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceIoHookType *hook;
|
||||
void *argp;
|
||||
} SceIoHookArg;
|
||||
|
||||
struct SceIoHook
|
||||
{
|
||||
SceIoHookArg *arg;
|
||||
SceIoIob *iob;
|
||||
SceIoDrvFuncs *funcs;
|
||||
};
|
||||
|
||||
struct SceIoIob
|
||||
{
|
||||
int unk000; // some ID
|
||||
int fsNum; // 4
|
||||
SceIoDeviceArg *dev; // 8
|
||||
int dev_type; // 12
|
||||
int unk016; // 16
|
||||
int unk020; // 20
|
||||
int unk024; // 24
|
||||
int unk028; // 28
|
||||
int unk032; // 32
|
||||
int unk036; // 36
|
||||
int unk040; // 40
|
||||
SceUID curThread; // 44
|
||||
char userMode; // 48
|
||||
char powerLocked; // 49
|
||||
char unk050;
|
||||
char asyncPrio; // 51
|
||||
SceUID asyncThread; // 52
|
||||
SceUID asyncSema; // 56
|
||||
SceUID asyncEvFlag; // 60
|
||||
SceUID asyncCb; // 64
|
||||
void *asyncCbArgp; // 68
|
||||
int unused72; // 72
|
||||
int k1; // 76
|
||||
s64 asyncRet; // 80
|
||||
int asyncArgs[6]; // 88
|
||||
int asyncCmd; // 112
|
||||
int userLevel; // 116
|
||||
SceIoHook hook; // 120
|
||||
int unk132; // 132
|
||||
char *newPath; // 136
|
||||
int retAddr; // 140
|
||||
};
|
||||
|
||||
int sceIoChangeAsyncPriority(int fd, int prio);
|
||||
void sceIoCloseAll();
|
||||
int sceIoReopen(const char *file, int flags, SceMode mode, int fd);
|
||||
SceUID sceIoDopen(const char *dirname);
|
||||
int sceIoDread(int fd, SceIoDirent *dir);
|
||||
int sceIoDclose(int fd);
|
||||
int sceIoRemove(const char *file);
|
||||
int sceIoRename(const char *oldname, const char *newname);
|
||||
int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
|
||||
/* IO-Assign mount mode flags. */
|
||||
#define SCE_MT_RDWR 0x00 /** Mount as read/write enabled. */
|
||||
#define SCE_MT_RDONLY 0x01 /** Mount as read-only. */
|
||||
#define SCE_MT_ROBUST 0x02 /** Mount in ROBUST mode. */
|
||||
#define SCE_MT_ERRCHECK 0x04 /** Set an error if there is anythign abnormal in the file system when mounting. */
|
||||
|
||||
int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode, void* unk1, int unk2);
|
||||
int sceIoUnassign(const char *dev);
|
||||
int sceIoChangeThreadCwd(SceUID threadId, const char *path);
|
||||
int sceIoCancel(int fd);
|
||||
int sceIoGetFdList(SceUID *fds, int numFd, int *count);
|
||||
int sceIoGetFdDebugInfo(int fd, SceIoFdDebugInfo *outInfo);
|
||||
int sceIoAddDrv(SceIoDrv *drv);
|
||||
int sceIoDelDrv(const char *drv);
|
||||
int sceIoGetUID(int fd);
|
||||
int sceIoPollAsync(SceUID fd, SceInt64 *res);
|
||||
int sceIoWaitAsync(SceUID fd, SceInt64 *res);
|
||||
int sceIoWaitAsyncCB(SceUID fd, SceInt64 *res);
|
||||
int sceIoGetAsyncStat(SceUID fd, int poll, SceInt64 *res);
|
||||
int sceIoSetAsyncCallback(SceUID fd, SceUID cb, void *argp);
|
||||
int sceIoValidateFd(SceUID fd, int arg1);
|
||||
int sceIoClose(SceUID fd);
|
||||
int sceIoCloseAsync(SceUID fd);
|
||||
SceUID sceIoOpen(const char *file, int flags, SceMode mode);
|
||||
SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode);
|
||||
int sceIoRead(SceUID fd, void *data, SceSize size);
|
||||
int sceIoReadAsync(SceUID fd, void *data, SceSize size);
|
||||
int sceIoWrite(SceUID fd, const void *data, SceSize size);
|
||||
int sceIoWriteAsync(SceUID fd, const void *data, SceSize size);
|
||||
SceOff sceIoLseek(SceUID fd, SceOff offset, int whence);
|
||||
SceOff sceIoLseekAsync(SceUID fd, SceOff offset, int whence);
|
||||
int sceIoLseek32(SceUID fd, int offset, int whence);
|
||||
int sceIoLseek32Async(SceUID fd, int offset, int whence);
|
||||
int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int sceIoMkdir(const char *path, SceMode mode);
|
||||
int sceIoRmdir(const char *path);
|
||||
int sceIoChdir(const char *path);
|
||||
int sceIoGetstat(const char *file, SceIoStat *stat);
|
||||
int sceIoChstat(const char *file, SceIoStat *stat, int bits);
|
||||
int sceIoSync(const char *device, unsigned int unk);
|
||||
int sceIoGetDevType(SceUID fd);
|
||||
int sceIoGetThreadCwd(SceUID uid, char *dir, int len);
|
||||
int sceIoTerminateFd(char *drive);
|
||||
int sceIoAddHook(SceIoHookType *hook);
|
||||
int sceIoGetIobUserLevel(SceIoIob *iob);
|
||||
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
/* flags */
|
||||
#define SCE_FREAD (0x0001) /* readable */
|
||||
#define SCE_FWRITE (0x0002) /* writable */
|
||||
#define SCE_FNBLOCK (0x0004) /* Reserved: non-blocking reads */
|
||||
#define SCE_FDIRO (0x0008) /* internal use for dopen */
|
||||
#define SCE_FRLOCK (0x0010) /* Reserved: read locked (non-shared) */
|
||||
#define SCE_FWLOCK (0x0020) /* Reserved: write locked (non-shared) */
|
||||
#define SCE_FAPPEND (0x0100) /* append on each write */
|
||||
#define SCE_FCREAT (0x0200) /* create if nonexistant */
|
||||
#define SCE_FTRUNC (0x0400) /* truncate to zero length */
|
||||
#define SCE_EXCL (0x0800) /* exclusive create */
|
||||
#define SCE_FSCAN (0x1000) /* Reserved: scan type */
|
||||
#define SCE_FRCOM (0x2000) /* Reserved: remote command entry */
|
||||
#define SCE_FNBUF (0x4000) /* Reserved: no ring buf. and console interrupt */
|
||||
#define SCE_FASYNC (0x8000) /* Reserved: asyncronous i/o */
|
||||
#define SCE_FFDEXCL (0x01000000) /* exclusive access */
|
||||
#define SCE_FPWLOCK (0x02000000) /* power control lock */
|
||||
#define SCE_FENCRYPTED (0x04000000)
|
||||
#define SCE_FGAMEDATA (0x40000000)
|
||||
|
||||
/* flags for sceIoOpen() */
|
||||
#define SCE_O_RDONLY (SCE_FREAD) /* readable */
|
||||
#define SCE_O_WRONLY (SCE_FWRITE) /* writable */
|
||||
#define SCE_O_RDWR (SCE_FREAD|SCE_FWRITE) /* readable & writable */
|
||||
#define SCE_O_NBLOCK (SCE_FNBLOCK) /* Reserved: Non-Blocking I/O */
|
||||
#define SCE_O_APPEND (SCE_FAPPEND) /* append (writes guaranteed at the end) */
|
||||
#define SCE_O_CREAT (SCE_FCREAT) /* open with file create */
|
||||
#define SCE_O_TRUNC (SCE_FTRUNC) /* open with truncation */
|
||||
#define SCE_O_EXCL (SCE_EXCL) /* exclusive create */
|
||||
#define SCE_O_NOBUF (SCE_FNBUF) /* Reserved: no device buffer and console interrupt */
|
||||
#define SCE_O_NOWAIT (SCE_FASYNC) /* Reserved: asyncronous i/o */
|
||||
#define SCE_O_FDEXCL (SCE_FFDEXCL) /* exclusive access */
|
||||
#define SCE_O_PWLOCK (SCE_FPWLOCK) /* power control lock */
|
||||
#define SCE_O_ENCRYPTED (SCE_FENCRYPTED) /* encrypted file (uses Kernel/DNAS/NPDRM-encryption) */
|
||||
#define SCE_O_FGAMEDATA (SCE_FGAMEDATA)
|
||||
|
||||
/* sceIoOpen().mode permission bits */
|
||||
#define SCE_STM_RWXU 00700 /* user read/write/execute permission. */
|
||||
#define SCE_STM_RUSR 00400 /* user read permission. */
|
||||
#define SCE_STM_WUSR 00200 /* user write permission. */
|
||||
#define SCE_STM_XUSR 00100 /* user execute permission. */
|
||||
|
||||
#define SCE_STM_RWXG 00070 /* group read/write/execute permission. */
|
||||
#define SCE_STM_RGRP 00040 /* group read permission. */
|
||||
#define SCE_STM_WGRP 00020 /* group write permission. */
|
||||
#define SCE_STM_XGRP 00010 /* group execute permission. */
|
||||
|
||||
#define SCE_STM_RWXO 00007 /* other read/write/execute permission. */
|
||||
#define SCE_STM_ROTH 00004 /* other read permission. */
|
||||
#define SCE_STM_WOTH 00002 /* other write permission. */
|
||||
#define SCE_STM_XOTH 00001 /* other execute permission. */
|
||||
|
||||
#define SCE_STM_RWXUGO (SCE_STM_RWXU|SCE_STM_RWXG|SCE_STM_RWXO) /* user/group/other - read/write/execute. */
|
||||
#define SCE_STM_RUGO (SCE_STM_RUSR|SCE_STM_RGRP|SCE_STM_ROTH) /* user/group/other - read. */
|
||||
#define SCE_STM_WUGO (SCE_STM_WUSR|SCE_STM_WGRP|SCE_STM_WOTH) /* user/group/other - write. */
|
||||
#define SCE_STM_XUGO (SCE_STM_XUSR|SCE_STM_XGRP|SCE_STM_XOTH) /* user/group/other - execute. */
|
||||
|
||||
/* flags for sceIoLseek().whence */
|
||||
#define SCE_SEEK_SET 0 /* Offset is the distance from the start of the file. */
|
||||
#define SCE_SEEK_CUR 1 /* Offset is the relative distance from the current position in the file. */
|
||||
#define SCE_SEEK_END 2 /* Offset is the distance from the end of the file. */
|
||||
|
||||
typedef struct ScePspDateTime {
|
||||
u16 year;
|
||||
u16 month;
|
||||
u16 day;
|
||||
u16 hour;
|
||||
u16 minute;
|
||||
u16 second;
|
||||
u32 microsecond;
|
||||
} ScePspDateTime;
|
||||
|
||||
struct SceIoDeviceArg;
|
||||
typedef struct SceIoDeviceArg SceIoDeviceArg;
|
||||
struct SceIoIob;
|
||||
typedef struct SceIoIob SceIoIob;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceMode st_mode;
|
||||
u32 st_attr;
|
||||
SceOff st_size;
|
||||
ScePspDateTime st_ctime;
|
||||
ScePspDateTime st_atime;
|
||||
ScePspDateTime st_mtime;
|
||||
u32 st_private[6];
|
||||
} SceIoStat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceIoStat d_stat;
|
||||
char d_name[256];
|
||||
void *d_private;
|
||||
int dummy;
|
||||
} SceIoDirent;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*IoInit)(SceIoDeviceArg *dev);
|
||||
int (*IoExit)(SceIoDeviceArg *dev);
|
||||
int (*IoOpen)(SceIoIob *iob, char *file, int flags, SceMode mode);
|
||||
int (*IoClose)(SceIoIob *iob);
|
||||
int (*IoRead)(SceIoIob *iob, char *data, int len);
|
||||
int (*IoWrite)(SceIoIob *iob, const char *data, int len);
|
||||
SceOff (*IoLseek)(SceIoIob *iob, SceOff ofs, int whence);
|
||||
int (*IoIoctl)(SceIoIob *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int (*IoRemove)(SceIoIob *iob, const char *name);
|
||||
int (*IoMkdir)(SceIoIob *iob, const char *name, SceMode mode);
|
||||
int (*IoRmdir)(SceIoIob *iob, const char *name);
|
||||
int (*IoDopen)(SceIoIob *iob, const char *dirname);
|
||||
int (*IoDclose)(SceIoIob *iob);
|
||||
int (*IoDread)(SceIoIob *iob, SceIoDirent *dir);
|
||||
int (*IoGetstat)(SceIoIob *iob, const char *file, SceIoStat *stat);
|
||||
int (*IoChstat)(SceIoIob *iob, const char *file, SceIoStat *stat, int bits);
|
||||
int (*IoRename)(SceIoIob *iob, const char *oldname, const char *newname);
|
||||
int (*IoChdir)(SceIoIob *iob, const char *dir);
|
||||
int (*IoMount)(SceIoIob *iob, const char *fs, const char *blockDev, int mode, void *unk1, int unk2);
|
||||
int (*IoUmount)(SceIoIob *iob, const char *blockDev);
|
||||
int (*IoDevctl)(SceIoIob *iob, const char *devname, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int (*IoCancel)(SceIoIob *iob);
|
||||
} SceIoDrvFuncs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
u32 dev_type;
|
||||
u32 unk2;
|
||||
const char *name2;
|
||||
SceIoDrvFuncs *funcs;
|
||||
} SceIoDrv;
|
||||
|
||||
struct SceIoDeviceArg
|
||||
{
|
||||
SceIoDrv *drv;
|
||||
void *argp;
|
||||
int openedFiles;
|
||||
};
|
||||
|
||||
struct SceIoHookType;
|
||||
typedef struct SceIoHookType SceIoHookType;
|
||||
|
||||
struct SceIoHook;
|
||||
typedef struct SceIoHook SceIoHook;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*Add)(SceIoHookType **hook);
|
||||
int unused4;
|
||||
int (*Preobe)(SceIoHook *hook, char *file, int flags, SceMode mode);
|
||||
int (*Open)(SceIoHook *hook, char *file, int flags, SceMode mode);
|
||||
int (*Close)(SceIoHook *hook);
|
||||
int (*Read)(SceIoHook *hook, void *data, SceSize size);
|
||||
int (*Write)(SceIoHook *hook, const void *data, SceSize size);
|
||||
SceOff (*Lseek)(SceIoHook *hook, SceOff ofs, int whence);
|
||||
int (*Ioctl)(SceIoHook *iob, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
} SceIoHookFuncs;
|
||||
|
||||
struct SceIoHookType
|
||||
{
|
||||
char *name;
|
||||
int unk4;
|
||||
int unk8;
|
||||
char *name2;
|
||||
SceIoHookFuncs *funcs;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int size; // 0
|
||||
char name[32]; // 4
|
||||
int attribute; // 36
|
||||
int unk40; // 40
|
||||
const char *drvName; // 44
|
||||
int fsNum; // 48
|
||||
char *newPath; // 52
|
||||
int retAddr; // 56
|
||||
int curThread; // 60
|
||||
int asyncThread; // 64
|
||||
int isAsync; // 68
|
||||
int asyncCmd; // 72
|
||||
SceIoIob *iob; // 76
|
||||
int unk80; // 80
|
||||
int unk84; // 84
|
||||
} SceIoFdDebugInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SceIoHookType *hook;
|
||||
void *argp;
|
||||
} SceIoHookArg;
|
||||
|
||||
struct SceIoHook
|
||||
{
|
||||
SceIoHookArg *arg;
|
||||
SceIoIob *iob;
|
||||
SceIoDrvFuncs *funcs;
|
||||
};
|
||||
|
||||
struct SceIoIob
|
||||
{
|
||||
int unk000; // some ID
|
||||
int fsNum; // 4
|
||||
SceIoDeviceArg *dev; // 8
|
||||
int dev_type; // 12
|
||||
int unk016; // 16
|
||||
int unk020; // 20
|
||||
int unk024; // 24
|
||||
int unk028; // 28
|
||||
int unk032; // 32
|
||||
int unk036; // 36
|
||||
int unk040; // 40
|
||||
SceUID curThread; // 44
|
||||
char userMode; // 48
|
||||
char powerLocked; // 49
|
||||
char unk050;
|
||||
char asyncPrio; // 51
|
||||
SceUID asyncThread; // 52
|
||||
SceUID asyncSema; // 56
|
||||
SceUID asyncEvFlag; // 60
|
||||
SceUID asyncCb; // 64
|
||||
void *asyncCbArgp; // 68
|
||||
int unused72; // 72
|
||||
int k1; // 76
|
||||
s64 asyncRet; // 80
|
||||
int asyncArgs[6]; // 88
|
||||
int asyncCmd; // 112
|
||||
int userLevel; // 116
|
||||
SceIoHook hook; // 120
|
||||
int unk132; // 132
|
||||
char *newPath; // 136
|
||||
int retAddr; // 140
|
||||
};
|
||||
|
||||
int sceIoChangeAsyncPriority(int fd, int prio);
|
||||
void sceIoCloseAll();
|
||||
int sceIoReopen(const char *file, int flags, SceMode mode, int fd);
|
||||
SceUID sceIoDopen(const char *dirname);
|
||||
int sceIoDread(int fd, SceIoDirent *dir);
|
||||
int sceIoDclose(int fd);
|
||||
int sceIoRemove(const char *file);
|
||||
int sceIoRename(const char *oldname, const char *newname);
|
||||
int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
|
||||
/* IO-Assign mount mode flags. */
|
||||
#define SCE_MT_RDWR 0x00 /** Mount as read/write enabled. */
|
||||
#define SCE_MT_RDONLY 0x01 /** Mount as read-only. */
|
||||
#define SCE_MT_ROBUST 0x02 /** Mount in ROBUST mode. */
|
||||
#define SCE_MT_ERRCHECK 0x04 /** Set an error if there is anything abnormal in the file system when mounting. */
|
||||
|
||||
int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode, void* unk1, int unk2);
|
||||
int sceIoUnassign(const char *dev);
|
||||
int sceIoChangeThreadCwd(SceUID threadId, const char *path);
|
||||
int sceIoCancel(int fd);
|
||||
int sceIoGetFdList(SceUID *fds, int numFd, int *count);
|
||||
int sceIoGetFdDebugInfo(int fd, SceIoFdDebugInfo *outInfo);
|
||||
int sceIoAddDrv(SceIoDrv *drv);
|
||||
int sceIoDelDrv(const char *drv);
|
||||
int sceIoGetUID(int fd);
|
||||
int sceIoPollAsync(SceUID fd, SceInt64 *res);
|
||||
int sceIoWaitAsync(SceUID fd, SceInt64 *res);
|
||||
int sceIoWaitAsyncCB(SceUID fd, SceInt64 *res);
|
||||
int sceIoGetAsyncStat(SceUID fd, int poll, SceInt64 *res);
|
||||
int sceIoSetAsyncCallback(SceUID fd, SceUID cb, void *argp);
|
||||
int sceIoValidateFd(SceUID fd, int arg1);
|
||||
int sceIoClose(SceUID fd);
|
||||
int sceIoCloseAsync(SceUID fd);
|
||||
SceUID sceIoOpen(const char *file, int flags, SceMode mode);
|
||||
SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode);
|
||||
int sceIoRead(SceUID fd, void *data, SceSize size);
|
||||
int sceIoReadAsync(SceUID fd, void *data, SceSize size);
|
||||
int sceIoWrite(SceUID fd, const void *data, SceSize size);
|
||||
int sceIoWriteAsync(SceUID fd, const void *data, SceSize size);
|
||||
SceOff sceIoLseek(SceUID fd, SceOff offset, int whence);
|
||||
SceOff sceIoLseekAsync(SceUID fd, SceOff offset, int whence);
|
||||
int sceIoLseek32(SceUID fd, int offset, int whence);
|
||||
int sceIoLseek32Async(SceUID fd, int offset, int whence);
|
||||
|
||||
/* IOCTL */
|
||||
|
||||
/* ioctl commands */
|
||||
#define SCE_GAMEDATA_SET_SECURE_INSTALL_ID (0x04100001)
|
||||
|
||||
int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen);
|
||||
|
||||
/* Directory functions */
|
||||
int sceIoMkdir(const char *path, SceMode mode);
|
||||
int sceIoRmdir(const char *path);
|
||||
int sceIoChdir(const char *path);
|
||||
|
||||
|
||||
int sceIoGetstat(const char *file, SceIoStat *stat);
|
||||
int sceIoChstat(const char *file, SceIoStat *stat, int bits);
|
||||
int sceIoSync(const char *device, unsigned int unk);
|
||||
int sceIoGetDevType(SceUID fd);
|
||||
int sceIoGetThreadCwd(SceUID uid, char *dir, int len);
|
||||
int sceIoTerminateFd(char *drive);
|
||||
int sceIoAddHook(SceIoHookType *hook);
|
||||
int sceIoGetIobUserLevel(SceIoIob *iob);
|
||||
|
||||
|
2436
include/loadcore.h
2436
include/loadcore.h
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/** UMD file system alias name. */
|
||||
#define SCE_UMD_ALIAS_NAME "disc0:"
|
||||
#define SCE_UMD_ALIAS_NAME "disc0:"
|
||||
|
||||
/** LBA raw sector access. */
|
||||
#define SCE_UMD_LBA_DEVICE_NAME "umd1:"
|
||||
@ -52,7 +52,7 @@ extern "C" {
|
||||
*/
|
||||
enum SceUmdDiscStates {
|
||||
/** The UMD driver has been initiated. */
|
||||
SCE_UMD_INIT = (0),
|
||||
SCE_UMD_INIT = (0),
|
||||
/** A medium has been removed. */
|
||||
SCE_UMD_MEDIA_OUT = (1 << 0),
|
||||
/** A medium has been inserted. */
|
||||
@ -62,7 +62,7 @@ enum SceUmdDiscStates {
|
||||
/** The UMD device is not ready. */
|
||||
SCE_UMD_NOT_READY = (1 << 3),
|
||||
/** The UMD device is ready. */
|
||||
SCE_UMD_READY = (1 << 4),
|
||||
SCE_UMD_READY = (1 << 4),
|
||||
/** The inserted medium is readable. */
|
||||
SCE_UMD_READABLE = (1 << 5),
|
||||
};
|
||||
@ -92,9 +92,9 @@ enum SceUmdMediaTypeFormats {
|
||||
|
||||
typedef struct {
|
||||
/** The size of the used SceUmdDiscInfo version. uiSize = sizeof(SceUmdDiscInfo). */
|
||||
SceSize uiSize;
|
||||
SceSize uiSize;
|
||||
/** Defines the media type of the UMD. One of ::SceUmdMediaTypeFormats. */
|
||||
u32 uiMediaType;
|
||||
u32 uiMediaType;
|
||||
} SceUmdDiscInfo;
|
||||
|
||||
|
||||
|
@ -16,11 +16,11 @@ s32 sceMesgLed_driver_B2CDAC3F(u8 *buf, u32 size, u32 *newSize);
|
||||
s32 sceMesgLed_driver_C79E3488(u8 *buf, u32 size, u32 *newSize);
|
||||
s32 sceMesgLed_driver_21AFFAAC(u8 *buf, u32 size, u32 *newSize);
|
||||
s32 sceMesgLed_driver_C00DAD75(u8 *buf, u32 size, u32 *newSize);
|
||||
s32 sceMesgLed_driver_CED2C075(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_C7D1C16B(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_EBB4613D(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_66B348B2(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_CED2C075(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
s32 sceMesgLed_driver_C7D1C16B(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
s32 sceMesgLed_driver_EBB4613D(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
s32 sceMesgLed_driver_66B348B2(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
s32 sceMesgLed_driver_B2D95FDF(u8 *buf, u32 size, u32 *newSize);
|
||||
s32 sceMesgLed_driver_91E0A9AD(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_31D6D8AA(u8 *buf, u32 size, u32 *newSize, u32 arg4);
|
||||
s32 sceMesgLed_driver_91E0A9AD(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
s32 sceMesgLed_driver_31D6D8AA(u8 *buf, u32 size, u32 *newSize, void *arg4);
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/*
|
||||
* modulemgr.h
|
||||
*
|
||||
* The module manager API.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
#ifndef MODULEMGR_H
|
||||
#define MODULEMGR_H
|
||||
|
||||
/** The maximum number of segments a module can have. */
|
||||
#define SCE_KERNEL_MAX_MODULE_SEGMENT (4)
|
||||
|
||||
/** The module could be started successfully. */
|
||||
#define SCE_KERNEL_START_SUCCESS (0)
|
||||
/** The module could not be started successfully. */
|
||||
#define SCE_KERNEL_START_FAIL (1)
|
||||
|
||||
|
||||
/** The module will remain in memory and act as a resident library. */
|
||||
#define SCE_KERNEL_RESIDENT (SCE_KERNEL_START_SUCCESS)
|
||||
|
||||
/** The module is not a resident one, meaning it won't stay in memory and act as a resident library. */
|
||||
#define SCE_KERNEL_NO_RESIDENT (SCE_KERNEL_START_FAIL)
|
||||
|
||||
/** The module could be stopped successfully. */
|
||||
#define SCE_KERNEL_STOP_SUCCESS (0)
|
||||
/** The module could not be stopped successfully. */
|
||||
#define SCE_KERNEL_STOP_FAIL (1)
|
||||
|
||||
enum ModuleMgrMcbStatus {
|
||||
MCB_STATUS_NOT_LOADED = 0,
|
||||
MCB_STATUS_LOADING = 1,
|
||||
MCB_STATUS_LOADED = 2,
|
||||
MCB_STATUS_RELOCATED = 3,
|
||||
MCB_STATUS_STARTING = 4,
|
||||
MCB_STATUS_STARTED = 5,
|
||||
MCB_STATUS_STOPPING = 6,
|
||||
MCB_STATUS_STOPPED = 7,
|
||||
MCB_STATUS_UNLOADED = 8
|
||||
};
|
||||
|
||||
s32 ModuleMgrForKernel_C3DDABEF(SceUID, void *, void *);
|
||||
s32 sceKernelRebootBeforeForUser(void *);
|
||||
s32 sceKernelRebootPhaseForKernel(s32, void *, s32, s32);
|
||||
s32 sceKernelRebootBeforeForKernel(void *, s32, s32, s32);
|
||||
|
||||
#endif /* MODULEMGR_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -57,89 +57,108 @@ enum SceApplicationType {
|
||||
/**
|
||||
* API types of an executable.
|
||||
*/
|
||||
enum SceInitApiType {
|
||||
enum SceFileExecApiType {
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_KERNEL = 0x000,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_KERNEL = 0x002,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_KERNEL_BLOCK = 0x003,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_USER = 0x010,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_MS = 0x011,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_DNAS = 0x013,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_NPDRM = 0x014,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_VSH = 0x020,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_VSH = 0x021,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_USBWLAN = 0x030,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_MS = 0x042,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_APP = 0x043,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_BOOT_INIT_BTCNF = 0x051,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_BOOT_INIT_CONFIG = 0x052,
|
||||
SCE_EXEC_FILE_APITYPE_MODULE_DECI = 0x070,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_UNK0x100 = 0x100,
|
||||
SCE_EXEC_FILE_APITYPE_UNK100 = 0x100,
|
||||
/** GAME EBOOT. */
|
||||
SCE_INIT_APITYPE_GAME_EBOOT = 0x110,
|
||||
SCE_EXEC_FILE_APITYPE_GAME_EBOOT = 0x110,
|
||||
/** GAME BOOT. */
|
||||
SCE_INIT_APITYPE_GAME_BOOT = 0x111,
|
||||
SCE_EXEC_FILE_APITYPE_GAME_BOOT = 0x111,
|
||||
/** Emulated EBOOT Memory-Stick. */
|
||||
SCE_INIT_APITYPE_EMU_EBOOT_MS = 0x112,
|
||||
SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS = 0x112,
|
||||
/** Emulated BOOT Memory-Stick. */
|
||||
SCE_INIT_APITYPE_EMU_BOOT_MS = 0x113,
|
||||
SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS = 0x113,
|
||||
/** Emulated EBOOT EF. */
|
||||
SCE_INIT_APITYPE_EMU_EBOOT_EF = 0x114,
|
||||
SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF = 0x114,
|
||||
/** Emulated BOOT EF. */
|
||||
SCE_INIT_APITYPE_EMU_BOOT_EF = 0x115,
|
||||
SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF = 0x115,
|
||||
/** NP-DRM Memory-Stick. */
|
||||
SCE_INIT_APITYPE_NPDRM_MS = 0x116, /* Distributed programs and data through the Playstation Store. */
|
||||
SCE_EXEC_FILE_APITYPE_NPDRM_MS = 0x116, /* Distributed programs and data through the Playstation Store. */
|
||||
/** Unknown. */
|
||||
SCE_EXEC_FILE_APITYPE_UNK117 = 0x117,
|
||||
/** NP-DRM EF. */
|
||||
SCE_INIT_APITYPE_NPDRM_EF = 0x118, /* NP-DRM: PlayStation Network Platform Digital Rights Management */
|
||||
SCE_EXEC_FILE_APITYPE_NPDRM_EF = 0x118, /* NP-DRM: PlayStation Network Platform Digital Rights Management */
|
||||
/** Unknown. */
|
||||
SCE_EXEC_FILE_APITYPE_UNK119 = 0x119,
|
||||
/** Executable on a disc. */
|
||||
SCE_INIT_APITYPE_DISC = 0x120,
|
||||
SCE_EXEC_FILE_APITYPE_DISC = 0x120,
|
||||
/** Updater executable on a disc.*/
|
||||
SCE_INIT_APITYPE_DISC_UPDATER = 0x121,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_UPDATER = 0x121,
|
||||
/** Disc debugger. */
|
||||
SCE_INIT_APITYPE_DISC_DEBUG = 0x122,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_DEBUG = 0x122,
|
||||
/** NP-9660 game. */
|
||||
SCE_INIT_APITYPE_DISC_EMU_MS1 = 0x123,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1 = 0x123,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_DISC_EMU_MS2 = 0x124,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2 = 0x124,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_DISC_EMU_EF1 = 0x125,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1 = 0x125,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_DISC_EMU_EF2 = 0x126,
|
||||
SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2 = 0x126,
|
||||
/** Game-sharing executable. */
|
||||
SCE_INIT_APITYPE_USBWLAN = 0x130,
|
||||
SCE_EXEC_FILE_APITYPE_USBWLAN = 0x130,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_USBWLAN_DEBUG = 0x131,
|
||||
SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG = 0x131,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_UNK = 0x132,
|
||||
SCE_EXEC_FILE_APITYPE_UNK132 = 0x132,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_UNK_DEBUG = 0x133,
|
||||
SCE_EXEC_FILE_APITYPE_UNK133 = 0x133,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MS1 = 0x140,
|
||||
SCE_EXEC_FILE_APITYPE_MS1 = 0x140,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MS2 = 0x141,
|
||||
SCE_EXEC_FILE_APITYPE_MS2 = 0x141,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MS3 = 0x142,
|
||||
SCE_EXEC_FILE_APITYPE_MS3 = 0x142,
|
||||
/** Applications (i.e. Comic Reader) */
|
||||
SCE_INIT_APITYPE_MS4 = 0x143,
|
||||
SCE_EXEC_FILE_APITYPE_MS4 = 0x143,
|
||||
/** Playstation One executable. */
|
||||
SCE_INIT_APITYPE_MS5 = 0x144,
|
||||
SCE_EXEC_FILE_APITYPE_MS5 = 0x144,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MS6 = 0x145,
|
||||
SCE_EXEC_FILE_APITYPE_MS6 = 0x145,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF1 = 0x151,
|
||||
SCE_EXEC_FILE_APITYPE_EF1 = 0x151,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF2 = 0x152,
|
||||
SCE_EXEC_FILE_APITYPE_EF2 = 0x152,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF3 = 0x153,
|
||||
SCE_EXEC_FILE_APITYPE_EF3 = 0x153,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF4 = 0x154,
|
||||
SCE_EXEC_FILE_APITYPE_EF4 = 0x154,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF5 = 0x155,
|
||||
SCE_EXEC_FILE_APITYPE_EF5 = 0x155,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_EF6 = 0x156,
|
||||
SCE_EXEC_FILE_APITYPE_EF6 = 0x156,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_UNK_GAME1 = 0x160,
|
||||
SCE_EXEC_FILE_APITYPE_UNK160 = 0x160,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_UNK_GAME2 = 0x161,
|
||||
SCE_EXEC_FILE_APITYPE_UNK161 = 0x161,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MLNAPP_MS = 0x170,
|
||||
SCE_EXEC_FILE_APITYPE_MLNAPP_MS = 0x170,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_MLNAPP_EF = 0x171,
|
||||
SCE_EXEC_FILE_APITYPE_MLNAPP_EF = 0x171,
|
||||
/** Unknown. */
|
||||
SCE_INIT_APITYPE_KERNEL_1 = 0x200,
|
||||
SCE_EXEC_FILE_APITYPE_KERNEL_1 = 0x200,
|
||||
/** Exit Game. */
|
||||
SCE_INIT_APITYPE_VSH_1 = 0x210,
|
||||
SCE_EXEC_FILE_APITYPE_VSH_1 = 0x210,
|
||||
/** Exit VSH. */
|
||||
SCE_INIT_APITYPE_VSH_2 = 0x220,
|
||||
SCE_EXEC_FILE_APITYPE_VSH_2 = 0x220,
|
||||
/** Kernel reboot. */
|
||||
SCE_INIT_APITYPE_KERNEL_REBOOT = 0x300,
|
||||
SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT = 0x300,
|
||||
/** Debug. */
|
||||
SCE_INIT_APITYPE_DEBUG = 0x420 /* doesn't start reboot */
|
||||
SCE_EXEC_FILE_APITYPE_DEBUG = 0x420 /* doesn't start reboot */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -147,7 +166,7 @@ enum SceInitApiType {
|
||||
* currently booted module by Init.
|
||||
*/
|
||||
typedef struct {
|
||||
/** The API type of the currently loaded module. One of ::SceInitApiType. */
|
||||
/** The API type of the currently loaded module. One of ::SceFileExecApiType. */
|
||||
s32 apiType; //0
|
||||
/** The address of a memory protection block of type ::SCE_PROTECT_INFO_TYPE_FILE_NAME. */
|
||||
void *fileModAddr; //4
|
||||
@ -196,14 +215,14 @@ typedef struct {
|
||||
*
|
||||
* @return The boot medium type. One of ::SceBootMediumType.
|
||||
*/
|
||||
s32 sceKernelBootFrom(void);
|
||||
u32 sceKernelBootFrom(void);
|
||||
|
||||
/**
|
||||
* Get the boot medium of the executable calling this function. For PSP-GO only?
|
||||
*
|
||||
* @return The boot medium type. One of ::SceBootMediumType.
|
||||
*/
|
||||
s32 InitForKernel_9D33A110(void);
|
||||
u32 InitForKernel_9D33A110(void);
|
||||
|
||||
/**
|
||||
* Get the application type of a module.
|
||||
@ -215,7 +234,7 @@ s32 sceKernelApplicationType(void);
|
||||
/**
|
||||
* Get the API type of a module.
|
||||
*
|
||||
* @return The API type. One of ::SceInitApiType.
|
||||
* @return The API type. One of ::SceFileExecApiType.
|
||||
*/
|
||||
s32 sceKernelInitApitype(void);
|
||||
|
||||
@ -227,13 +246,13 @@ s32 sceKernelInitApitype(void);
|
||||
* @param flag Defines the execute order of the callbacks. Pass 0 for earliest execution, 3 for latest.
|
||||
* 1 and 2 are between these two. Pass 4 - 7 for execution after Init loaded all modules, again
|
||||
* 4 is earliest, 7 is latest.
|
||||
* @param status The returned status of bootCBFunc in case it was executed directly.
|
||||
* @param pStatus The returned status of bootCBFunc in case it was executed directly.
|
||||
*
|
||||
* @return SCE_ERROR_OK for directly executing the boot callback function. SCE_BOOT_CALLBACK_FUNCTION_QUEUED
|
||||
* indicates boot callback function was enqueued into other existing boot callbacks and will be called
|
||||
* when Init boots the rest of the system modules.
|
||||
*/
|
||||
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *status);
|
||||
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *pStatus);
|
||||
|
||||
/**
|
||||
* Disabled debug function.
|
||||
@ -281,11 +300,11 @@ void *sceKernelInitDiscImage(void);
|
||||
/**
|
||||
* Get information about a paramSfo block of a module to boot.
|
||||
*
|
||||
* @param size The size of the paramSfo block.
|
||||
* @param pSize The size of the paramSfo block.
|
||||
*
|
||||
* @return A pointer to the head address of the paramSfo block.
|
||||
*/
|
||||
void *sceKernelInitParamSfo(SceSize *size);
|
||||
void *sceKernelInitParamSfo(SceSize *pSize);
|
||||
|
||||
/**
|
||||
* Get the LPT summary. Unknown.
|
||||
@ -303,7 +322,7 @@ s32 sceKernelInitLptSummary(void);
|
||||
* @return The memory block ID on success (greater than or equal to 0) or
|
||||
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
|
||||
*/
|
||||
SceUID sceKernelGetChunk(SceUID chunkId);
|
||||
SceUID sceKernelGetChunk(s32 chunkId);
|
||||
|
||||
/**
|
||||
* Register a chunk in the system.
|
||||
@ -314,7 +333,7 @@ SceUID sceKernelGetChunk(SceUID chunkId);
|
||||
* @return The blockId stored into the chunk on success, otherwise
|
||||
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
|
||||
*/
|
||||
SceUID sceKernelRegisterChunk(SceUID chunkId, SceUID blockId);
|
||||
SceUID sceKernelRegisterChunk(s32 chunkId, SceUID blockId);
|
||||
|
||||
/**
|
||||
* Release a used chunk.
|
||||
@ -324,7 +343,7 @@ SceUID sceKernelRegisterChunk(SceUID chunkId, SceUID blockId);
|
||||
* @return The new value of the chunk, typically -1, on success, otherwise
|
||||
* SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID.
|
||||
*/
|
||||
SceUID sceKernelReleaseChunk(SceUID chunkId);
|
||||
s32 sceKernelReleaseChunk(SceUID chunkId);
|
||||
|
||||
#endif /* MODULEMGR_INIT_H */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -6,41 +6,117 @@
|
||||
#define MODULEMGR_KERNEL_H
|
||||
|
||||
#include "common_header.h"
|
||||
#include "modulemgr_moduleInfo.h"
|
||||
#include "modulemgr_options.h"
|
||||
|
||||
#define SCE_SECURE_INSTALL_ID_LEN (16)
|
||||
#define SCE_NPDRM_LICENSEE_KEY_LEN (16)
|
||||
|
||||
typedef struct {
|
||||
SceSize size; //0
|
||||
s32 unk4; //4
|
||||
SceOff fileOffset; //8
|
||||
u8 keyData[16]; //16 -- TODO: Confirm
|
||||
u8 keyData[SCE_NPDRM_LICENSEE_KEY_LEN]; //16 -- TODO: Confirm
|
||||
} SceNpDrm;
|
||||
|
||||
s32 sceKernelLoadModuleForLoadExecForUser(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecNpDrm(s32 apiType, const char *file, SceOff fileOffset, u8 keyData[16], s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHDisc(const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHDiscUpdater(const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHDiscDebug(const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHDiscEmu(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 ModuleMgrForKernel_C2A5E6CA(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs1(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs2(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs3(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs4(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs5(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleForLoadExecVSHMs6(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
s32 ModuleMgrForKernel_8DD336D4(s32 apiType, const char *file, s32 flags, SceKernelLMOption *option);
|
||||
/* load module */
|
||||
SceUID sceKernelLoadModuleForLoadExecForUser(s32 apiType, const char *file, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHDisc(const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHDiscUpdater(const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHDiscDebug(const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHDiscEmu(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID ModuleMgrForKernel_C2A5E6CA(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs1(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs2(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs3(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs4(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs5(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecVSHMs6(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID ModuleMgrForKernel_8DD336D4(s32 apiType, const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForLoadExecNpDrm(s32 apiType, const char *path, SceOff fileOffset,
|
||||
const char *secureInstallId, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleVSH(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleVSHByID(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleForKernel(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleByIDForKernel(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleToBlock(const char *path, SceUID blockId, SceUID *pNewBlockId,
|
||||
s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBootInitConfig(const char *path, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleDeci(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
|
||||
s32 sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan(s32 apiType, u32 *modBuf, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug(s32 apiType, u32 *modBuf, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelLoadModuleBufferForExitVSHKernel(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
|
||||
s32 sceKernelLoadModuleBufferForExitGame(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
|
||||
s32 sceKernelLoadModuleBufferForExitVSHVSH(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
|
||||
s32 sceKernelLoadModuleBufferForRebootKernel(u32 *modBuf, s32 flags, SceKernelLMOption *option, int);
|
||||
/* load module buffer */
|
||||
SceUID sceKernelLoadModuleBufferMs(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferApp(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferVSH(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferForKernel(SceSize size, void *base, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferBootInitBtcnf(SceSize size, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption, s32 opt);
|
||||
s32 sceKernelLoadModuleBufferBootInitConfig(void);
|
||||
|
||||
s32 sceKernelLoadModuleBootInitBtcnf(u32 *modBuf, s32 flags, SceKernelLMOption *option); /* Disabled - returns error */
|
||||
s32 sceKernelLoadModuleBufferBootInitBtcnf(SceSize modSize, u32 *modBuf, s32 flags, SceKernelLMOption *option, s32);
|
||||
SceUID sceKernelLoadModuleBufferForExitGame(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
|
||||
SceUID sceKernelLoadModuleBufferForExitVSHKernel(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
|
||||
SceUID sceKernelLoadModuleBufferForRebootKernel(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
|
||||
SceUID sceKernelLoadModuleBufferForExitVSHVSH(void *base, s32 flag, const SceKernelLMOption *pOption, s32 opt);
|
||||
|
||||
s32 sceKernelStopUnloadSelfModuleWithStatusKernel(s32 exitStatus, SceSize args, void *argp, s32 *status, SceKernelSMOption *option);
|
||||
SceUID sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan(s32 apiType, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug(s32 apiType, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
|
||||
s32 sceKernelLoadModuleBootInitBtcnf(void *base, s32 flag, const SceKernelLMOption *pOption);
|
||||
|
||||
/* start module */
|
||||
s32 sceKernelStartModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
/* stop module */
|
||||
s32 sceKernelStopModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
/* unload module */
|
||||
SceUID sceKernelUnloadModule(SceUID modId);
|
||||
|
||||
s32 sceKernelStopUnloadSelfModuleWithStatus(s32 exitStatus, SceSize args, void *argp,
|
||||
s32 *pModResult, const SceKernelSMOption *pOption);
|
||||
s32 sceKernelStopUnloadSelfModule(SceSize args, void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
s32 sceKernelSelfStopUnloadModule(s32 exitStatus, SceSize args, void *argp); /* backward compatibility. */
|
||||
|
||||
/* obtain module information */
|
||||
s32 sceKernelQueryModuleInfo(SceUID modId, SceKernelModuleInfo *pModInfo);
|
||||
SceUID sceKernelGetModuleId(void);
|
||||
SceUID sceKernelGetModuleIdByAddress(const void *addr);
|
||||
SceUID sceKernelSearchModuleByName(const char *name);
|
||||
SceUID sceKernelSearchModuleByAddress(const void *addr);
|
||||
|
||||
s32 sceKernelGetModuleIdList(SceUID *pModIdList, SceSize size, u32 *pIdCount);
|
||||
|
||||
/* PSP reboot phase functions */
|
||||
s32 sceKernelRebootBeforeForUser(void *arg);
|
||||
s32 sceKernelRebootPhaseForKernel(s32 arg1, void *argp, s32 arg3, s32 arg4);
|
||||
s32 sceKernelRebootBeforeForKernel(void *argp, s32 arg2, s32 arg3, s32 arg4);
|
||||
|
||||
/* NP-DRM key functions */
|
||||
s32 sceKernelSetNpDrmGetModuleKeyFunction(s32(*function)(SceUID fd, void *, void *));
|
||||
s32 sceKernelNpDrmGetModuleKey(SceUID fd, void *arg2, void *arg3);
|
||||
|
||||
/* Misc */
|
||||
s32 sceKernelModuleMgrMode(s32 mode);
|
||||
|
||||
#endif /* MODULEMGR_KERNEL_H */
|
||||
|
||||
|
73
include/modulemgr_moduleInfo.h
Normal file
73
include/modulemgr_moduleInfo.h
Normal file
@ -0,0 +1,73 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_MODULEINFO_H
|
||||
#define MODULEMGR_MODULEINFO_H
|
||||
|
||||
#include "common_header.h"
|
||||
#include "loadcore.h"
|
||||
|
||||
/** Holds various information about a module, can be obtained using sceKernelQueryModuleInfo() */
|
||||
typedef struct {
|
||||
/** Size of this structure. size = sizeof(SceKernelModuleInfo). */
|
||||
SceSize size; //0
|
||||
/** Number of segments of the module */
|
||||
u8 nsegment; //4
|
||||
/** Reserved, unused */
|
||||
u8 reserved[3]; //5
|
||||
/** Start address of the segment */
|
||||
u32 segmentAddr[SCE_KERNEL_MAX_MODULE_SEGMENT]; //8
|
||||
/** Size of the segment */
|
||||
SceSize segmentSize[SCE_KERNEL_MAX_MODULE_SEGMENT]; //24
|
||||
/** Entry address of the module */
|
||||
u32 entryAddr; //40
|
||||
/** Value of gp */
|
||||
u32 gpValue; //44
|
||||
/** Start address of the text segment */
|
||||
u32 textAddr; //48
|
||||
/** Size of the text segment. */
|
||||
SceSize textSize; //52
|
||||
/** Size of the data segment. */
|
||||
SceSize dataSize; //56
|
||||
/** Size of the bss segment. */
|
||||
SceSize bssSize; //60
|
||||
/** Module attribute */
|
||||
u16 attribute; //64
|
||||
/** Module version */
|
||||
u8 version[MODULE_VERSION_NUMBER_CATEGORY_SIZE]; //66
|
||||
/** Module name */
|
||||
char modName[SCE_MODULE_NAME_LEN]; //68
|
||||
/** String terminator (always '\0') */
|
||||
char terminal; //95
|
||||
} SceKernelModuleInfo; // size = 96
|
||||
|
||||
/** Deprecated since firmware 1.50, use SceKernelModuleInfo instead. Holds various information about a module, can be obtained using sceKernelQueryModuleInfo()
|
||||
* @see :SceKernelModuleInfo
|
||||
**/
|
||||
typedef struct {
|
||||
/** Size of this structure. size = sizeof(SceKernelModuleInfoV1). */
|
||||
SceSize size; //0
|
||||
/** Number of segments of the module */
|
||||
u8 nsegment; //4
|
||||
/** Reserved, unused */
|
||||
u8 reserved[3]; //5
|
||||
/** Start address of the segment */
|
||||
u32 segmentAddr[SCE_KERNEL_MAX_MODULE_SEGMENT]; //8
|
||||
/** Size of the segment */
|
||||
SceSize segmentSize[SCE_KERNEL_MAX_MODULE_SEGMENT]; //24
|
||||
/** Entry address of the module */
|
||||
u32 entryAddr; //40
|
||||
/** Value of gp */
|
||||
u32 gpValue; //44
|
||||
/** Start address of the text segment */
|
||||
u32 textAddr; //48
|
||||
/** Size of the text segment */
|
||||
SceSize textSize; //52
|
||||
/** Size of the data segment. */
|
||||
SceSize dataSize; //56
|
||||
/** Size of the bss segment. */
|
||||
SceSize bssSize; //60
|
||||
} SceKernelModuleInfoV1; // size = 64
|
||||
|
||||
#endif /* MODULEMGR_MODULEINFO_H */
|
34
include/modulemgr_nids.h
Normal file
34
include/modulemgr_nids.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_NIDS_H
|
||||
#define MODULEMGR_NIDS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* function NIDs */
|
||||
#define NID_MODULE_BOOTSTART 0xD3744BE0
|
||||
#define NID_MODULE_REBOOT_PHASE 0xADF12745
|
||||
#define NID_MODULE_REBOOT_BEFORE 0x2F064FA6
|
||||
#define NID_MODULE_START 0xD632ACDB
|
||||
#define NID_MODULE_STOP 0xCEE8593C
|
||||
#define NID_592743D8 0x592743D8
|
||||
|
||||
/* variable NIDs*/
|
||||
#define NID_MODULE_REBOOT_BEFORE_THREAD_PARAM 0xF4F4299D
|
||||
#define NID_MODULE_START_THREAD_PARAM 0x0F7C276C
|
||||
#define NID_MODULE_STOP_THREAD_PARAM 0xCF0CC697
|
||||
#define NID_MODULE_INFO 0xF01D73A7
|
||||
#define NID_MODULE_SDK_VERSION 0x11B97506
|
||||
#define NID_1D4042A5 0x1D4042A5
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MODULEMGR_NIDS_H */
|
||||
|
@ -1,36 +1,54 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_OPTIONS_H
|
||||
#define MODULEMGR_OPTIONS_H
|
||||
|
||||
#include "common_imp.h"
|
||||
#include "sysmem_user.h"
|
||||
|
||||
/* SceKernelLMOption.position */
|
||||
#define SCE_KERNEL_LM_POS_LOW (SCE_KERNEL_SMEM_Low)
|
||||
#define SCE_KERNEL_LM_POS_HIGH (SCE_KERNEL_SMEM_High)
|
||||
#define SCE_KERNEL_LM_POS_LOW (SCE_KERNEL_SMEM_Low) /** Place module at lowest possible address. */
|
||||
#define SCE_KERNEL_LM_POS_HIGH (SCE_KERNEL_SMEM_High) /** Place module at highest possible address. */
|
||||
#define SCE_KERNEL_LM_POS_ADDR (SCE_KERNEL_SMEM_Addr)
|
||||
|
||||
/* SceKernelLMOption.access */
|
||||
#define SCE_KERNEL_LM_ACCESS_NOSEEK (1)
|
||||
|
||||
/** This structure specifies options for loading a module (via LoadModule()). */
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceUID mpIdText; /* partition text */
|
||||
SceUID mpIdData; /* partition data */
|
||||
u32 flags;
|
||||
s8 position; /* module allocation type */
|
||||
s8 access; /* file access type */
|
||||
s8 creserved[2];
|
||||
/** The size of this structure. size = sizeof(SceKernelLMOption). */
|
||||
SceSize size;
|
||||
/** The memory partition where the program of the module will be stored. */
|
||||
SceUID mpIdText;
|
||||
/** The memory partition where the data of the module will be stored. */
|
||||
SceUID mpIdData;
|
||||
/** Unused for now. */
|
||||
u32 flags;
|
||||
/** Specify module placement policy in memory. */
|
||||
u8 position;
|
||||
/** Unused for now. */
|
||||
s8 access;
|
||||
/** Reserved. */
|
||||
s8 creserved[2];
|
||||
} SceKernelLMOption;
|
||||
|
||||
/** This structure specifies options for starting/stopping a module. */
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceUID mpidstack; /* partition stack */
|
||||
SceSize stacksize;
|
||||
s32 priority;
|
||||
u32 attribute; /* thread attribute */
|
||||
/** The size of the structure. size = sizeof(SceKernelSMOption). */
|
||||
SceSize size;
|
||||
/**
|
||||
* Partition of the stack of the running thread. If 0 is specified then the stack is allocated
|
||||
* in the same partition as the data segment of the module.
|
||||
*/
|
||||
SceUID mpIdStack;
|
||||
/** Stack size. If 0 is specified then the default system value is used. */
|
||||
SceSize stackSize;
|
||||
/** Priority of the running thread. */
|
||||
s32 priority;
|
||||
/** Attribute of the running thread. */
|
||||
u32 attribute;
|
||||
} SceKernelSMOption;
|
||||
|
||||
#endif /* MODULEMGR_OPTIONS_H */
|
||||
|
@ -1,18 +1,65 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_USER_H
|
||||
#define MODULEMGR_USER_H
|
||||
|
||||
#include "common_header.h"
|
||||
#include "modulemgr_options.h"
|
||||
#include "sysmem_user.h"
|
||||
|
||||
SceUID sceKernelLoadModule(const char *path, s32 flags, SceKernelLMOption *option);
|
||||
s32 sceKernelStartModule(SceUID modId, SceSize args, void *argp, s32 *result, SceKernelSMOption *option);
|
||||
s32 sceKernelUnloadModule(SceUID modId);
|
||||
|
||||
|
||||
#endif /* MODULEMGR_USER_H */
|
||||
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_USER_H
|
||||
#define MODULEMGR_USER_H
|
||||
|
||||
#include "common_header.h"
|
||||
#include "modulemgr_moduleInfo.h"
|
||||
#include "modulemgr_options.h"
|
||||
#include "sysmem_user.h"
|
||||
|
||||
#define SCE_SECURE_INSTALL_ID_LEN (16)
|
||||
|
||||
/* load module */
|
||||
SceUID sceKernelLoadModule(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleByID(SceUID inputId, s32 flag, const SceKernelLMOption *pOption);
|
||||
|
||||
SceUID sceKernelLoadModuleWithBlockOffset(const char *path, SceUID blockId, SceOff offset);
|
||||
SceUID sceKernelLoadModuleByIDWithBlockOffset(SceUID inputId, SceUID blockId, SceOff offset);
|
||||
|
||||
SceUID sceKernelLoadModuleNpDrm(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleDNAS(const char *path, const char *secureInstallId, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleMs(const char *path, s32 flag, const SceKernelLMOption *pOption);
|
||||
|
||||
/* load module buffer */
|
||||
SceUID sceKernelLoadModuleBufferUsbWlan(SceSize size, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferMs(SceSize bufSize, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
SceUID sceKernelLoadModuleBufferApp(SceSize size, void *base, s32 flag,
|
||||
const SceKernelLMOption *pOption);
|
||||
|
||||
/* start module */
|
||||
s32 sceKernelStartModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
/* stop module */
|
||||
s32 sceKernelStopModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
/* unload module */
|
||||
SceUID sceKernelUnloadModule(SceUID modId);
|
||||
|
||||
s32 sceKernelStopUnloadSelfModuleWithStatus(s32 exitStatus, SceSize args, void *argp,
|
||||
s32 *pModResult, const SceKernelSMOption *pOption);
|
||||
s32 sceKernelStopUnloadSelfModule(SceSize args, void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
s32 sceKernelSelfStopUnloadModule(s32 exitStatus, SceSize args, void *argp); /* backward compatibility. */
|
||||
|
||||
/* obtain module information */
|
||||
s32 sceKernelQueryModuleInfo(SceUID modId, SceKernelModuleInfo *pModInfo);
|
||||
|
||||
SceUID sceKernelGetModuleId(void);
|
||||
SceUID sceKernelGetModuleIdByAddress(const void *addr);
|
||||
s32 sceKernelGetModuleGPByAddress(const void *addr, u32 *pGP);
|
||||
s32 sceKernelGetModuleIdList(SceUID *pModIdList, SceSize size, u32 *pIdCount);
|
||||
|
||||
/* Misc */
|
||||
SceBool sceKernelCheckTextSegment(void);
|
||||
|
||||
#endif /* MODULEMGR_USER_H */
|
||||
|
||||
|
@ -124,7 +124,7 @@ u32 sceKernelGetModel(void);
|
||||
s32 sceKernelSetRebootKernel(s32 (*rebootKernel)());
|
||||
s32 sceKernelRebootKernel(void *arg);
|
||||
s32 sceKernelRegisterGetIdFunc(void *func);
|
||||
s32 sceKernelGetId();
|
||||
s32 sceKernelGetId(const char *path, char *id);
|
||||
|
||||
/*
|
||||
* Debugging (disabled in release)
|
||||
|
@ -26,9 +26,11 @@ enum SceSysMemPartitionId {
|
||||
};
|
||||
|
||||
enum SceSysMemBlockType {
|
||||
SCE_KERNEL_SMEM_Low = 0,
|
||||
SCE_KERNEL_SMEM_High = 1,
|
||||
SCE_KERNEL_SMEM_Addr = 2
|
||||
SCE_KERNEL_SMEM_Low = 0,
|
||||
SCE_KERNEL_SMEM_High = 1,
|
||||
SCE_KERNEL_SMEM_Addr = 2,
|
||||
SCE_KERNEL_SMEM_LOWALIGNED = 3,
|
||||
SCE_KERNEL_SMEM_HIGHALIGNED = 4
|
||||
};
|
||||
|
||||
#endif /* SYSMEM_USER_H */
|
||||
|
@ -1,255 +1,319 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef THREADMAN_KERNEL_H
|
||||
#define THREADMAN_KERNEL_H
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
#include "threadman_user.h"
|
||||
|
||||
/* Threads */
|
||||
|
||||
typedef s32 (*SceKernelThreadEntry)(SceSize args, void *argp);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceUID stackMpid;
|
||||
} SceKernelThreadOptParam;
|
||||
|
||||
/* thread priority */
|
||||
#define SCE_KERNEL_USER_HIGHEST_PRIORITY 16
|
||||
#define SCE_KERNEL_MODULE_INIT_PRIORITY 32
|
||||
#define SCE_KERNEL_USER_LOWEST_PRIORITY 111
|
||||
|
||||
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority,
|
||||
int stackSize, SceUInt attr, SceKernelThreadOptParam *option);
|
||||
int sceKernelDeleteThread(SceUID thid);
|
||||
int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
|
||||
int sceKernelExitThread(int status);
|
||||
int sceKernelTerminateDeleteThread(SceUID thid);
|
||||
int sceKernelDelayThread(SceUInt delay);
|
||||
int sceKernelChangeThreadPriority(SceUID thid, int priority);
|
||||
int sceKernelGetThreadCurrentPriority(void);
|
||||
int sceKernelGetThreadId(void);
|
||||
int sceKernelIsUserModeThread(void);
|
||||
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
|
||||
int sceKernelWaitThreadEndCB(SceUID thid, SceUInt *timeout);
|
||||
int sceKernelReleaseWaitThread(SceUID thid);
|
||||
int sceKernelSuspendAllUserThreads(void);
|
||||
|
||||
unsigned int sceKernelGetSystemTimeLow(void);
|
||||
int sceKernelGetUserLevel(void);
|
||||
|
||||
typedef enum {
|
||||
SCE_KERNEL_TMID_Thread = 1,
|
||||
SCE_KERNEL_TMID_Semaphore = 2,
|
||||
SCE_KERNEL_TMID_EventFlag = 3,
|
||||
SCE_KERNEL_TMID_Mbox = 4,
|
||||
SCE_KERNEL_TMID_Vpl = 5,
|
||||
SCE_KERNEL_TMID_Fpl = 6,
|
||||
SCE_KERNEL_TMID_Mpipe = 7,
|
||||
SCE_KERNEL_TMID_Callback = 8,
|
||||
SCE_KERNEL_TMID_ThreadEventHandler = 9,
|
||||
SCE_KERNEL_TMID_Alarm = 10,
|
||||
SCE_KERNEL_TMID_VTimer = 11,
|
||||
SCE_KERNEL_TMID_SleepThread = 64,
|
||||
SCE_KERNEL_TMID_DelayThread = 65,
|
||||
SCE_KERNEL_TMID_SuspendThread = 66,
|
||||
SCE_KERNEL_TMID_DormantThread = 67,
|
||||
} SceKernelIdListType;
|
||||
|
||||
SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);
|
||||
|
||||
/* Mutexes */
|
||||
|
||||
int sceKernelCreateMutex(char *, int, int, int);
|
||||
int sceKernelTryLockMutex(int, int);
|
||||
int sceKernelLockMutex(int, int, int);
|
||||
int sceKernelUnlockMutex(int, int);
|
||||
int sceKernelDeleteMutex(int);
|
||||
|
||||
/* Event flags */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
SceUInt initPattern;
|
||||
SceUInt currentPattern;
|
||||
int numWaitThreads;
|
||||
} SceKernelEventFlagInfo;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelEventFlagOptParam;
|
||||
|
||||
/* Event flag attributes. */
|
||||
#define SCE_KERNEL_EA_SINGLE (0x0000) /** Multiple thread waits are prohibited. */
|
||||
#define SCE_KERNEL_EA_MULTI (0x0200) /** Multiple thread waits are permitted. */
|
||||
|
||||
/* Event flag wait modes. */
|
||||
#define SCE_KERNEL_EW_AND (0x00) /** Wait for all bits in the bit pattern to be set. */
|
||||
#define SCE_KERNEL_EW_OR (0x01) /** Wait for one or more bits in the bit pattern to be set. */
|
||||
#define SCE_KERNEL_EW_CLEAR_ALL (0x10) /** Clear all bits after wait condition is satisfied. */
|
||||
#define SCE_KERNEL_EW_CLEAR_PAT (0x20) /** Clear bits specified by bit pattern after wait condition is satisfied. */
|
||||
#define SCE_KERNEL_EW_CLEAR SCE_KERNEL_EW_CLEAR_ALL
|
||||
|
||||
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
|
||||
int sceKernelSetEventFlag(SceUID evid, u32 bits);
|
||||
int sceKernelClearEventFlag(SceUID evid, u32 bits);
|
||||
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
|
||||
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
|
||||
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
|
||||
int sceKernelCancelEventFlag(SceUID evid, SceUInt setpattern, s32 *numWaitThreads);
|
||||
int sceKernelDeleteEventFlag(int evid);
|
||||
int sceKernelReferEventFlagStatus(SceUID event, SceKernelEventFlagInfo *status);
|
||||
|
||||
/* MsgPipe */
|
||||
SceUID sceKernelCreateMsgPipe(const char *name, int part, int attr, void *unk1, void *opt);
|
||||
int sceKernelDeleteMsgPipe(SceUID uid);
|
||||
int sceKernelSendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelSendMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelTrySendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
|
||||
int sceKernelReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelTryReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
|
||||
int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int bufSize;
|
||||
int freeSize;
|
||||
int numSendWaitThreads;
|
||||
int numReceiveWaitThreads;
|
||||
} SceKernelMppInfo;
|
||||
|
||||
int sceKernelReferMsgPipeStatus(SceUID uid, SceKernelMppInfo *info);
|
||||
|
||||
/* Semaphores */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelSemaOptParam;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int initCount;
|
||||
int currentCount;
|
||||
int maxCount;
|
||||
int numWaitThreads;
|
||||
} SceKernelSemaInfo;
|
||||
|
||||
SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option);
|
||||
int sceKernelDeleteSema(SceUID semaid);
|
||||
int sceKernelSignalSema(SceUID semaid, int signal);
|
||||
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
|
||||
int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout);
|
||||
int sceKernelPollSema(SceUID semaid, int signal);
|
||||
int sceKernelReferSemaStatus(SceUID semaid, SceKernelSemaInfo *info);
|
||||
|
||||
/* KTLS */
|
||||
int sceKernelAllocateKTLS(int id, int (*cb)(unsigned int *size, void *arg), void *arg);
|
||||
int sceKernelFreeKTLS(int id);
|
||||
void *sceKernelGetKTLS(int id);
|
||||
void *sceKernelGetThreadKTLS(int id, SceUID thid, int mode);
|
||||
|
||||
/* Alarms. */
|
||||
|
||||
typedef SceUInt (*SceKernelAlarmHandler)(void *common);
|
||||
|
||||
typedef struct {
|
||||
SceUInt32 low;
|
||||
SceUInt32 hi;
|
||||
} SceKernelSysClock;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceKernelSysClock schedule;
|
||||
SceKernelAlarmHandler handler;
|
||||
void *common;
|
||||
} SceKernelAlarmInfo;
|
||||
|
||||
SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *common);
|
||||
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
|
||||
int sceKernelCancelAlarm(SceUID alarmid);
|
||||
int sceKernelReferAlarmStatus(SceUID alarmid, SceKernelAlarmInfo *info);
|
||||
|
||||
/* Callbacks */
|
||||
typedef s32 (*SceKernelCallbackFunction)(s32 arg1, s32 arg2, void *arg);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUID threadId;
|
||||
SceKernelCallbackFunction callback;
|
||||
void *common;
|
||||
s32 notifyCount;
|
||||
s32 notifyArg;
|
||||
} SceKernelCallbackInfo;
|
||||
|
||||
int sceKernelNotifyCallback(SceUID cb, int arg2);
|
||||
int sceKernelReferCallbackStatus(SceUID cb, SceKernelCallbackInfo *status);
|
||||
|
||||
/* VPL Functions */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelVplOptParam;
|
||||
|
||||
|
||||
SceUID sceKernelCreateVpl(const char *name, int part, int attr, unsigned int size, SceKernelVplOptParam *opt);
|
||||
|
||||
int sceKernelDeleteVpl(SceUID uid);
|
||||
int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
|
||||
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
|
||||
int sceKernelTryAllocateVpl(SceUID uid, unsigned int size, void **data);
|
||||
int sceKernelFreeVpl(SceUID uid, void *data);
|
||||
int sceKernelCancelVpl(SceUID uid, int *pnum);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int poolSize;
|
||||
int freeSize;
|
||||
int numWaitThreads;
|
||||
} SceKernelVplInfo;
|
||||
|
||||
int sceKernelReferVplStatus(SceUID uid, SceKernelVplInfo *info);
|
||||
|
||||
/* FPL Functions */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelFplOptParam;
|
||||
|
||||
int sceKernelCreateFpl(const char *name, int part, int attr, unsigned int size, unsigned int blocks, SceKernelFplOptParam *opt);
|
||||
int sceKernelDeleteFpl(SceUID uid);
|
||||
int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
|
||||
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
|
||||
int sceKernelTryAllocateFpl(SceUID uid, void **data);
|
||||
int sceKernelFreeFpl(SceUID uid, void *data);
|
||||
int sceKernelCancelFpl(SceUID uid, int *pnum);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int blockSize;
|
||||
int numBlocks;
|
||||
int freeBlocks;
|
||||
int numWaitThreads;
|
||||
} SceKernelFplInfo;
|
||||
|
||||
int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
|
||||
|
||||
s64 sceKernelGetSystemTimeWide(void);
|
||||
|
||||
#endif /* THREADMAN_KERNEL_H */
|
||||
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef THREADMAN_KERNEL_H
|
||||
#define THREADMAN_KERNEL_H
|
||||
|
||||
#include "common_header.h"
|
||||
#include "threadman_user.h"
|
||||
|
||||
/* Threads */
|
||||
|
||||
typedef s32 (*SceKernelThreadEntry)(SceSize args, void *argp);
|
||||
|
||||
typedef s32 (*SceKernelRebootKernelThreadEntry)(s32 arg1, u32 arg2, s32 arg3, s32 arg4);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceUID stackMpid;
|
||||
} SceKernelThreadOptParam;
|
||||
|
||||
#define SCE_KERNEL_THREAD_ID_SELF (0) /* UID representing calling thread. */
|
||||
|
||||
/**
|
||||
* thread priority - lower numbers mean higher priority
|
||||
*/
|
||||
#define SCE_KERNEL_INVALID_PRIORITY (0)
|
||||
#define SCE_KERNEL_HIGHEST_PRIORITY_KERNEL (1)
|
||||
#define SCE_KERNEL_HIGHEST_PRIORITY_USER (16)
|
||||
#define SCE_KERNEL_MODULE_INIT_PRIORITY (32)
|
||||
#define SCE_KERNEL_LOWEST_PRIORITY_USER (111)
|
||||
#define SCE_KERNEL_LOWEST_PRIORITY_KERNEL (126)
|
||||
|
||||
/* thread size */
|
||||
#define SCE_KERNEL_TH_KERNEL_DEFAULT_STACKSIZE (4 * 1024) /* 4 KB */
|
||||
#define SCE_KERNEL_TH_USER_DEFAULT_STACKSIZE (256 * 1024) /* 256 KB */
|
||||
|
||||
/* thread attributes */
|
||||
#define SCE_KERNEL_TH_VSH_MODE (0xC0000000) /* Thread runs in VSH mode. */
|
||||
#define SCE_KERNEL_TH_APP_MODE (0xB0000000) /* Thread runs in Application mode. */
|
||||
#define SCE_KERNEL_TH_USB_WLAN_MODE (0xA0000000) /* Thread runs in USB_WLAN mode. */
|
||||
#define SCE_KERNEL_TH_MS_MODE (0x90000000) /* Thread runs in MS mode. */
|
||||
#define SCE_KERNEL_TH_USER_MODE (0x80000000) /* Thread runs in User mode. */
|
||||
#define SCE_KERNEL_TH_NO_FILLSTACK (0x00100000)
|
||||
#define SCE_KERNEL_TH_CLEAR_STACK (0x00200000) /* Specifies that thread memory area should be cleared to 0 when deleted. */
|
||||
#define SCE_KERNEL_TH_LOW_STACK (0x00400000) /* Specifies that the stack area is allocated from the lower addresses in memory, not the higher ones. */
|
||||
#define SCE_KERNEL_TH_UNK_800000 (0x00800000)
|
||||
#define SCE_KERNEL_TH_USE_VFPU (0x00004000) /* Specifies that the VFPU is available. */
|
||||
#define SCE_KERNEL_TH_NEVERUSE_FPU (0x00002000)
|
||||
|
||||
#define SCE_KERNEL_TH_DEFAULT_ATTR (0)
|
||||
|
||||
#define SCE_KERNEL_AT_THFIFO (0x00000000) /* Waiting threads are queued on a FIFO basis. */
|
||||
#define SCE_KERNEL_AT_THPRI (0x00000100) /* Waiting threads are queued based on priority. */
|
||||
|
||||
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, s32 initPriority,
|
||||
SceSize stackSize, SceUInt attr, SceKernelThreadOptParam *option);
|
||||
int sceKernelDeleteThread(SceUID thid);
|
||||
int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
|
||||
int sceKernelSuspendThread(SceUID thid);
|
||||
int sceKernelExitThread(s32 status);
|
||||
s32 sceKernelExitDeleteThread(s32 exitStatus);
|
||||
int sceKernelTerminateDeleteThread(SceUID thid);
|
||||
int sceKernelDelayThread(SceUInt delay);
|
||||
int sceKernelChangeThreadPriority(SceUID thid, int priority);
|
||||
int sceKernelGetThreadCurrentPriority(void);
|
||||
int sceKernelGetThreadId(void);
|
||||
int sceKernelIsUserModeThread(void);
|
||||
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
|
||||
int sceKernelWaitThreadEndCB(SceUID thid, SceUInt *timeout);
|
||||
int sceKernelReleaseWaitThread(SceUID thid);
|
||||
int sceKernelSuspendAllUserThreads(void);
|
||||
|
||||
unsigned int sceKernelGetSystemTimeLow(void);
|
||||
|
||||
enum SceUserLevel {
|
||||
SCE_USER_LEVEL_MS = 1,
|
||||
SCE_USER_LEVEL_USBWLAN = 2,
|
||||
SCE_USER_LEVEL_APP = 3,
|
||||
SCE_USER_LEVEL_VSH = 4,
|
||||
};
|
||||
int sceKernelGetUserLevel(void);
|
||||
|
||||
typedef enum {
|
||||
SCE_KERNEL_TMID_Thread = 1,
|
||||
SCE_KERNEL_TMID_Semaphore = 2,
|
||||
SCE_KERNEL_TMID_EventFlag = 3,
|
||||
SCE_KERNEL_TMID_Mbox = 4,
|
||||
SCE_KERNEL_TMID_Vpl = 5,
|
||||
SCE_KERNEL_TMID_Fpl = 6,
|
||||
SCE_KERNEL_TMID_Mpipe = 7,
|
||||
SCE_KERNEL_TMID_Callback = 8,
|
||||
SCE_KERNEL_TMID_ThreadEventHandler = 9,
|
||||
SCE_KERNEL_TMID_Alarm = 10,
|
||||
SCE_KERNEL_TMID_VTimer = 11,
|
||||
SCE_KERNEL_TMID_SleepThread = 64,
|
||||
SCE_KERNEL_TMID_DelayThread = 65,
|
||||
SCE_KERNEL_TMID_SuspendThread = 66,
|
||||
SCE_KERNEL_TMID_DormantThread = 67,
|
||||
} SceKernelIdListType;
|
||||
|
||||
SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);
|
||||
|
||||
/* Mutexes */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelMutexOptParam;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
s32 initCount;
|
||||
s32 currentCount;
|
||||
SceUID currentOwner;
|
||||
s32 numWaitThreads;
|
||||
} SceKernelMutexInfo;
|
||||
|
||||
/* Mutex attributes */
|
||||
#define SCE_KERNEL_MUTEX_ATTR_TH_FIFO (SCE_KERNEL_AT_THFIFO)
|
||||
#define SCE_KERNEL_MUTEX_ATTR_TH_PRI (SCE_KERNEL_AT_THPRI)
|
||||
#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE (0x0200) /*Allow recursive locks by threads that own the mutex. */
|
||||
|
||||
s32 sceKernelCreateMutex(char *name, s32 attr, s32 initCount, const SceKernelMutexOptParam *pOption);
|
||||
s32 sceKernelDeleteMutex(SceUID mutexId);
|
||||
s32 sceKernelLockMutex(SceUID mutexId, s32 lockCount, u32 *pTimeout);
|
||||
s32 sceKernelLockMutexCB(SceUID mutexId, s32 lockCount, u32 *pTimeout);
|
||||
s32 sceKernelTryLockMutex(SceUID mutexId, s32 lockCount);
|
||||
s32 sceKernelUnlockMutex(SceUID mutexId, s32 unlockCount);
|
||||
s32 sceKernelCancelMutex(SceUID mutexId, s32 newLockCount, s32 *pNumWaitThreads);
|
||||
s32 sceKernelReferMutexStatus(SceUID mutexId, SceKernelMutexInfo *pInfo);
|
||||
|
||||
/* Event flags */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
SceUInt initPattern;
|
||||
SceUInt currentPattern;
|
||||
int numWaitThreads;
|
||||
} SceKernelEventFlagInfo;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelEventFlagOptParam;
|
||||
|
||||
/* Event flag attributes. */
|
||||
#define SCE_KERNEL_EA_SINGLE (0x0000) /** Multiple thread waits are prohibited. */
|
||||
#define SCE_KERNEL_EA_MULTI (0x0200) /** Multiple thread waits are permitted. */
|
||||
|
||||
/* Event flag wait modes. */
|
||||
#define SCE_KERNEL_EW_AND (0x00) /** Wait for all bits in the bit pattern to be set. */
|
||||
#define SCE_KERNEL_EW_OR (0x01) /** Wait for one or more bits in the bit pattern to be set. */
|
||||
#define SCE_KERNEL_EW_CLEAR_ALL (0x10) /** Clear all bits after wait condition is satisfied. */
|
||||
#define SCE_KERNEL_EW_CLEAR_PAT (0x20) /** Clear bits specified by bit pattern after wait condition is satisfied. */
|
||||
#define SCE_KERNEL_EW_CLEAR SCE_KERNEL_EW_CLEAR_ALL
|
||||
|
||||
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
|
||||
int sceKernelSetEventFlag(SceUID evid, u32 bits);
|
||||
int sceKernelClearEventFlag(SceUID evid, u32 bits);
|
||||
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
|
||||
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
|
||||
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
|
||||
int sceKernelCancelEventFlag(SceUID evid, SceUInt setpattern, s32 *numWaitThreads);
|
||||
int sceKernelDeleteEventFlag(int evid);
|
||||
int sceKernelReferEventFlagStatus(SceUID event, SceKernelEventFlagInfo *status);
|
||||
|
||||
/* MsgPipe */
|
||||
SceUID sceKernelCreateMsgPipe(const char *name, int part, int attr, void *unk1, void *opt);
|
||||
int sceKernelDeleteMsgPipe(SceUID uid);
|
||||
int sceKernelSendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelSendMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelTrySendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
|
||||
int sceKernelReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout);
|
||||
int sceKernelTryReceiveMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2);
|
||||
int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
int bufSize;
|
||||
int freeSize;
|
||||
int numSendWaitThreads;
|
||||
int numReceiveWaitThreads;
|
||||
} SceKernelMppInfo;
|
||||
|
||||
int sceKernelReferMsgPipeStatus(SceUID uid, SceKernelMppInfo *info);
|
||||
|
||||
/* Semaphores */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelSemaOptParam;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
int initCount;
|
||||
int currentCount;
|
||||
int maxCount;
|
||||
int numWaitThreads;
|
||||
} SceKernelSemaInfo;
|
||||
|
||||
#define SCE_KERNEL_SA_THFIFO (0x0000) /* A FIFO queue is used for the waiting thread */
|
||||
#define SCE_KERNEL_SA_THPRI (0x0100) /* The waiting thread is queued by its thread priority */
|
||||
|
||||
SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option);
|
||||
int sceKernelDeleteSema(SceUID semaid);
|
||||
int sceKernelSignalSema(SceUID semaid, int signal);
|
||||
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
|
||||
int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout);
|
||||
int sceKernelPollSema(SceUID semaid, int signal);
|
||||
int sceKernelReferSemaStatus(SceUID semaid, SceKernelSemaInfo *info);
|
||||
|
||||
/* KTLS */
|
||||
int sceKernelAllocateKTLS(int id, int (*cb)(unsigned int *size, void *arg), void *arg);
|
||||
int sceKernelFreeKTLS(int id);
|
||||
void *sceKernelGetKTLS(int id);
|
||||
void *sceKernelGetThreadKTLS(int id, SceUID thid, int mode);
|
||||
|
||||
/* Alarms. */
|
||||
|
||||
typedef SceUInt (*SceKernelAlarmHandler)(void *common);
|
||||
|
||||
typedef struct {
|
||||
SceUInt32 low;
|
||||
SceUInt32 hi;
|
||||
} SceKernelSysClock;
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
SceKernelSysClock schedule;
|
||||
SceKernelAlarmHandler handler;
|
||||
void *common;
|
||||
} SceKernelAlarmInfo;
|
||||
|
||||
SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *common);
|
||||
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
|
||||
int sceKernelCancelAlarm(SceUID alarmid);
|
||||
int sceKernelReferAlarmStatus(SceUID alarmid, SceKernelAlarmInfo *info);
|
||||
|
||||
/* Callbacks */
|
||||
typedef s32 (*SceKernelCallbackFunction)(s32 arg1, s32 arg2, void *arg);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUID threadId;
|
||||
SceKernelCallbackFunction callback;
|
||||
void *common;
|
||||
s32 notifyCount;
|
||||
s32 notifyArg;
|
||||
} SceKernelCallbackInfo;
|
||||
|
||||
int sceKernelNotifyCallback(SceUID cb, int arg2);
|
||||
int sceKernelReferCallbackStatus(SceUID cb, SceKernelCallbackInfo *status);
|
||||
|
||||
/* VPL Functions */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelVplOptParam;
|
||||
|
||||
|
||||
SceUID sceKernelCreateVpl(const char *name, int part, int attr, unsigned int size, SceKernelVplOptParam *opt);
|
||||
|
||||
int sceKernelDeleteVpl(SceUID uid);
|
||||
int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
|
||||
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
|
||||
int sceKernelTryAllocateVpl(SceUID uid, unsigned int size, void **data);
|
||||
int sceKernelFreeVpl(SceUID uid, void *data);
|
||||
int sceKernelCancelVpl(SceUID uid, int *pnum);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
int poolSize;
|
||||
int freeSize;
|
||||
int numWaitThreads;
|
||||
} SceKernelVplInfo;
|
||||
|
||||
int sceKernelReferVplStatus(SceUID uid, SceKernelVplInfo *info);
|
||||
|
||||
/* FPL Functions */
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
} SceKernelFplOptParam;
|
||||
|
||||
int sceKernelCreateFpl(const char *name, int part, int attr, unsigned int size, unsigned int blocks, SceKernelFplOptParam *opt);
|
||||
int sceKernelDeleteFpl(SceUID uid);
|
||||
int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
|
||||
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
|
||||
int sceKernelTryAllocateFpl(SceUID uid, void **data);
|
||||
int sceKernelFreeFpl(SceUID uid, void *data);
|
||||
int sceKernelCancelFpl(SceUID uid, int *pnum);
|
||||
|
||||
typedef struct {
|
||||
SceSize size;
|
||||
char name[SCE_UID_NAME_LEN + 1];
|
||||
SceUInt attr;
|
||||
int blockSize;
|
||||
int numBlocks;
|
||||
int freeBlocks;
|
||||
int numWaitThreads;
|
||||
} SceKernelFplInfo;
|
||||
|
||||
int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
|
||||
|
||||
s64 sceKernelGetSystemTimeWide(void);
|
||||
|
||||
#endif /* THREADMAN_KERNEL_H */
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -227,7 +227,7 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode)
|
||||
|
||||
/* Try to update the spread-spectrum register. */
|
||||
|
||||
res = sceKernelLockMutex(g_Cy27040.mutex, 1, 0);
|
||||
res = sceKernelLockMutex(g_Cy27040.mutex, 1, NULL);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
@ -280,7 +280,7 @@ s32 sceClockgenInit(void)
|
||||
sceI2cSetClock(4, 4);
|
||||
|
||||
/* Create the mutex and register the sysevent handler */
|
||||
mutexId = sceKernelCreateMutex("SceClockgen", 1, 0, 0);
|
||||
mutexId = sceKernelCreateMutex("SceClockgen", 1, 0, NULL);
|
||||
|
||||
if (mutexId < 0)
|
||||
return mutexId;
|
||||
@ -408,7 +408,7 @@ static s32 _sceClockgenSetControl1(s32 bus, SceBool mode)
|
||||
s32 ret;
|
||||
s32 regClk;
|
||||
|
||||
ret = sceKernelLockMutex(g_Cy27040.mutex, 1, 0);
|
||||
ret = sceKernelLockMutex(g_Cy27040.mutex, 1, NULL);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -155,7 +155,7 @@ int sub_01FC(int arg0, int arg1, int arg2, int arg3)
|
||||
{
|
||||
int flag1 = 0;
|
||||
int flag2 = 0;
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, 0);
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
char flag = g_codec.flag;
|
||||
@ -284,7 +284,7 @@ int sceCodecSetHeadphoneVolume(int arg0)
|
||||
int flag = pspMax(arg0 + g_codec.flag2 + 121, 0);
|
||||
if (flag >= 128)
|
||||
return 0x800001FE;
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, 0);
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = sub_004C(2, flag | 0x80);
|
||||
@ -311,7 +311,7 @@ int sceCodecSetSpeakerVolume(int arg0)
|
||||
flag += g_codec.flag2;
|
||||
flag = pspMin(flag, 0x7F);
|
||||
flag = pspMax(flag, 0);
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, 0);
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = sub_004C(40, flag | 0x80);
|
||||
@ -356,7 +356,7 @@ int sceCodec_driver_FCA6D35B(int freq)
|
||||
// 0750
|
||||
}
|
||||
// 0754
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, 0);
|
||||
int ret = sceKernelLockMutex(g_codec.mutexId, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = sub_004C(8, flag);
|
||||
@ -403,7 +403,7 @@ int sceCodec_driver_A88FD064(int arg0, int arg1, int arg2, int arg3, int arg4, i
|
||||
arg2 = (arg2 << 3) + 1;
|
||||
}
|
||||
// 08FC
|
||||
ret = sceKernelLockMutex(g_codec.mutexId, 1, 0);
|
||||
ret = sceKernelLockMutex(g_codec.mutexId, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = sub_004C(17, 123);
|
||||
@ -480,7 +480,7 @@ int sceCodecInitEntry()
|
||||
;
|
||||
sub_0110();
|
||||
sub_0150(1);
|
||||
g_codec.mutexId = sceKernelCreateMutex("SceCodec", 1, 0, 0);
|
||||
g_codec.mutexId = sceKernelCreateMutex("SceCodec", 1, 0, NULL);
|
||||
if (g_codec.mutexId <= 0)
|
||||
return 1;
|
||||
sceKernelRegisterSysEventHandler(&g_sysEv);
|
||||
|
@ -23,10 +23,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
#include <ctrl.h>
|
||||
#include <display.h>
|
||||
#include <interruptman.h>
|
||||
#include <modulemgr.h>
|
||||
#include <modulemgr_init.h>
|
||||
#include <syscon.h>
|
||||
#include <sysmem_kdebug.h>
|
||||
|
138
src/init/init.c
138
src/init/init.c
@ -24,7 +24,6 @@
|
||||
#include <iofilemgr_stdio.h>
|
||||
#include <loadcore.h>
|
||||
#include <loadexec_kernel.h>
|
||||
#include <modulemgr.h>
|
||||
#include <modulemgr_init.h>
|
||||
#include <modulemgr_kernel.h>
|
||||
#include <modulemgr_user.h>
|
||||
@ -101,7 +100,7 @@ static void InitCBInit(SceLoadCoreBootInfo *bootInfo)
|
||||
g_init->curBootCallback2 = NULL;
|
||||
|
||||
g_npDrmData.size = sizeof(SceNpDrm);
|
||||
g_npDrmData.fileOffset = -1;
|
||||
g_npDrmData.fileOffset = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
u32 i;
|
||||
for (i = 0; i < sizeof g_npDrmData.keyData; i++)
|
||||
@ -496,70 +495,70 @@ static SceUID LoadModuleAnchorInBtcnf(char *file)
|
||||
SceUID status;
|
||||
|
||||
switch (g_init->apiType) {
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT:
|
||||
case SCE_INIT_APITYPE_GAME_BOOT:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_BOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
status = sceKernelLoadModuleForLoadExecForUser(g_init->apiType, file, 0, NULL);
|
||||
uFile = NULL;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_NPDRM_MS:
|
||||
case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
status = sceKernelLoadModuleForLoadExecNpDrm(g_init->apiType, file, g_npDrmData.fileOffset, g_npDrmData.keyData, 0, NULL);
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
status = sceKernelLoadModuleForLoadExecNpDrm(g_init->apiType, file, g_npDrmData.fileOffset, (const char*)g_npDrmData.keyData, 0, NULL);
|
||||
uFile = NULL;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
status = sceKernelLoadModuleForLoadExecVSHDisc(file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
status = sceKernelLoadModuleForLoadExecVSHDiscUpdater(file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG:
|
||||
if (sceKernelIsToolMode() == SCE_FALSE)
|
||||
status = SCE_ERROR_KERNEL_ILLEGAL_PERMISSION;
|
||||
else
|
||||
status = sceKernelLoadModuleForLoadExecVSHDiscDebug(file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
status = sceKernelLoadModuleForLoadExecVSHDiscEmu(g_init->apiType, file, 0, NULL);
|
||||
uFile = (char *)g_init->discModAddr;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
status = ModuleMgrForKernel_C2A5E6CA(g_init->apiType, file, 0, NULL);
|
||||
uFile = (char *)g_init->discModAddr;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS1:
|
||||
case SCE_INIT_APITYPE_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs1(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS2:
|
||||
case SCE_INIT_APITYPE_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs2(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS3:
|
||||
case SCE_INIT_APITYPE_EF3:
|
||||
case SCE_EXEC_FILE_APITYPE_MS3:
|
||||
case SCE_EXEC_FILE_APITYPE_EF3:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs3(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs4(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS5:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs5(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
status = sceKernelLoadModuleForLoadExecVSHMs6(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
case 0x160:
|
||||
case 0x161:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK161:
|
||||
status = ModuleMgrForKernel_8DD336D4(g_init->apiType, file, 0, NULL);
|
||||
break;
|
||||
default:
|
||||
@ -577,27 +576,27 @@ static SceUID LoadModuleBufferAnchorInBtcnf(void *modBuf, s32 opt)
|
||||
SceUID status;
|
||||
|
||||
switch (g_init->apiType) {
|
||||
case SCE_INIT_APITYPE_USBWLAN:
|
||||
case 0x132:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK132:
|
||||
status = sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlan(g_init->apiType, modBuf, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_USBWLAN_DEBUG:
|
||||
case 0x133:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
if (sceKernelIsToolMode() == SCE_FALSE)
|
||||
status = SCE_ERROR_KERNEL_ILLEGAL_PERMISSION;
|
||||
else
|
||||
status = sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug(g_init->apiType, modBuf, 0, NULL);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_KERNEL_1:
|
||||
case SCE_EXEC_FILE_APITYPE_KERNEL_1:
|
||||
status = sceKernelLoadModuleBufferForExitVSHKernel(modBuf, 0, NULL, opt);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_VSH_1:
|
||||
case SCE_EXEC_FILE_APITYPE_VSH_1:
|
||||
status = sceKernelLoadModuleBufferForExitGame(modBuf, 0, NULL, opt);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_VSH_2:
|
||||
case SCE_EXEC_FILE_APITYPE_VSH_2:
|
||||
status = sceKernelLoadModuleBufferForExitVSHVSH(modBuf, 0, NULL, opt);
|
||||
break;
|
||||
case SCE_INIT_APITYPE_KERNEL_REBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT:
|
||||
status = sceKernelLoadModuleBufferForRebootKernel(modBuf, 0, NULL, opt);
|
||||
break;
|
||||
default:
|
||||
@ -687,29 +686,30 @@ static void InitThreadEntry(SceSize args, void *argp)
|
||||
}
|
||||
g_init->apiType = bootInfo->modules[bootInfo->numModules - 1].bootData;
|
||||
switch (g_init->apiType) {
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT: case SCE_INIT_APITYPE_GAME_BOOT: case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS: case SCE_INIT_APITYPE_EMU_EBOOT_EF: case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_INIT_APITYPE_NPDRM_MS: case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case SCE_INIT_APITYPE_DISC: case SCE_INIT_APITYPE_DISC_DEBUG: case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2: case SCE_INIT_APITYPE_DISC_EMU_EF1: case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_INIT_APITYPE_USBWLAN: case SCE_INIT_APITYPE_USBWLAN_DEBUG: case 0x132: case 0x133:
|
||||
case SCE_INIT_APITYPE_MS2: case SCE_INIT_APITYPE_MS3: case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_INIT_APITYPE_EF2: case SCE_INIT_APITYPE_EF3: case SCE_INIT_APITYPE_EF6:
|
||||
case 0x160:
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS: case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT: case SCE_EXEC_FILE_APITYPE_GAME_BOOT: case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS: case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF: case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS: case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC: case SCE_EXEC_FILE_APITYPE_DISC_DEBUG: case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2: case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1: case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN: case SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG: case SCE_EXEC_FILE_APITYPE_UNK132:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
case SCE_EXEC_FILE_APITYPE_MS2: case SCE_EXEC_FILE_APITYPE_MS3: case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2: case SCE_EXEC_FILE_APITYPE_EF3: case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS: case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
g_init->applicationType = SCE_INIT_APPLICATION_GAME;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_INIT_APITYPE_MS1:
|
||||
case SCE_INIT_APITYPE_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1:
|
||||
g_init->applicationType = SCE_INIT_APPLICATION_UPDATER;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
g_init->applicationType = SCE_INIT_APPLICATION_APP;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_MS5:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
g_init->applicationType = SCE_INIT_APPLICATION_POPS;
|
||||
break;
|
||||
default:
|
||||
@ -718,12 +718,12 @@ static void InitThreadEntry(SceSize args, void *argp)
|
||||
}
|
||||
}
|
||||
switch (g_init->apiType) {
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF: case SCE_INIT_APITYPE_EMU_BOOT_EF: case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case 0x132: case 0x133:
|
||||
case SCE_INIT_APITYPE_EF2: case SCE_INIT_APITYPE_EF3: case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_INIT_APITYPE_EF5: case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF: case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF: case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK132: case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2: case SCE_EXEC_FILE_APITYPE_EF3: case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5: case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
SysMemForKernel_40B744A4(127);
|
||||
break;
|
||||
default:
|
||||
@ -761,7 +761,7 @@ static void InitThreadEntry(SceSize args, void *argp)
|
||||
foundMod = SCE_TRUE;
|
||||
|
||||
SceUID protId = bootInfo->modProtId;
|
||||
if (protId != -1) {
|
||||
if (protId != SCE_KERNEL_VALUE_UNITIALIZED) {
|
||||
SceLoadCoreProtectInfo *prot = &bootInfo->protects[protId];
|
||||
mod->modSize = prot->size;
|
||||
mod->modBuf = (u8 *)prot->addr;
|
||||
@ -771,7 +771,7 @@ static void InitThreadEntry(SceSize args, void *argp)
|
||||
}
|
||||
}
|
||||
protId = bootInfo->modArgProtId;
|
||||
if (protId != -1) {
|
||||
if (protId != SCE_KERNEL_VALUE_UNITIALIZED) {
|
||||
SceLoadCoreProtectInfo *prot = &bootInfo->protects[protId];
|
||||
mod->argPartId = prot->partId;
|
||||
mod->argSize = prot->size;
|
||||
@ -903,7 +903,7 @@ static void InitThreadEntry(SceSize args, void *argp)
|
||||
}
|
||||
|
||||
/* Step3: Init stops and unloads itself now. */
|
||||
sceKernelStopUnloadSelfModuleWithStatusKernel(SCE_KERNEL_NO_RESIDENT, 0, NULL, NULL, NULL);
|
||||
sceKernelStopUnloadSelfModuleWithStatus(SCE_KERNEL_NO_RESIDENT, 0, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
#ifdef INSTALLER
|
||||
@ -931,7 +931,7 @@ s32 InitInit(SceSize argc __attribute__((unused)), void *argp)
|
||||
|
||||
SceLoadCoreBootModuleInfo *modules = bootInfo->modules;
|
||||
if (bootInfo->unk24 == 0 && (u32)modules->modBuf <= (SCE_USERSPACE_GAME_ADDR_K0 - 1)) {
|
||||
void *minStart = (void *)-1;
|
||||
void *minStart = (void *)SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
void *maxEnd = NULL;
|
||||
|
||||
s32 i;
|
||||
|
@ -85,7 +85,7 @@ typedef struct
|
||||
Elf32_Half e_shentsize; /* Section header table entry size */
|
||||
Elf32_Half e_shnum; /* Section header table entry count */
|
||||
Elf32_Half e_shstrndx; /* Section header string table index */
|
||||
} Elf32_Ehdr;
|
||||
} Elf32_Ehdr; // size = 52
|
||||
|
||||
/* Fields in the e_ident array. The EI_* macros are indices into the
|
||||
array. The macros under each EI_* macro are the values the byte
|
||||
|
@ -9,7 +9,7 @@ PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(LoadCoreForKernel, 0x0011, 0x0001)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelDeleteModule, 0x001B57BB)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelUnLinkLibraryEntries, 0x0295CFCE)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelUnlinkLibraryEntries, 0x0295CFCE)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelMaskLibraryEntries, 0x1915737F)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadCoreLock, 0x1999032F)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadExecutableObject, 0x1C394885)
|
||||
|
@ -5,20 +5,22 @@
|
||||
/*
|
||||
* uofw/src/loadcore/loadcore.c
|
||||
*
|
||||
* Loadcore - Basic API for the Module Manager and File Loader of the
|
||||
* Program Loader.
|
||||
* Loadcore - low-level API for the Program Loader.
|
||||
*
|
||||
* The Program Loader loads modules - i.e from flash memory, Memory-Sticks or UMDs -
|
||||
* into memory, relocates modules and manages the loaded modules.
|
||||
* The loader consists of a high-level API provided by the Module Manager and a
|
||||
* low-level API provided by Loadcore.
|
||||
*
|
||||
* The Program Loader handles the loading/relocating of modules and
|
||||
* manages modules in memory. It contains two layers, the Module Manager
|
||||
* and the File Loader. The Module Manager performs linking between
|
||||
* modules and registers/deletes resident libraries provided by modules.
|
||||
* Its basic API is implemented in loadcore.c.
|
||||
* The low-level API is further divided into a Module Linker and a File Loader.
|
||||
* The Module Linker performs linking between modules and manages resident libraries
|
||||
* provided by modules. It is implemented in loadcore.c.
|
||||
*
|
||||
* The File Loader is responsible for loading object files and for
|
||||
* registering/deleting modules. Its basic API is implemented in module.c
|
||||
* The File Loader is responsible for loading object files, managing modules in memory
|
||||
* and for placing relocatable modules in memory. It is implemented in module.c
|
||||
* and loadelf.c
|
||||
*
|
||||
* Specific tasks:
|
||||
* loadcore.c - specific tasks:
|
||||
* 1) Continue booting the rest of the system modules. Every module upto
|
||||
* init.prx (including init) will be booted and its resident libraries
|
||||
* will be registered as well as its stub libraries being linked.
|
||||
@ -32,7 +34,7 @@
|
||||
#include <interruptman.h>
|
||||
#include <loadcore.h>
|
||||
#include <memlmd.h>
|
||||
#include <modulemgr.h>
|
||||
#include <modulemgr_nids.h>
|
||||
#include <sysmem_kdebug.h>
|
||||
#include <sysmem_utils_kernel.h>
|
||||
|
||||
@ -352,7 +354,7 @@ const u32 g_loadCoreExportTable[LOADCORE_EXPORT_TABLE_ENTRIES] = {
|
||||
NID_SCE_KERNEL_SET_BOOT_CALLBACK_LEVEL,
|
||||
NID_SCE_KERNEL_CHECK_PSP_CONFIG,
|
||||
(u32)sceKernelDeleteModule,
|
||||
(u32)sceKernelUnLinkLibraryEntries,
|
||||
(u32)sceKernelUnlinkLibraryEntries,
|
||||
(u32)sceKernelMaskLibraryEntries,
|
||||
(u32)sceKernelLoadCoreLock,
|
||||
(u32)sceKernelLoadExecutableObject,
|
||||
@ -696,7 +698,7 @@ s32 loadCoreInit(SceSize argc __attribute__((unused)), void *argp)
|
||||
//0x00000B78 - 0x00000BA4
|
||||
g_loadCore.sysCallTableSeed = seedPart1 + 0x2000;
|
||||
g_loadCore.secModId = SECONDARY_MODULE_ID_START_VALUE;
|
||||
g_loadCore.loadCoreHeapId = LOADCORE_ERROR;
|
||||
g_loadCore.loadCoreHeapId = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
g_loadCore.linkedLoadCoreStubs = SCE_FALSE;
|
||||
g_loadCore.sysCallTable = NULL;
|
||||
g_loadCore.unk520 = 0;
|
||||
@ -903,7 +905,7 @@ s32 sceKernelLinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32
|
||||
}
|
||||
|
||||
//Subroutine LoadCoreForKernel_0295CFCE - Address 0x00001130
|
||||
s32 sceKernelUnLinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32 size)
|
||||
s32 sceKernelUnlinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32 size)
|
||||
{
|
||||
void *curStubLibEntryTable;
|
||||
|
||||
@ -971,9 +973,9 @@ s32 sceKernelLoadModuleBootLoadCore(SceLoadCoreBootModuleInfo *bootModInfo, SceL
|
||||
if (!isPrx)
|
||||
StopLoadCore();
|
||||
|
||||
if ((execInfo->modInfoAttribute & SCE_PRIVILEGED_MODULES) == SCE_MODULE_KERNEL) { //0x000012A4
|
||||
if ((execInfo->modInfoAttribute & SCE_MODULE_PRIVILEGE_LEVELS) == SCE_MODULE_KERNEL) { //0x000012A4
|
||||
blockId = sceKernelAllocPartitionMemory(SCE_KERNEL_PRIMARY_KERNEL_PARTITION, LOADCORE_KERNEL_PRX_BUFFER_NAME,
|
||||
SCE_KERNEL_SMEM_Low, execInfo->largestSegSize, 0); //0x0000134C
|
||||
SCE_KERNEL_SMEM_Low, execInfo->modCodeSize, 0); //0x0000134C
|
||||
//TODO: Add NULL-pointer check, Sony forgot it.
|
||||
*modMemId = blockId;
|
||||
execInfo->topAddr = sceKernelGetBlockHeadAddr(blockId); //0x00001360
|
||||
@ -990,7 +992,7 @@ s32 sceKernelLoadModuleBootLoadCore(SceLoadCoreBootModuleInfo *bootModInfo, SceL
|
||||
}
|
||||
StopLoadCore();
|
||||
//Note: This return statement isn't included in original loadcore.
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
}
|
||||
|
||||
//Subroutine sub_00001694
|
||||
@ -1122,7 +1124,7 @@ static void SysBoot(SceLoadCoreBootInfo *bootInfo, SysMemThreadConfig *threadCon
|
||||
* Step 3: Link the stub libraries of the recently loaded module
|
||||
* with the currently registered resident libraries.
|
||||
*/
|
||||
if (((s32)execInfo.importsInfo) != LOADCORE_ERROR &&
|
||||
if (((s32)execInfo.importsInfo) != SCE_KERNEL_VALUE_UNITIALIZED &&
|
||||
sceKernelLinkLibraryEntries(execInfo.importsInfo, execInfo.importsSize) < SCE_ERROR_OK)
|
||||
StopLoadCore(); //0x000020E0
|
||||
|
||||
@ -1141,7 +1143,7 @@ static void SysBoot(SceLoadCoreBootInfo *bootInfo, SysMemThreadConfig *threadCon
|
||||
* its loaded resident libraries.
|
||||
*/
|
||||
if (mod == NULL) {
|
||||
sceKernelUnLinkLibraryEntries(execInfo.importsInfo, execInfo.importsSize); //0x00001F24
|
||||
sceKernelUnlinkLibraryEntries(execInfo.importsInfo, execInfo.importsSize); //0x00001F24
|
||||
|
||||
/*
|
||||
* In order to unregister the module's resident libraries, we search
|
||||
@ -1175,7 +1177,7 @@ static void SysBoot(SceLoadCoreBootInfo *bootInfo, SysMemThreadConfig *threadCon
|
||||
* (and similar ones). Boot the module by calling its entry point.
|
||||
*/
|
||||
else {
|
||||
mod->memId = modMemId; //0x000018C0
|
||||
mod->moduleBlockId = modMemId; //0x000018C0
|
||||
sceKernelRegisterModule(mod); //0x000018BC
|
||||
|
||||
//0x000018C4 - 0x00001904
|
||||
@ -1186,7 +1188,7 @@ static void SysBoot(SceLoadCoreBootInfo *bootInfo, SysMemThreadConfig *threadCon
|
||||
ProcessModuleExportEnt(mod, curExportTable); //0x00001F14
|
||||
}
|
||||
mod->segmentChecksum = sceKernelSegmentChecksum(mod); //0x00001908
|
||||
mod->unk220 = 0; //0x0000191C
|
||||
mod->textSegmentChecksum = 0; //0x0000191C
|
||||
|
||||
/* Load and boot every system module up to init.prx. */
|
||||
if (strcmp(mod->modName, INIT_MODULE_NAME) == 0) //0x00001928
|
||||
@ -1206,7 +1208,7 @@ static void SysBoot(SceLoadCoreBootInfo *bootInfo, SysMemThreadConfig *threadCon
|
||||
* unregister its resident libraries.
|
||||
*/
|
||||
else if (status == SCE_KERNEL_NO_RESIDENT) { //0x00001954
|
||||
sceKernelUnLinkLibraryEntries(execInfo.importsInfo, execInfo.importsSize); //0x00001C90
|
||||
sceKernelUnlinkLibraryEntries(execInfo.importsInfo, execInfo.importsSize); //0x00001C90
|
||||
|
||||
exportsEnd = (execInfo.exportsSize & ~0x3) + execInfo.exportsInfo; //0x00001C98 - 0x00001CA4
|
||||
for (curExportTable = execInfo.exportsInfo; curExportTable < exportsEnd;
|
||||
@ -1863,7 +1865,7 @@ static s32 doLinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32
|
||||
* SCE_LIB_WEAK_IMPORT, we ignore that linking failure and proceed.
|
||||
*/
|
||||
if (status == EXPORT_LIB_CANNOT_BE_LINKED || !(stubLib->attribute & SCE_LIB_WEAK_IMPORT)) { //0x00003168 & 0x00003178
|
||||
sceKernelUnLinkLibraryEntries(stubLibEntryTable, size); //0x00003214
|
||||
sceKernelUnlinkLibraryEntries(stubLibEntryTable, size); //0x00003214
|
||||
FreeLibStubCB(stubLib); //0x0000321C
|
||||
return SCE_ERROR_KERNEL_LIBRARY_NOT_FOUND;
|
||||
}
|
||||
@ -2010,7 +2012,7 @@ static s32 ProcessModuleExportEnt(SceModule *mod, SceResidentLibraryEntryTable *
|
||||
for (i = 0; i < lib->stubCount; i++) {
|
||||
switch (lib->entryTable[i]) {
|
||||
case NID_MODULE_REBOOT_PHASE: //0x00003450
|
||||
mod->moduleRebootPhase = (SceKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x00003678
|
||||
mod->moduleRebootPhase = (SceKernelRebootKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x00003678
|
||||
break;
|
||||
case NID_MODULE_BOOTSTART: //0x000035DC
|
||||
mod->moduleBootstart = (SceKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x00003658
|
||||
@ -2022,7 +2024,7 @@ static s32 ProcessModuleExportEnt(SceModule *mod, SceResidentLibraryEntryTable *
|
||||
mod->moduleStop = (SceKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x00003610
|
||||
break;
|
||||
case NID_MODULE_REBOOT_BEFORE: //0x00003478
|
||||
mod->moduleRebootBefore = (SceKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x000035D4
|
||||
mod->moduleRebootBefore = (SceKernelRebootKernelThreadEntry)lib->entryTable[lib->vStubCount + lib->stubCount + i]; //0x000035D4
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2220,21 +2222,21 @@ s32 sceKernelCheckPspConfig(u8 *file, u32 size)
|
||||
pspHdr = (PspHeader *)file;
|
||||
|
||||
if (((pspHdr->magic[0] << 24) | (pspHdr->magic[1] << 16) | (pspHdr->magic[2] << 8) | pspHdr->magic[3]) != PSP_MAGIC) //0x00003DB8
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
if (g_prepareGetLengthFunc != NULL && g_prepareGetLengthFunc(file, size) != 0) //0x00003DE8 & 0x00003DF8
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
status = CheckLatestSubType(file); //0x00003E00
|
||||
if (status == 0) //0x00003E08
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
if (g_setMaskFunc == NULL) //0x00003E1C
|
||||
return SCE_ERROR_KERNEL_LIBRARY_IS_NOT_LINKED;
|
||||
|
||||
status = g_setMaskFunc(0, HWPTR(0xBFC00200)); //0x00003E2C
|
||||
if (status != 0) //0x00003E34
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
if (g_getLengthFunc == NULL) { //0x00003E44
|
||||
/* Decrypt a module. */
|
||||
@ -2244,7 +2246,7 @@ s32 sceKernelCheckPspConfig(u8 *file, u32 size)
|
||||
status = g_getLengthFunc(file, size, &newSize); //0x00003E50
|
||||
|
||||
if (status != 0)
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
return newSize;
|
||||
}
|
||||
@ -2276,21 +2278,21 @@ s32 sceKernelLoadRebootBin(u8 *file, u32 size)
|
||||
partInfo.size = sizeof(SceSysmemPartitionInfo); //0x00003F10
|
||||
status = sceKernelQueryMemoryPartitionInfo(SCE_KERNEL_PRIMARY_KERNEL_PARTITION, &partInfo); //0x00003F0C
|
||||
if (status < SCE_ERROR_OK)
|
||||
return LOADCORE_ERROR; //0x00003F14
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED; //0x00003F14
|
||||
|
||||
if ((u32)file < partInfo.startAddr) //0x00003F24
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
if ((partInfo.startAddr + partInfo.memSize) < (u32)(file + size)) //0x00003F38
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
status = CheckLatestSubType(file); //0x00003F58
|
||||
if (status == 0) //0x00003F64
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
status = memlmd_F26A33C3(0, HWPTR(0xBFC00200)); //0x00003F70
|
||||
if (status != SCE_ERROR_OK) //0x00003F84
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
status = memlmd_CF03556B(file, size, &newSize); //0x00003F8C
|
||||
if (status != SCE_ERROR_OK) //0x00003F94
|
||||
@ -2318,7 +2320,7 @@ static s32 CopyLibEnt(SceResidentLibrary *lib, SceResidentLibraryEntryTable *lib
|
||||
/* Protect Kernel memory from User Mode. */
|
||||
if (isUserLib && (IS_KERNEL_ADDR(libEntryTable) || IS_KERNEL_ADDR(libEntryTable->libName) ||
|
||||
IS_KERNEL_ADDR(libEntryTable->entryTable))) //0x00003698
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
addr = (u32 *)g_hashinfo;
|
||||
addr2 = (u32 *)g_hashinfo;
|
||||
@ -2403,7 +2405,7 @@ static s32 CopyLibStub(SceStubLibrary *stubLib, SceStubLibraryEntryTable *stubLi
|
||||
if (isUserLib && (IS_KERNEL_ADDR(stubLibEntryTable) || IS_KERNEL_ADDR(stubLibEntryTable->libName) ||
|
||||
IS_KERNEL_ADDR(stubLibEntryTable->nidTable) || IS_KERNEL_ADDR(stubLibEntryTable->stubTable) ||
|
||||
IS_KERNEL_ADDR(stubLibEntryTable->vStubTable))) //0x0000386C
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
stubLib->isUserLib = isUserLib;
|
||||
stubLib->libStubTable = stubLibEntryTable;
|
||||
@ -2448,7 +2450,7 @@ static s32 CopyLibStub(SceStubLibrary *stubLib, SceStubLibraryEntryTable *stubLi
|
||||
len = strlen(stubLibEntryTable->libName);
|
||||
stubLib->libName2 = sceKernelAllocHeapMemory(g_loadCoreHeap(), len + 1);
|
||||
if (stubLib->libName == NULL)
|
||||
return LOADCORE_ERROR;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
memcpy(stubLib->libName2, stubLibEntryTable->libName, len + 1);
|
||||
stubLib->libNameInHeap = SCE_TRUE;
|
||||
|
@ -2,19 +2,20 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOADCORE_INT_H
|
||||
#define LOADCORE_INT_H
|
||||
|
||||
#include <common_header.h>
|
||||
#include <loadcore.h>
|
||||
#include <sysmem_kernel.h>
|
||||
#include <sysmem_user.h>
|
||||
#include "systable.h"
|
||||
|
||||
#define LOADCORE_ERROR (-1)
|
||||
|
||||
/* For compatibility reasons. Use PSP_MAGIC_LE. */
|
||||
#define PSP_MAGIC (0x7E505350) /* "~PSP" */
|
||||
|
||||
/* The magic number identifying a file as a PSP object file. */
|
||||
#define PSP_MAGIC (0x7E505350) /* "~PSP" */
|
||||
#define PSP_MAGIC_LE (0x5053507E) /* "~PSP" in Little Endian. */
|
||||
|
||||
/*
|
||||
* A test if a specified address is a kernel address. If the sign-bit
|
||||
|
@ -3,16 +3,16 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* uOFW/trunk/src/loadcore/loadelf.c
|
||||
* uofw/src/loadcore/loadelf.c
|
||||
*
|
||||
* Loadelf represents most of the basic API of the File Loader. It is
|
||||
* responsible for performing checks on loadable ELF files and loading
|
||||
* them. Loading them also implies taking care of any relocation of the
|
||||
* files if needed.
|
||||
*
|
||||
* The File Loader defines two possible loadable file types for modules:
|
||||
* The File Loader defines two possible object file types for modules:
|
||||
* a) a static ELF
|
||||
* b) a relocatable ELF - named PRX (Playstation Relocatable Executable)
|
||||
* b) a relocatable object file - named PRX (Playstation Relocatable Executable)
|
||||
*
|
||||
* PRX comes with a few unique attributes compared to normal ELF's:
|
||||
* a) Customized Program Headers
|
||||
@ -23,8 +23,8 @@
|
||||
* Module segment order:
|
||||
*
|
||||
* A single module needs to have at least three segments and max
|
||||
* SCE_KERNEL_MAX_MODULE_SEGMENT segments. These segments are located in
|
||||
* sequence and each has a size of 16 bytes:
|
||||
* SCE_KERNEL_MAX_MODULE_SEGMENT segments. These segments are typically
|
||||
* located in consecutive order:
|
||||
* Segment Description
|
||||
*
|
||||
* TEXT Includes instruction code and data structures used for
|
||||
@ -108,7 +108,7 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
if (((pspHeader->magic[0] << 24) | (pspHeader->magic[1] << 16) | (pspHeader->magic[2] << 8) | pspHeader->magic[3]) == PSP_MAGIC) { //0x00004018
|
||||
execInfo->modInfoAttribute = pspHeader->modAttribute; //0x00004298
|
||||
if (pspHeader->decryptMode == 0) //0x000042A0
|
||||
execInfo->modInfoAttribute = pspHeader->modAttribute & ~SCE_PRIVILEGED_MODULES; //0x000042B0
|
||||
execInfo->modInfoAttribute = pspHeader->modAttribute & ~SCE_MODULE_PRIVILEGE_LEVELS; //0x000042B0
|
||||
|
||||
execInfo->decSize = pspHeader->elfSize; //0x000042BC
|
||||
execInfo->execAttribute = pspHeader->compAttribute;
|
||||
@ -154,8 +154,8 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->fileBase = execInfo->topAddr; //0x00004064
|
||||
}
|
||||
}
|
||||
execInfo->topAddr = (void *)LOADCORE_ERROR; //0x0000406C
|
||||
execInfo->largestSegSize = 0; //0x00004078
|
||||
execInfo->topAddr = (void *)SCE_KERNEL_VALUE_UNITIALIZED; //0x0000406C
|
||||
execInfo->modCodeSize = 0; //0x00004078
|
||||
execInfo->maxSegAlign = 0; //0x0000407C
|
||||
|
||||
elfHeader = (Elf32_Ehdr *)buf;
|
||||
@ -202,6 +202,8 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->moduleInfoOffset = elfProgHeader->p_paddr & 0x1FFFFFFF; //0x00004184
|
||||
}
|
||||
execInfo->topAddr = (void *)elfProgHeader->p_vaddr; //0x0000418C
|
||||
|
||||
// TODO: Fix the loop condition: != PT_LOAD -> == PT_LOAD
|
||||
if (nSegments > 0 && elfProgHeader->p_type == PT_LOAD) { //0x00004190 & 0x000041A0
|
||||
//0x00004200 - (0x00004244) - 0x0000425C
|
||||
for (i = 0; i < nSegments && elfProgHeader->p_type != PT_LOAD; i++, elfProgHeader++) {
|
||||
@ -215,9 +217,9 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->maxSegAlign = elfProgHeader->p_align; //0x00004240
|
||||
}
|
||||
}
|
||||
execInfo->largestSegSize = maxAddr - lowAddr; //0x000041B0
|
||||
execInfo->modCodeSize = maxAddr - lowAddr; //0x000041B0
|
||||
if (execInfo->elfType == SCE_EXEC_FILE_ELF) { //0x000041B8
|
||||
execInfo->largestSegSize = maxAddr - (lowAddr & 0xFFFFFF00); //0x000041D8
|
||||
execInfo->modCodeSize = maxAddr - (lowAddr & 0xFFFFFF00); //0x000041D8
|
||||
|
||||
if (execInfo->execSize == 0) //0x000041D4
|
||||
execInfo->execSize = maxOffset; //0x000041E8
|
||||
@ -336,23 +338,23 @@ s32 sceKernelProbeExecutableObject(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->importsInfo = modInfo->stubTop; //0x000044F8
|
||||
|
||||
if (!execInfo->isDecrypted) { //0x000044F4
|
||||
if (modInfo->modAttribute & SCE_PRIVILEGED_MODULES) { //0x0000469C
|
||||
if (modInfo->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) { //0x0000469C
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((modInfo->modAttribute & SCE_PRIVILEGED_MODULES) && (execInfo->modInfoAttribute & SCE_PRIVILEGED_MODULES)) { //0x00004504 & 0x00004514
|
||||
if ((modInfo->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) && (execInfo->modInfoAttribute & SCE_MODULE_PRIVILEGE_LEVELS)) { //0x00004504 & 0x00004514
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
execInfo->modInfoAttribute |= (modInfo->modAttribute & ~SCE_PRIVILEGED_MODULES); //0x00004554
|
||||
execInfo->modInfoAttribute |= (modInfo->modAttribute & ~SCE_MODULE_PRIVILEGE_LEVELS); //0x00004554
|
||||
if (execInfo->isDecrypted) //0x00004550
|
||||
return SCE_ERROR_OK;
|
||||
|
||||
if ((execInfo->modInfoAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) { //0x00004558 - 0x00004590
|
||||
if ((execInfo->modInfoAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER) { //0x00004558 - 0x00004590
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
@ -404,7 +406,7 @@ s32 sceKernelProbeExecutableObject(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->importsSize = modInfo->stubEnd - modInfo->stubTop; //0x000046F0
|
||||
execInfo->importsInfo = modInfo->stubTop; //0x000046F8
|
||||
|
||||
tmpModAttr = modInfo->modAttribute & SCE_PRIVILEGED_MODULES;
|
||||
tmpModAttr = modInfo->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS;
|
||||
if (!execInfo->isDecrypted) { //0x000046F4
|
||||
if (tmpModAttr) { //0x000048A4
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
@ -419,14 +421,14 @@ s32 sceKernelProbeExecutableObject(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
}
|
||||
}
|
||||
|
||||
execInfo->modInfoAttribute |= (tmpModAttr & ~SCE_PRIVILEGED_MODULES); //0x00004730
|
||||
execInfo->modInfoAttribute |= (tmpModAttr & ~SCE_MODULE_PRIVILEGE_LEVELS); //0x00004730
|
||||
/* Don't load ELF into Kernel memory. */
|
||||
if (IS_KERNEL_ADDR(execInfo->topAddr)) { //0x0000472C
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
/* Don't load privileged ELF. */
|
||||
if (execInfo->modInfoAttribute & SCE_PRIVILEGED_MODULES) { //0x00004738
|
||||
if (execInfo->modInfoAttribute & SCE_MODULE_PRIVILEGE_LEVELS) { //0x00004738
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
@ -662,10 +664,10 @@ s32 sceKernelLoadExecutableObject(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
return SCE_ERROR_KERNEL_ERROR;
|
||||
}
|
||||
}
|
||||
if ((s32)execInfo->entryAddr != LOADCORE_ERROR) //0x00004B54
|
||||
if ((s32)execInfo->entryAddr != SCE_KERNEL_VALUE_UNITIALIZED) //0x00004B54
|
||||
execInfo->entryAddr += (u32)execInfo->topAddr; //0x00004B5C
|
||||
|
||||
if (execInfo->exportsInfo != (void *)LOADCORE_ERROR) //0x00004B74
|
||||
if (execInfo->exportsInfo != (void *)SCE_KERNEL_VALUE_UNITIALIZED) //0x00004B74
|
||||
execInfo->exportsInfo += (u32)execInfo->topAddr; //0x00004B7C
|
||||
|
||||
if (elfProgHeader->p_type == PT_PRX_RELOC) { //0x00004B88
|
||||
@ -1016,53 +1018,53 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
/* Permit decryption modes dependent on the module/API type. */
|
||||
switch (execInfo->apiType) {
|
||||
case 0: case 2: case 32: case 33: case 81:
|
||||
if (((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 3) && //0x00005D2C
|
||||
((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D08
|
||||
if (((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH || header->decryptMode != 3) && //0x00005D2C
|
||||
((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D08
|
||||
(header->modAttribute > SCE_MODULE_VSH || header->decryptMode != 4)) //0x0000578C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 3:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 4) //0x00005DA8 & 0x0000578C
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 4) //0x00005DA8 & 0x0000578C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 16:
|
||||
if (((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D6C
|
||||
((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 4)) //0x00005D9C
|
||||
if (((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D6C
|
||||
((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 4)) //0x00005D9C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 19:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || (header->decryptMode != 18 && //0x00005E30
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || (header->decryptMode != 18 && //0x00005E30
|
||||
(header->decryptMode != 19 || sceKernelIsToolMode() == 0))) //0x00005E50 & 0x00005E38
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 20:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 23) //0x00005DEC
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 23) //0x00005DEC
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 17: case 48: case 66:
|
||||
if (((header->modAttribute & SCE_PRIVILEGED_MODULES) == SCE_MODULE_USER && header->decryptMode != 4) && //0x00005D60 & 0x00005790
|
||||
(((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL) || header->decryptMode - 1 >= 2)) //0x00005D6C & 0x00005D14
|
||||
if (((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) == SCE_MODULE_USER && header->decryptMode != 4) && //0x00005D60 & 0x00005790
|
||||
(((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_KERNEL) || header->decryptMode - 1 >= 2)) //0x00005D6C & 0x00005D14
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 67:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP || header->decryptMode != 22) //0x00005E1C & 0x00005E28
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_APP || header->decryptMode != 22) //0x00005E1C & 0x00005E28
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 80:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) //0x00005D6C & 0x00005D1C
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) //0x00005D6C & 0x00005D1C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 112:
|
||||
//TODO: Check this.
|
||||
if ((sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_PRIVILEGED_MODULES) == SCE_MODULE_APP) && //0x00005F98 & 0x00005FB4
|
||||
if ((sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) == SCE_MODULE_APP) && //0x00005F98 & 0x00005FB4
|
||||
(header->modAttribute != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D08 & 0x00005D1C
|
||||
(header->modAttribute != SCE_MODULE_VSH || header->decryptMode != 3) && (header->modAttribute != 0 ||
|
||||
header->decryptMode != 4)) //0x00005D30
|
||||
@ -1070,58 +1072,58 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 272: case 274:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 0) //0x00005F7C & 0x00005F88
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 0) //0x00005F7C & 0x00005F88
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 275: case 277:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 9) //0x00005F48
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 9) //0x00005F48
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 276:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 0) //0x00005F7C & 0x00005F88
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 0) //0x00005F7C & 0x00005F88
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 278: case 280:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 23) //0x00006044 & 0x00005F64
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 23) //0x00006044 & 0x00005F64
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 273: case 288:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 9) //0x00005F50 & 0x00005F64
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 9) //0x00005F50 & 0x00005F64
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 289:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006308 & 0x00005790
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006308 & 0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 290:
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || //0x000060C0 & 0x000060D8
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || //0x000060C0 & 0x000060D8
|
||||
((header->decryptMode & 0xFF) != 0 && (header->decryptMode & 0xFF) != 9)) //0x000057B4 & 0x00005F64
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 305: case 307:
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN || //0x0000617C & 0x00006190
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USB_WLAN || //0x0000617C & 0x00006190
|
||||
(header->decryptMode - 10) >= 2) //0x00005D18
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 304: case 306:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN || header->decryptMode != 10) //0x00006120
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USB_WLAN || header->decryptMode != 10) //0x00006120
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 320:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 12) //0x00006244
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH || header->decryptMode != 12) //0x00006244
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 325:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062A8 & 0x000062C0/0x00005790
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062A8 & 0x000062C0/0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 323: case 340:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP || header->decryptMode != 14) //0x00006224 & 0x000061F8
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_APP || header->decryptMode != 14) //0x00006224 & 0x000061F8
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
status = CheckTick(modBuf); //0x00006200
|
||||
@ -1130,23 +1132,23 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 324: case 341:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 20) //0x000061C0
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS || header->decryptMode != 20) //0x000061C0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005790
|
||||
case 342:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062B0
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062B0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //00005790
|
||||
|
||||
//TODO: Check these
|
||||
case 291: case 292: case 294: case 353:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 25) //0x0000613C & 0x00005F64
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER || header->decryptMode != 25) //0x0000613C & 0x00005F64
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
break; //0x000057B4
|
||||
case 512: case 528: case 544: case 768:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006314 & 0x00005D30 & 0x00005790
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006314 & 0x00005D30 & 0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
@ -1164,7 +1166,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_FALSE; //0x000057D8
|
||||
break;
|
||||
case DECRYPT_MODE_BOGUS_MODULE: case DECRYPT_MODE_KERNEL_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL) //0x000058C8
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_KERNEL) //0x000058C8
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (execInfo->isSignChecked == SCE_TRUE) { //0x000058D4
|
||||
@ -1190,7 +1192,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_VSH_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH) //0x000059B0
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH) //0x000059B0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (execInfo->isSignChecked) { //0x000059BC
|
||||
@ -1211,7 +1213,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_USER_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005A48
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER) //0x00005A48
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (execInfo->isSignChecked) { //0x00005A54
|
||||
@ -1232,7 +1234,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x57DC
|
||||
case DECRYPT_MODE_UMD_GAME_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005AE0
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER) //0x00005AE0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_337D0DD3(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1241,7 +1243,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_GAMESHARING_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN) //0x00005B0C
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USB_WLAN) //0x00005B0C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_4EAB9850(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1253,7 +1255,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceKernelIsToolMode() != SCE_ERROR_OK) //0x00005B34
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN) //0x00005B48
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USB_WLAN) //0x00005B48
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_B2CDAC3F(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1262,7 +1264,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_MS_UPDATER:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH) //0x00005B74
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_VSH) //0x00005B74
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_C79E3488(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1271,7 +1273,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_DEMO_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005BA0
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS) //0x00005BA0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_21AFFAAC(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1280,7 +1282,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_APP_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP) //0x00005BCC
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_APP) //0x00005BCC
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_C00DAD75(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1289,37 +1291,37 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_18:
|
||||
if (sceMesgLed_driver_CED2C075(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_CED2C075(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_19:
|
||||
if (sceMesgLed_driver_C7D1C16B(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_C7D1C16B(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_POPS_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005C30
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS) //0x00005C30
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_EBB4613D(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_EBB4613D(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_21:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005C60
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_MS) //0x00005C60
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_66B348B2(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_66B348B2(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_22:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP) //0x00005C90
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_APP) //0x00005C90
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_B2D95FDF(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
@ -1328,19 +1330,19 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_23:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005CB8
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER) //0x00005CB8
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_91E0A9AD(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_91E0A9AD(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_25:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005CE4
|
||||
if ((header->modAttribute & SCE_MODULE_PRIVILEGE_LEVELS) != SCE_MODULE_USER) //0x00005CE4
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (sceMesgLed_driver_31D6D8AA(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
if (sceMesgLed_driver_31D6D8AA(modBuf, execInfo->execSize, newSize, execInfo->secureInstallId) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
@ -1356,7 +1358,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE; //0x000058B4
|
||||
} else if (execInfo->topAddr == NULL) { //0x000057F0
|
||||
return SCE_ERROR_OK;
|
||||
} else if (execInfo->topAddr == (void *)LOADCORE_ERROR) {//0x00005800
|
||||
} else if (execInfo->topAddr == (void *)SCE_KERNEL_VALUE_UNITIALIZED) {//0x00005800
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
|
||||
@ -1402,7 +1404,7 @@ static void readElfSegmentInfo(PspHeader *header, SceLoadCoreExecFileInfo *execI
|
||||
u32 i;
|
||||
u32 maxSegEnd = 0;
|
||||
|
||||
execInfo->largestSegSize = 0; //0x00006328
|
||||
execInfo->modCodeSize = 0; //0x00006328
|
||||
execInfo->topAddr = (void *)header->segAddress[0]; //0x00006334
|
||||
execInfo->maxSegAlign = 0; //0x00006338
|
||||
|
||||
@ -1417,7 +1419,7 @@ static void readElfSegmentInfo(PspHeader *header, SceLoadCoreExecFileInfo *execI
|
||||
maxSegEnd = header->segAddress[i] + header->segSize[i];
|
||||
}
|
||||
}
|
||||
execInfo->largestSegSize = maxSegEnd - (u32)execInfo->topAddr;
|
||||
execInfo->modCodeSize = maxSegEnd - (u32)execInfo->topAddr;
|
||||
}
|
||||
|
||||
//sub_000063C0
|
||||
|
@ -13,8 +13,11 @@
|
||||
|
||||
#define SCE_HEADER_BETA_VERSION (66)
|
||||
|
||||
/* For compatibility reasons. Use SCE_MAGIC_LE. */
|
||||
#define SCE_MAGIC (0x7E534345) /* "~SCE" */
|
||||
|
||||
#define SCE_MAGIC_LE (0x4543537E) /* "~SCE" in Little Endian */
|
||||
|
||||
#define SCE_HEADER_SIZE (64)
|
||||
|
||||
#define AES_KEY_SIZE (16)
|
||||
|
@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sysmem_utils_kernel.h>
|
||||
#include <modulemgr_nids.h>
|
||||
#include "clibUtils.h"
|
||||
#include "module.h"
|
||||
|
||||
@ -117,15 +118,15 @@ SceModule *sceKernelCreateModule(void)
|
||||
}
|
||||
//0x000068D0 - 0x0000689C
|
||||
mod->modId = cb->uid; //0x000068A0
|
||||
mod->moduleStartThreadPriority = LOADCORE_ERROR;
|
||||
mod->moduleStartThreadStacksize = LOADCORE_ERROR;
|
||||
mod->moduleStartThreadAttr = LOADCORE_ERROR;
|
||||
mod->moduleStopThreadPriority = LOADCORE_ERROR;
|
||||
mod->moduleStopThreadStacksize = LOADCORE_ERROR;
|
||||
mod->moduleStopThreadAttr = LOADCORE_ERROR;
|
||||
mod->moduleRebootBeforeThreadPriority = LOADCORE_ERROR;
|
||||
mod->moduleRebootBeforeThreadStacksize = LOADCORE_ERROR;
|
||||
mod->moduleRebootBeforeThreadAttr = LOADCORE_ERROR;
|
||||
mod->moduleStartThreadPriority = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleStartThreadStacksize = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleStartThreadAttr = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleStopThreadPriority = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleStopThreadStacksize = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleStopThreadAttr = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleRebootBeforeThreadPriority = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleRebootBeforeThreadStacksize = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->moduleRebootBeforeThreadAttr = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
mod->countRegVal = pspCop0StateGet(COP0_STATE_COUNT);
|
||||
|
||||
loadCoreCpuResumeIntr(intrState); //0x000068D4
|
||||
@ -181,8 +182,8 @@ s32 sceKernelAssignModule(SceModule *mod, SceLoadCoreExecFileInfo *execFileInfo)
|
||||
if (status < SCE_ERROR_OK) //0x000069B8
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
mod->attribute = (execFileInfo->moduleInfo->modAttribute & ~SCE_PRIVILEGED_MODULES) | execFileInfo->modInfoAttribute; //0x000069CC & 0x000069E0
|
||||
if ((mod->attribute & SCE_PRIVILEGED_MODULES) == SCE_MODULE_KERNEL)
|
||||
mod->attribute = (execFileInfo->moduleInfo->modAttribute & ~SCE_MODULE_PRIVILEGE_LEVELS) | execFileInfo->modInfoAttribute; //0x000069CC & 0x000069E0
|
||||
if ((mod->attribute & SCE_MODULE_PRIVILEGE_LEVELS) == SCE_MODULE_KERNEL)
|
||||
mod->status &= ~SCE_MODULE_USER_MODULE; //0x00006BB4
|
||||
else
|
||||
mod->status |= SCE_MODULE_USER_MODULE; //0x000069E8
|
||||
@ -506,26 +507,26 @@ static SceUID module_do_initialize(SceSysmemUidCB *cb, SceSysmemUidCB *uidWithFu
|
||||
mod = UID_CB_TO_DATA(cb, g_ModuleType, SceModule);
|
||||
|
||||
mod->modId = cb->uid; //0x0000725C
|
||||
mod->entryAddr = LOADCORE_ERROR; //0x00007260
|
||||
mod->entryAddr = SCE_KERNEL_VALUE_UNITIALIZED; //0x00007260
|
||||
mod->version[MODULE_VERSION_MINOR] = 0; //0x00007264
|
||||
mod->version[MODULE_VERSION_MAJOR] = 0; //0x00007268
|
||||
mod->terminal = 0; //0x0000726C
|
||||
mod->moduleStart = (SceKernelThreadEntry)LOADCORE_ERROR; //0x00007270
|
||||
mod->moduleStop = (SceKernelThreadEntry)LOADCORE_ERROR; //0x00007274
|
||||
mod->moduleBootstart = (SceKernelThreadEntry)LOADCORE_ERROR; //0x00007278
|
||||
mod->moduleRebootBefore = (SceKernelThreadEntry)LOADCORE_ERROR; //0x0000727C
|
||||
mod->moduleRebootPhase = (SceKernelThreadEntry)LOADCORE_ERROR; //0x00007280
|
||||
mod->moduleStart = (SceKernelThreadEntry)SCE_KERNEL_VALUE_UNITIALIZED; //0x00007270
|
||||
mod->moduleStop = (SceKernelThreadEntry)SCE_KERNEL_VALUE_UNITIALIZED; //0x00007274
|
||||
mod->moduleBootstart = (SceKernelThreadEntry)SCE_KERNEL_VALUE_UNITIALIZED; //0x00007278
|
||||
mod->moduleRebootBefore = (SceKernelRebootKernelThreadEntry)SCE_KERNEL_VALUE_UNITIALIZED; //0x0000727C
|
||||
mod->moduleRebootPhase = (SceKernelRebootKernelThreadEntry)SCE_KERNEL_VALUE_UNITIALIZED; //0x00007280
|
||||
mod->textSize = 0; //0x00007284
|
||||
mod->dataSize = 0; //0x00007288
|
||||
mod->bssSize = 0; //0x0000728C
|
||||
mod->segmentChecksum = 0; //0x00007290
|
||||
mod->unk220 = 0; //0x00007294
|
||||
mod->textSegmentChecksum = 0; //0x00007294
|
||||
mod->unk224 = 0; //0x00007298
|
||||
mod->status = 0; //0x000072A4
|
||||
mod->next = NULL; //0x000072A8
|
||||
mod->attribute = 0; //0x000072AC
|
||||
mod->entTop = (void *)LOADCORE_ERROR; //0x000072B0
|
||||
mod->stubTop = (void *)LOADCORE_ERROR; //0x000072B4
|
||||
mod->entTop = (void *)SCE_KERNEL_VALUE_UNITIALIZED; //0x000072B0
|
||||
mod->stubTop = (void *)SCE_KERNEL_VALUE_UNITIALIZED; //0x000072B4
|
||||
|
||||
return cb->uid;
|
||||
}
|
||||
@ -585,9 +586,9 @@ static s32 CheckDevkitVersion(SceModuleInfo *modInfo, u32 *fileDevKitVersion)
|
||||
*/
|
||||
static void updateUIDName(SceModule *mod)
|
||||
{
|
||||
if ((mod->status & 0x2000) == 0 && mod->memId > 0) { //0x000073D0 & 0x000073DC
|
||||
if ((mod->status & 0x2000) == 0 && mod->moduleBlockId > 0) { //0x000073D0 & 0x000073DC
|
||||
if ((mod->attribute & (SCE_MODULE_KIRK_MEMLMD_LIB | SCE_MODULE_KIRK_SEMAPHORE_LIB)) == 0) {
|
||||
sceKernelRenameUID(mod->memId, (const char *)mod->modName);
|
||||
sceKernelRenameUID(mod->moduleBlockId, (const char *)mod->modName);
|
||||
sceKernelRenameUID(mod->modId, (const char *)mod->modName);
|
||||
}
|
||||
else {
|
||||
@ -595,7 +596,7 @@ static void updateUIDName(SceModule *mod)
|
||||
* The module uses KIRK libraries and thus is classified as a system
|
||||
* module.
|
||||
*/
|
||||
sceKernelRenameUID(mod->memId, MODULE_SYSTEM_BLOCK_NAME);
|
||||
sceKernelRenameUID(mod->moduleBlockId, MODULE_SYSTEM_BLOCK_NAME);
|
||||
sceKernelRenameUID(mod->modId, MODULE_SYSTEM_MODULE_NAME);
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include "loadcore_int.h"
|
||||
#include "nid.h"
|
||||
|
||||
#define SCE_MODULE_USER_MODULE (0x100)
|
||||
|
||||
#define SCE_PRIVILEGED_MODULES (SCE_MODULE_MS | SCE_MODULE_USB_WLAN | SCE_MODULE_APP | SCE_MODULE_VSH | SCE_MODULE_KERNEL)
|
||||
|
||||
s32 ModuleServiceInit(void);
|
||||
|
||||
#endif /* MODULE_H */
|
||||
|
@ -16,17 +16,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NID_MODULE_BOOTSTART 0xD3744BE0
|
||||
#define NID_MODULE_REBOOT_PHASE 0xADF12745
|
||||
#define NID_MODULE_REBOOT_BEFORE 0x2F064FA6
|
||||
#define NID_MODULE_REBOOT_BEFORE_THREAD_PARAM 0xF4F4299D
|
||||
#define NID_MODULE_START 0xD632ACDB
|
||||
#define NID_MODULE_START_THREAD_PARAM 0x0F7C276C
|
||||
#define NID_MODULE_STOP 0xCEE8593C
|
||||
#define NID_MODULE_STOP_THREAD_PARAM 0xCF0CC697
|
||||
#define NID_MODULE_INFO 0xF01D73A7
|
||||
#define NID_MODULE_SDK_VERSION 0x11B97506
|
||||
|
||||
/* LoadCore exported function NIDs. */
|
||||
#define NID_SCE_KERNEL_DELETE_MODULE 0x001B57BB
|
||||
#define NID_SCE_KERNEL_UNLINK_LIBRARY_ENTRIES 0x0295CFCE
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <iofilemgr_kernel.h>
|
||||
#include <interruptman.h>
|
||||
#include <loadcore.h>
|
||||
#include <modulemgr.h>
|
||||
#include <modulemgr_init.h>
|
||||
#include <modulemgr_kernel.h>
|
||||
#include <sysmem_kdebug.h>
|
||||
#include <sysmem_kernel.h>
|
||||
#include <sysmem_suspend_kernel.h>
|
||||
@ -248,7 +248,7 @@ s32 sceKernelLoadExec(char *file, SceKernelLoadExecParam *opt)
|
||||
{
|
||||
s32 ret;
|
||||
s32 oldK1 = pspShiftK1();
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (ret < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return ret;
|
||||
@ -322,19 +322,19 @@ s32 sceKernelLoadExec(char *file, SceKernelLoadExecParam *opt)
|
||||
// 1220
|
||||
if (sceKernelIsDVDMode() == 0 && strcmp(file, g_unencryptedBootPath) == 0) {
|
||||
file = *g_encryptedBootPathPtr;
|
||||
apiType = SCE_INIT_APITYPE_GAME_BOOT;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_GAME_BOOT;
|
||||
} else
|
||||
apiType = SCE_INIT_APITYPE_GAME_EBOOT;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_GAME_EBOOT;
|
||||
} else {
|
||||
s32 apiType2;
|
||||
if (strcmp(file, g_unencryptedBootPath) != 0) {
|
||||
// 120C
|
||||
apiType = SCE_INIT_APITYPE_EMU_EBOOT_EF;
|
||||
apiType2 = SCE_INIT_APITYPE_EMU_EBOOT_MS;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF;
|
||||
apiType2 = SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS;
|
||||
} else {
|
||||
file = *g_encryptedBootPathPtr;
|
||||
apiType = SCE_INIT_APITYPE_EMU_BOOT_EF;
|
||||
apiType2 = SCE_INIT_APITYPE_EMU_BOOT_MS;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF;
|
||||
apiType2 = SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS;
|
||||
}
|
||||
// 10BC
|
||||
if (InitForKernel_9D33A110() != 80) // not EF
|
||||
@ -380,7 +380,7 @@ s32 sceKernelLoadExec(char *file, SceKernelLoadExecParam *opt)
|
||||
}
|
||||
char *name;
|
||||
// 112C
|
||||
if (apiType == SCE_INIT_APITYPE_EMU_EBOOT_MS || apiType == SCE_INIT_APITYPE_EMU_BOOT_MS || apiType == SCE_INIT_APITYPE_EMU_EBOOT_EF || apiType == SCE_INIT_APITYPE_EMU_BOOT_EF)
|
||||
if (apiType == SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS || apiType == SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS || apiType == SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF || apiType == SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF)
|
||||
name = g_umdEmuStr;
|
||||
else
|
||||
name = g_gameStr;
|
||||
@ -416,7 +416,7 @@ s32 LoadExecForUser_8ADA38D3(char *file, SceKernelLoadExecParam *opt)
|
||||
s32 oldD384;
|
||||
|
||||
s32 oldK1 = pspShiftK1();
|
||||
s32 ret = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
s32 ret = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (ret < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return ret;
|
||||
@ -486,7 +486,7 @@ s32 LoadExecForUser_8ADA38D3(char *file, SceKernelLoadExecParam *opt)
|
||||
pspSetK1(oldK1);
|
||||
return fileId;
|
||||
}
|
||||
ret = ModuleMgrForKernel_C3DDABEF(fileId, unkPtr, unkPtr2);
|
||||
ret = sceKernelNpDrmGetModuleKey(fileId, unkPtr, unkPtr2);
|
||||
if (ret < 0) {
|
||||
sceIoClose(fileId);
|
||||
g_loadExecCb = oldD384;
|
||||
@ -514,36 +514,36 @@ s32 LoadExecForUser_8ADA38D3(char *file, SceKernelLoadExecParam *opt)
|
||||
|
||||
// 1414
|
||||
switch (sceKernelInitApitype()) {
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT:
|
||||
case SCE_INIT_APITYPE_GAME_BOOT:
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG:
|
||||
case SCE_INIT_APITYPE_UNK_GAME1:
|
||||
case SCE_INIT_APITYPE_UNK_GAME2:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_BOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK161:
|
||||
vshParam.key = g_gameStr;
|
||||
break;
|
||||
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
vshParam.key = g_umdEmuStr;
|
||||
break;
|
||||
|
||||
case SCE_INIT_APITYPE_NPDRM_MS:
|
||||
case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
if (sceKernelGetChunk(3) < 0)
|
||||
vshParam.key = g_gameStr;
|
||||
else
|
||||
vshParam.key = g_umdEmuStr;
|
||||
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
vshParam.key = g_mlnAppStr;
|
||||
break;
|
||||
|
||||
@ -558,9 +558,9 @@ s32 LoadExecForUser_8ADA38D3(char *file, SceKernelLoadExecParam *opt)
|
||||
s32 apiType;
|
||||
vshParam.opt11 = 0;
|
||||
if (InitForKernel_9D33A110() == 80)
|
||||
apiType = SCE_INIT_APITYPE_NPDRM_EF;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_NPDRM_EF;
|
||||
else
|
||||
apiType = SCE_INIT_APITYPE_NPDRM_MS;
|
||||
apiType = SCE_EXEC_FILE_APITYPE_NPDRM_MS;
|
||||
|
||||
// 1464
|
||||
args.apiType = apiType;
|
||||
@ -586,7 +586,7 @@ s32 LoadExecForUser_D1FB50DC(void *arg)
|
||||
s32 ret, oldVar;
|
||||
|
||||
s32 oldK1 = pspShiftK1();
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (ret < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return ret;
|
||||
@ -596,7 +596,7 @@ s32 LoadExecForUser_D1FB50DC(void *arg)
|
||||
g_loadExecCb = 0;
|
||||
if (sceKernelIsIntrContext() == 0) {
|
||||
if (pspK1IsUserMode()) {
|
||||
args.apiType = SCE_INIT_APITYPE_VSH_1;
|
||||
args.apiType = SCE_EXEC_FILE_APITYPE_VSH_1;
|
||||
args.args = 0;
|
||||
args.argp = NULL;
|
||||
args.vshParam = &vshParam;
|
||||
@ -700,7 +700,7 @@ s32 sceKernelExitVSHVSH(SceKernelLoadExecVSHParam *opt)
|
||||
vshParam.flags |= 0x10000;
|
||||
vshParam.opt11 = 0;
|
||||
|
||||
args.apiType = SCE_INIT_APITYPE_VSH_2;
|
||||
args.apiType = SCE_EXEC_FILE_APITYPE_VSH_2;
|
||||
args.args = 0;
|
||||
args.argp = NULL;
|
||||
args.vshParam = &vshParam;
|
||||
@ -717,7 +717,7 @@ s32 sceKernelExitVSHVSH(SceKernelLoadExecVSHParam *opt)
|
||||
s32 sceKernelRegisterExitCallback(SceUID cbId) // alias: 4AC57943 in ForUser
|
||||
{
|
||||
s32 oldK1 = pspShiftK1();
|
||||
s32 mtx = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
s32 mtx = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (mtx < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return mtx;
|
||||
@ -750,7 +750,7 @@ s32 sceKernelRegisterExitCallback(SceUID cbId) // alias: 4AC57943 in ForUser
|
||||
s32 sceKernelInvokeExitCallback()
|
||||
{
|
||||
s32 ret;
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
ret = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -815,158 +815,158 @@ s32 sceKernelExitGame()
|
||||
// D8320A28
|
||||
s32 sceKernelLoadExecVSHDisc(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// D4B49C4B
|
||||
s32 sceKernelLoadExecVSHDiscUpdater(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_UPDATER, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_UPDATER, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// 1B305B09
|
||||
s32 sceKernelLoadExecVSHDiscDebug(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
if (sceKernelIsToolMode() != 0)
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_DEBUG, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_DEBUG, file, opt, 0x10000);
|
||||
return SCE_ERROR_KERNEL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_F9CFCF2F(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_EMU_MS1, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_077BA314(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_EMU_MS2, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_E704ECC3(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_EMU_EF1, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_47A5A49C(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_DISC_EMU_EF2, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// BEF585EC
|
||||
s32 sceKernelLoadExecBufferVSHUsbWlan(s32 args, void *argp, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSHWithArgs(SCE_INIT_APITYPE_USBWLAN, args, argp, opt, 0x10000);
|
||||
return loadExecVSHWithArgs(SCE_EXEC_FILE_APITYPE_USBWLAN, args, argp, opt, 0x10000);
|
||||
}
|
||||
|
||||
// 2B8813AF
|
||||
s32 sceKernelLoadExecBufferVSHUsbWlanDebug(s32 args, void *argp, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
if (sceKernelIsToolMode() != 0)
|
||||
return loadExecVSHWithArgs(SCE_INIT_APITYPE_USBWLAN_DEBUG, args, argp, opt, 0x10000);
|
||||
return loadExecVSHWithArgs(SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG, args, argp, opt, 0x10000);
|
||||
return SCE_ERROR_KERNEL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_87C3589C(s32 args, void *argp, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSHWithArgs(SCE_INIT_APITYPE_UNK, args, argp, opt, 0x10000);
|
||||
return loadExecVSHWithArgs(SCE_EXEC_FILE_APITYPE_UNK132, args, argp, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_7CAFE77F(s32 args, void *argp, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
if (sceKernelIsToolMode() != 0)
|
||||
return loadExecVSHWithArgs(SCE_INIT_APITYPE_UNK_DEBUG, args, argp, opt, 0x10000);
|
||||
return loadExecVSHWithArgs(SCE_EXEC_FILE_APITYPE_UNK133, args, argp, opt, 0x10000);
|
||||
return SCE_ERROR_KERNEL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// 4FB44D27
|
||||
s32 sceKernelLoadExecVSHMs1(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS1, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS1, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// D940C83C
|
||||
s32 sceKernelLoadExecVSHMs2(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS2, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS2, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// CC6A47D2
|
||||
s32 sceKernelLoadExecVSHMs3(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS3, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS3, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// 00745486
|
||||
s32 sceKernelLoadExecVSHMs4(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS4, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS4, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// 7CABED9B
|
||||
s32 sceKernelLoadExecVSHMs5(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS5, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS5, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_A6658F10(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MS6, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MS6, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_16A68007(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF1, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF1, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_032A7938(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF2, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF2, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_40564748(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF3, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF3, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_E1972A24(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF4, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF4, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_C7C83B1E(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF5, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF5, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_8C4679D3(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_EF6, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_EF6, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_B343FDAB(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_UNK_GAME1, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_UNK160, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_1B8AB02E(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_UNK_GAME2, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_UNK161, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_C11E6DF1(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MLNAPP_MS, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MLNAPP_MS, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_9BD32619(char *file, SceKernelLoadExecVSHParam *opt)
|
||||
{
|
||||
return loadExecVSH(SCE_INIT_APITYPE_MLNAPP_EF, file, opt, 0x10000);
|
||||
return loadExecVSH(SCE_EXEC_FILE_APITYPE_MLNAPP_EF, file, opt, 0x10000);
|
||||
}
|
||||
|
||||
// C3474C2A
|
||||
s32 sceKernelExitVSHKernel(SceKernelLoadExecVSHParam *arg)
|
||||
{
|
||||
return loadExecKernel(SCE_INIT_APITYPE_KERNEL_1, arg);
|
||||
return loadExecKernel(SCE_EXEC_FILE_APITYPE_KERNEL_1, arg);
|
||||
}
|
||||
|
||||
s32 LoadExecForKernel_C540E3B3()
|
||||
@ -977,7 +977,7 @@ s32 LoadExecForKernel_C540E3B3()
|
||||
// 24114598
|
||||
s32 sceKernelUnregisterExitCallback()
|
||||
{
|
||||
s32 ret = sceKernelLockMutex(g_loadExecMutex, 1, 0);
|
||||
s32 ret = sceKernelLockMutex(g_loadExecMutex, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
g_loadExecCb = 0;
|
||||
@ -1000,7 +1000,7 @@ s32 LoadExecForKernel_A5ECA6E3(void (*arg)())
|
||||
s32 LoadExecInit()
|
||||
{
|
||||
g_loadExecCb = 0;
|
||||
g_loadExecMutex = sceKernelCreateMutex("SceLoadExecMutex", 0x101, 0, 0);
|
||||
g_loadExecMutex = sceKernelCreateMutex("SceLoadExecMutex", 0x101, 0, NULL);
|
||||
g_loadExecIsInited = 0;
|
||||
g_regExitCbCb = NULL;
|
||||
sceKernelSetRebootKernel(rebootKernel);
|
||||
@ -1010,7 +1010,7 @@ s32 LoadExecInit()
|
||||
// 0x20FC
|
||||
s32 runExec(RunExecParams *args)
|
||||
{
|
||||
if (args->apiType != SCE_INIT_APITYPE_KERNEL_REBOOT) {
|
||||
if (args->apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT) {
|
||||
/* Run in a thread */
|
||||
s32 ret, threadEnd;
|
||||
SceKernelThreadOptParam opt;
|
||||
@ -1111,35 +1111,35 @@ s32 loadExecVSH(s32 apiType, char *file, SceKernelLoadExecVSHParam *opt, u32 fla
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
switch (apiType) {
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG:
|
||||
devcmd = 0x208811;
|
||||
iocmd = 0x208011;
|
||||
break;
|
||||
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
devcmd = 0x208814;
|
||||
iocmd = 0x208014;
|
||||
break;
|
||||
|
||||
case SCE_INIT_APITYPE_MS1:
|
||||
case SCE_INIT_APITYPE_MS2:
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
case SCE_INIT_APITYPE_MS5:
|
||||
case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_INIT_APITYPE_EF1:
|
||||
case SCE_INIT_APITYPE_EF2:
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_INIT_APITYPE_UNK_GAME1:
|
||||
case SCE_INIT_APITYPE_UNK_GAME2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5:
|
||||
case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK161:
|
||||
devcmd = 0x208813;
|
||||
iocmd = 0x208013;
|
||||
break;
|
||||
@ -1154,7 +1154,7 @@ s32 loadExecVSH(s32 apiType, char *file, SceKernelLoadExecVSHParam *opt, u32 fla
|
||||
pspSetK1(oldK1);
|
||||
return ret;
|
||||
}
|
||||
if (apiType == SCE_INIT_APITYPE_DISC_DEBUG) {
|
||||
if (apiType == SCE_EXEC_FILE_APITYPE_DISC_DEBUG) {
|
||||
// 24D0
|
||||
if (sceKernelIsToolMode() != 0) {
|
||||
SceIoStat stat;
|
||||
@ -1251,7 +1251,7 @@ s32 loadExecKernel(s32 apiType, SceKernelLoadExecVSHParam *opt)
|
||||
s32 ret;
|
||||
s32 oldK1 = pspShiftK1();
|
||||
|
||||
if (apiType != SCE_INIT_APITYPE_KERNEL_REBOOT && sceKernelIsIntrContext() != 0) { // 2810
|
||||
if (apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT && sceKernelIsIntrContext() != 0) { // 2810
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ s32 loadExecKernel(s32 apiType, SceKernelLoadExecVSHParam *opt)
|
||||
// 0x2844
|
||||
s32 rebootKernel(SceKernelLoadExecVSHParam *arg)
|
||||
{
|
||||
return loadExecKernel(SCE_INIT_APITYPE_KERNEL_REBOOT, arg);
|
||||
return loadExecKernel(SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT, arg);
|
||||
}
|
||||
|
||||
// 0x2864
|
||||
@ -1363,7 +1363,7 @@ s32 runExecFromThread(u32 args __attribute__((unused)), RunExecParams *opt) // 2
|
||||
}
|
||||
|
||||
sceKernelSetSystemStatus(0x40000);
|
||||
if (opt->apiType != SCE_INIT_APITYPE_KERNEL_REBOOT) {
|
||||
if (opt->apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT) {
|
||||
s32 ret = sceKernelPowerRebootStart(0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -1420,60 +1420,60 @@ s32 runReboot(RunExecParams *opt)
|
||||
SceKernelRebootArgType argType = SCE_KERNEL_REBOOT_ARGTYPE_NONE;
|
||||
SceSysmemMemoryBlockInfo blkInfo;
|
||||
switch (opt->apiType) {
|
||||
case SCE_INIT_APITYPE_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_DEBUG:
|
||||
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
|
||||
case SCE_INIT_APITYPE_UNK_GAME1:
|
||||
case SCE_INIT_APITYPE_UNK_GAME2:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK161:
|
||||
|
||||
case SCE_INIT_APITYPE_EF1:
|
||||
case SCE_INIT_APITYPE_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2:
|
||||
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
case SCE_INIT_APITYPE_MS5:
|
||||
case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5:
|
||||
case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
|
||||
case SCE_INIT_APITYPE_MS1:
|
||||
case SCE_INIT_APITYPE_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_MS2:
|
||||
|
||||
case SCE_INIT_APITYPE_USBWLAN:
|
||||
case SCE_INIT_APITYPE_USBWLAN_DEBUG:
|
||||
case SCE_INIT_APITYPE_UNK:
|
||||
case SCE_INIT_APITYPE_UNK_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK132:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
|
||||
case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
|
||||
case SCE_INIT_APITYPE_UNK0x100:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK100:
|
||||
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT:
|
||||
case SCE_INIT_APITYPE_GAME_BOOT:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_INIT_APITYPE_NPDRM_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_BOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS:
|
||||
// (2AE4)
|
||||
argType = SCE_KERNEL_REBOOT_ARGTYPE_FILENAME;
|
||||
break;
|
||||
case SCE_INIT_APITYPE_VSH_2:
|
||||
case SCE_INIT_APITYPE_KERNEL_REBOOT:
|
||||
case SCE_INIT_APITYPE_KERNEL_1:
|
||||
case SCE_INIT_APITYPE_VSH_1:
|
||||
case SCE_EXEC_FILE_APITYPE_VSH_2:
|
||||
case SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_KERNEL_1:
|
||||
case SCE_EXEC_FILE_APITYPE_VSH_1:
|
||||
// 32CC
|
||||
argType = SCE_KERNEL_REBOOT_ARGTYPE_KERNEL;
|
||||
break;
|
||||
@ -1483,7 +1483,7 @@ s32 runReboot(RunExecParams *opt)
|
||||
|
||||
// 2AE8
|
||||
s32 rand = sceKernelGetInitialRandomValue();
|
||||
if (opt->apiType != SCE_INIT_APITYPE_KERNEL_REBOOT) {
|
||||
if (opt->apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT) {
|
||||
// 3218
|
||||
s32 ret = sceKernelRebootBeforeForUser(opt->vshParam);
|
||||
if (ret < 0)
|
||||
@ -1500,7 +1500,7 @@ s32 runReboot(RunExecParams *opt)
|
||||
return ret;
|
||||
}
|
||||
// 2B0C
|
||||
if (opt->apiType != SCE_INIT_APITYPE_KERNEL_REBOOT) {
|
||||
if (opt->apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT) {
|
||||
// 31C8
|
||||
sceKernelSuspendAllUserThreads();
|
||||
}
|
||||
@ -1520,7 +1520,7 @@ s32 runReboot(RunExecParams *opt)
|
||||
}
|
||||
|
||||
// 2B30
|
||||
if (opt->apiType != SCE_INIT_APITYPE_KERNEL_REBOOT) {
|
||||
if (opt->apiType != SCE_EXEC_FILE_APITYPE_KERNEL_REBOOT) {
|
||||
// 3174
|
||||
s32 ret = sceKernelRebootPhaseForKernel(1, opt->vshParam, 0, 0);
|
||||
if (ret < 0)
|
||||
@ -1561,9 +1561,9 @@ s32 runReboot(RunExecParams *opt)
|
||||
// 2FFC
|
||||
copyArgsToRebootParam(hwOpt, opt->vshParam);
|
||||
} else if (opt->argp != NULL) {
|
||||
if ((opt->apiType == SCE_INIT_APITYPE_DISC_EMU_MS1) || (opt->apiType == SCE_INIT_APITYPE_DISC_EMU_MS2)
|
||||
|| (opt->apiType == SCE_INIT_APITYPE_DISC_EMU_EF1) || (opt->apiType == SCE_INIT_APITYPE_DISC_EMU_EF2)
|
||||
|| (opt->apiType == SCE_INIT_APITYPE_MLNAPP_MS) || (opt->apiType == SCE_INIT_APITYPE_MLNAPP_EF)) {
|
||||
if ((opt->apiType == SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1) || (opt->apiType == SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2)
|
||||
|| (opt->apiType == SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1) || (opt->apiType == SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2)
|
||||
|| (opt->apiType == SCE_EXEC_FILE_APITYPE_MLNAPP_MS) || (opt->apiType == SCE_EXEC_FILE_APITYPE_MLNAPP_EF)) {
|
||||
// 2FAC
|
||||
// 2FB0
|
||||
hwOpt->args[0].argp = opt->vshParam->argp;
|
||||
@ -1581,8 +1581,8 @@ s32 runReboot(RunExecParams *opt)
|
||||
hwOpt->args[0].type = argType;
|
||||
hwOpt->curArgs = 1;
|
||||
hwOpt->unk36 = 0;
|
||||
if (opt->apiType == SCE_INIT_APITYPE_EMU_EBOOT_MS || opt->apiType == SCE_INIT_APITYPE_EMU_BOOT_MS
|
||||
|| opt->apiType == SCE_INIT_APITYPE_EMU_EBOOT_EF || opt->apiType == SCE_INIT_APITYPE_EMU_BOOT_EF) {
|
||||
if (opt->apiType == SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS || opt->apiType == SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS
|
||||
|| opt->apiType == SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF || opt->apiType == SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF) {
|
||||
// 3064
|
||||
SceUID id = sceKernelGetChunk(3);
|
||||
ret = id;
|
||||
@ -1595,7 +1595,7 @@ s32 runReboot(RunExecParams *opt)
|
||||
}
|
||||
}
|
||||
// 30AC
|
||||
if ((opt->apiType == SCE_INIT_APITYPE_NPDRM_MS) || (opt->apiType == SCE_INIT_APITYPE_NPDRM_EF)) {
|
||||
if ((opt->apiType == SCE_EXEC_FILE_APITYPE_NPDRM_MS) || (opt->apiType == SCE_EXEC_FILE_APITYPE_NPDRM_EF)) {
|
||||
hwOpt->args[1].argp = opt->npDrmArg;
|
||||
hwOpt->args[1].args = sizeof *opt->npDrmArg;
|
||||
hwOpt->args[1].type = SCE_KERNEL_REBOOT_ARGTYPE_NPDRM;
|
||||
@ -1679,7 +1679,7 @@ s32 runReboot(RunExecParams *opt)
|
||||
// 2D04
|
||||
fixupArgsAddr(hwOpt, opt->vshParam);
|
||||
sceKernelSetDdrMemoryProtection(0x88400000, 0x400000, 12);
|
||||
if (opt->apiType == SCE_INIT_APITYPE_DEBUG)
|
||||
if (opt->apiType == SCE_EXEC_FILE_APITYPE_DEBUG)
|
||||
return ret;
|
||||
sceKernelMemset((void*)0x88600000, 0, 0x200000);
|
||||
#ifndef INSTALLER
|
||||
|
@ -2,6 +2,8 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
typedef struct {
|
||||
u8 user_ecc[3]; //0
|
||||
u8 reserved; //3
|
||||
@ -149,7 +151,7 @@ sceNandInit2(void)
|
||||
memset(&sceNandInfo, 0, 0x40); //SysclibForKernel_10F3BB61
|
||||
sceSysregEmcsmBusClockEnable(); //sceSysreg_driver_F97D9D73
|
||||
sceSysregEmcsmIoEnable(); //sceSysreg_driver_9DD1F821
|
||||
sceNandInfo.mutex_id = sceKernelCreateMutex("SceNand", 0x801, 0, 0); //ThreadManForKernel_B7D098C6
|
||||
sceNandInfo.mutex_id = sceKernelCreateMutex("SceNand", 0x801, 0, NULL); //ThreadManForKernel_B7D098C6
|
||||
sceNandInfo.event_id = sceKernelCreateEventFlag("SceNand", 1, 0, 0); //ThreadManForKernel_55C20A00
|
||||
sceNandInfo.clock_enabled = 0;
|
||||
KDebugForKernel_E892D9A1();
|
||||
@ -321,7 +323,7 @@ sceNandLock(int mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((ret = sceKernelLockMutex(sceNandInfo.mutex_id, 1, 2) < 0)) //ThreadManForKernel_B011B11F
|
||||
if ((ret = sceKernelLockMutex(sceNandInfo.mutex_id, 1, (u32 *)2) < 0)) //ThreadManForKernel_B011B11F
|
||||
return ret;
|
||||
|
||||
if (!sceNandInfo.clock_enabled) {
|
||||
|
@ -44,7 +44,7 @@ int interruptHandler(int a0 __attribute__((unused)), int SceMediaEngineRpcWait)
|
||||
|
||||
int initRpc()
|
||||
{
|
||||
meRpc.mutex = sceKernelCreateMutex("SceMediaEngineRpc", 0x101, 0, 0);
|
||||
meRpc.mutex = sceKernelCreateMutex("SceMediaEngineRpc", 0x101, 0, NULL);
|
||||
if (meRpc.mutex < 0)
|
||||
return meRpc.mutex;
|
||||
meRpc.sema = sceKernelCreateSema("SceMediaEngineAvcPower" , 0x101, 1, 1, 0);
|
||||
@ -142,7 +142,7 @@ int sub_0x1000020(){
|
||||
|
||||
int sub_0x1000002(int arg)
|
||||
{
|
||||
sceKernelLockMutex(meRpc.mutex, 1, 0);
|
||||
sceKernelLockMutex(meRpc.mutex, 1, NULL);
|
||||
int argSr = arg >> 1;
|
||||
int val = *(int*)0xbfc00714;
|
||||
*(int*)0xbfc00710 = arg;
|
||||
@ -1044,7 +1044,7 @@ void sceMeFree(void *ptr)
|
||||
/**************************sceMeCore_driver****************************/
|
||||
int sceMeRpcLock()
|
||||
{
|
||||
return sceKernelLockMutex(meRpc.mutex, 1, 0);
|
||||
return sceKernelLockMutex(meRpc.mutex, 1, NULL);
|
||||
}
|
||||
|
||||
int sceMeRpcUnlock()
|
||||
@ -1145,7 +1145,7 @@ int sceMeBootStart(u32 arg)
|
||||
meImage = "flash0:/kd/resource/me_blimg.img";
|
||||
else
|
||||
meImage = "flash0:/kd/resource/meimg.img";
|
||||
SceUID fd = sceIoOpen(meImage, SCE_O_UNKNOWN0|SCE_O_RDONLY, 0);
|
||||
SceUID fd = sceIoOpen(meImage, SCE_O_ENCRYPTED|SCE_O_RDONLY, 0);
|
||||
if (fd < 0){
|
||||
sceMeRpcUnlock();
|
||||
return fd;
|
||||
@ -1187,7 +1187,7 @@ int sceMeCore_driver_FA398D71(int cmd, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, cmd);
|
||||
int ret = sceKernelLockMutex(meRpc.mutex, 1, 0);
|
||||
int ret = sceKernelLockMutex(meRpc.mutex, 1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int* meTable = (int*)0xbfc00600;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <common_imp.h>
|
||||
#include <interruptman.h>
|
||||
#include <iofilemgr_kernel.h>
|
||||
#include <modulemgr.h>
|
||||
#include <sysmem_kernel.h>
|
||||
#include <sysmem_sysclib.h>
|
||||
|
||||
|
11
src/modulemgr/Makefile
Normal file
11
src/modulemgr/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright (C) 2011, 2016 The uOFW team
|
||||
# See the file COPYING for copying permission.
|
||||
|
||||
TARGET = modulemgr
|
||||
OBJS = chunk.o init.o loadModule.o modulemgr.o override.o queryModule.o rebootModule.o start-stopModule.o
|
||||
|
||||
LIBS = -lSysMemForKernel -lKDebugForKernel -lInterruptManagerForKernel -lUtilsForKernel \
|
||||
-lSysclibForKernel -lThreadManForKernel -lIoFileMgrForKernel -lLoadCoreForKernel
|
||||
|
||||
include ../../lib/build.mak
|
||||
|
@ -1,50 +1,47 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
/* The total number of available chunks. */
|
||||
#define INIT_NUM_CHUNKS (16)
|
||||
/* The slot of the highest available chunk. */
|
||||
#define INIT_MAX_CHUNK (INIT_NUM_CHUNKS - 1)
|
||||
|
||||
/* Indicates a chunk is currently not used by the system. */
|
||||
#define INIT_CHUNK_NOT_USED (-1)
|
||||
|
||||
/* The group of chunks to be used by the system. */
|
||||
s32 chunks[INIT_NUM_CHUNKS]; //0x00009A48
|
||||
|
||||
//sub_000086C0
|
||||
static void ChunkInit(void)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < INIT_NUM_CHUNKS; i++)
|
||||
chunks[i] = INIT_CHUNK_NOT_USED;
|
||||
}
|
||||
|
||||
SceUID sceKernelGetChunk(SceUID chunkId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > INIT_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
return chunks[chunkId];
|
||||
}
|
||||
|
||||
SceUID sceKernelRegisterChunk(SceUID chunkId, SceUID blockId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > INIT_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
|
||||
chunks[chunkId] = blockId;
|
||||
return blockId;
|
||||
}
|
||||
|
||||
SceUID sceKernelReleaseChunk(SceUID chunkId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > INIT_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
|
||||
chunks[chunkId] = INIT_CHUNK_NOT_USED;
|
||||
return INIT_CHUNK_NOT_USED;
|
||||
}
|
||||
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
/* The total number of available chunks. */
|
||||
#define SCE_KERNEL_NUM_CHUNKS (16)
|
||||
/* The slot of the highest available chunk. */
|
||||
#define SCE_KERNEL_MAX_CHUNK (SCE_KERNEL_NUM_CHUNKS - 1)
|
||||
|
||||
/* The group of chunks to be used by the system. */
|
||||
SceUID chunks[SCE_KERNEL_NUM_CHUNKS]; //0x00009A48
|
||||
|
||||
// sub_000086C0
|
||||
void ChunkInit(void)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < SCE_KERNEL_NUM_CHUNKS; i++)
|
||||
chunks[i] = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
}
|
||||
|
||||
SceUID sceKernelGetChunk(s32 chunkId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > SCE_KERNEL_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
return chunks[chunkId];
|
||||
}
|
||||
|
||||
SceUID sceKernelRegisterChunk(s32 chunkId, SceUID blockId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > SCE_KERNEL_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
|
||||
chunks[chunkId] = blockId;
|
||||
return blockId;
|
||||
}
|
||||
|
||||
s32 sceKernelReleaseChunk(s32 chunkId)
|
||||
{
|
||||
if (chunkId < 0 || chunkId > SCE_KERNEL_MAX_CHUNK)
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_CHUNK_ID;
|
||||
|
||||
chunks[chunkId] = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
return SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
}
|
||||
|
||||
|
@ -10,28 +10,28 @@ PSP_EXPORT_VAR_HASH(module_sdk_version)
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(ModuleMgrForUser, 0x0011, 0x4001)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_1196472E, 0x1196472E)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_24EC0641, 0x24EC0641)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelUnloadModule)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelStartModule)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelGetModuleIdList)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelLoadModuleMs)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelQueryModuleInfo)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_8F2DF740, 0x8F2DF740)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelLoadModule)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelLoadModuleByID)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelStopUnloadSelfModule)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_CDE1C1FE, 0xCDE1C1FE)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelStopModule)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelGetModuleGPByAddress)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelSelfStopUnloadModule)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelGetModuleIdByAddress)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_E4C4211C, 0xE4C4211C)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelGetModuleId)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_F2D8D1B4, 0xF2D8D1B4)
|
||||
PSP_EXPORT_FUNC_HASH(sceKernelLoadModuleBufferUsbWlan)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_FBE27467, 0xFBE27467)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForUser_FEF27DC1, 0xFEF27DC1)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferMs, 0x1196472E)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferApp, 0x24EC0641)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelUnloadModule, 0x2E0911AA)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStartModule, 0x50F0C1EC)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleIdList, 0x644395E2)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleMs, 0x710F61B5)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelQueryModuleInfo, 0x748CBED9)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopUnloadSelfModuleWithStatus, 0x8F2DF740)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModule, 0x977DE386)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleByID, 0xB7F46618)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopUnloadSelfModule, 0x8F2DF740)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelCheckTextSegment, 0xCDE1C1FE)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopModule, 0xD1FF982A)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleGPByAddress, 0xD2FBC957)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelSelfStopUnloadModule, 0xD675EBB8)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleIdByAddress, 0xD8B73127)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleWithBlockOffset, 0xE4C4211C)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleId, 0xF0A26395)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleNpDrm, 0xF2D8D1B4)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferUsbWlan, 0xF9275D98)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleByIDWithBlockOffset, 0xFBE27467)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleDNAS, 0xFEF27DC1)
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(ModuleMgrForKernel, 0x0011, 0x0009)
|
||||
@ -50,7 +50,7 @@ PSP_EXPORT_FUNC_NID(sceKernelStartModule, 0x3FF74DF1)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleIdByAddress, 0x433D5287)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleDeci, 0x4493E013)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferForRebootKernel, 0x4E38EA1D)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBuffer, 0x4E62C48A)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferForKernel, 0x4E62C48A)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHMs5, 0x4E8A2C9D)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelSelfStopUnloadModule, 0x5805C1CA)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleByIDBootInitConfig, 0x5FC32087)
|
||||
@ -61,13 +61,13 @@ PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHMs2, 0x7BD53193)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHDiscEmu, 0x853A6C16)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForKernel_8DD336D4, 0x8DD336D4)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferForExitVSHVSH, 0x9236B422)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModule, 0x939E4270)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForKernel, 0x939E4270)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBootInitBtcnf, 0x955D6CB2)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelRebootPhaseForKernel, 0x9B7102E2)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForKernel_A40EC254, 0xA40EC254)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelSetNpDrmGetModuleKeyFunction, 0xA40EC254)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug, 0xC13E2DE5)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForKernel_C2A5E6CA, 0xC2A5E6CA)
|
||||
PSP_EXPORT_FUNC_NID(ModuleMgrForKernel_C3DDABEF, 0xC3DDABEF)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelNpDrmGetModuleKey, 0xC3DDABEF)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferVSH, 0xC6DE0B9C)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelGetModuleId, 0xCAB06D30)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHDiscUpdater, 0xCAE8E169)
|
||||
@ -82,7 +82,7 @@ PSP_EXPORT_FUNC_NID(sceKernelStopModule, 0xE5D6087B)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHMs6, 0xE8422026)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBufferBootInitConfig, 0xE8B9D19D)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopUnloadSelfModule, 0xE97E0DB7)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopUnloadSelfModuleWithStatusKernel, 0xEE6E8F49)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelStopUnloadSelfModuleWithStatus, 0xEE6E8F49)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleByID, 0xEEC2A745)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleBootInitConfig, 0xF7C7FEBC)
|
||||
PSP_EXPORT_FUNC_NID(sceKernelLoadModuleForLoadExecVSHMs1, 0xFE61F16D)
|
||||
|
@ -1,18 +1,19 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
#include <loadcore.h>
|
||||
//#include <loadcore.h>
|
||||
#include <modulemgr_init.h>
|
||||
#include <sysmem_sysclib.h>
|
||||
|
||||
/*
|
||||
* uofw/src/modulemgr/init.c
|
||||
*
|
||||
* init - InitForKernel library
|
||||
*
|
||||
* Its purpose s to provide information about an executable which is
|
||||
* Its purpose is to provide information about an executable which is
|
||||
* being launched, or which was recently launched, by the system. The
|
||||
* information includes the API type of the executable, its application
|
||||
* type, its file name, and the boot medium which was used to boot the
|
||||
@ -31,54 +32,53 @@ SceInit g_init; //0x000099A0
|
||||
u32 sceKernelBootFrom(void)
|
||||
{
|
||||
switch (g_init.apiType) {
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT: //0x00004D20
|
||||
case SCE_INIT_APITYPE_GAME_BOOT:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_INIT_APITYPE_NPDRM_MS:
|
||||
case 0x117:
|
||||
case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case 0x119:
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_INIT_APITYPE_UNK_GAME1: //0x00004DD4
|
||||
case SCE_INIT_APITYPE_UNK_GAME2:
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS: //0x00004DC8
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT: //0x00004D20
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_BOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK117:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK119:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK160: //0x00004DD4
|
||||
case SCE_EXEC_FILE_APITYPE_UNK161:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS: //0x00004DC8
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF:
|
||||
return SCE_INIT_BOOT_DISC; //0x00004D20 | 0x00004D38
|
||||
|
||||
case SCE_INIT_APITYPE_USBWLAN:
|
||||
case SCE_INIT_APITYPE_USBWLAN_DEBUG:
|
||||
case 0x132:
|
||||
case 0x133:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK132:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
return SCE_INIT_BOOT_USBWLAN; //0x00004CFC
|
||||
|
||||
case SCE_INIT_APITYPE_MS1:
|
||||
case SCE_INIT_APITYPE_MS2:
|
||||
case SCE_INIT_APITYPE_MS3:
|
||||
case SCE_INIT_APITYPE_MS5:
|
||||
case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1:
|
||||
case SCE_EXEC_FILE_APITYPE_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS3:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5:
|
||||
case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
return SCE_INIT_BOOT_MS; //0x00004CE8 | 0x00004D50
|
||||
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
char *fileName = sceKernelInitFileName(); //0x00004D58
|
||||
if (strncmp(fileName, "flash3:", strlen("flash3:")) == 0) //0x00004D6C & 0x00004D7C
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
if (strncmp(sceKernelInitFileName(), "flash3:", strlen("flash3:")) == 0) // 0x00004D58 & 0x00004D6C & 0x00004D7C
|
||||
return SCE_INIT_BOOT_FLASH3;
|
||||
return SCE_INIT_BOOT_MS;
|
||||
|
||||
case SCE_INIT_APITYPE_EF1:
|
||||
case SCE_INIT_APITYPE_EF2:
|
||||
case SCE_INIT_APITYPE_EF3:
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1:
|
||||
case SCE_EXEC_FILE_APITYPE_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF3:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
return SCE_INIT_BOOT_EF; //0x00004D98
|
||||
|
||||
default:
|
||||
@ -90,52 +90,51 @@ u32 sceKernelBootFrom(void)
|
||||
u32 InitForKernel_9D33A110(void)
|
||||
{
|
||||
switch (g_init.apiType) {
|
||||
case SCE_INIT_APITYPE_GAME_EBOOT:
|
||||
case SCE_INIT_APITYPE_GAME_BOOT:
|
||||
case SCE_INIT_APITYPE_DISC:
|
||||
case SCE_INIT_APITYPE_DISC_UPDATER:
|
||||
case SCE_INIT_APITYPE_DISC_DEBUG: //0x00004E70
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_EBOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_GAME_BOOT:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_UPDATER:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_DEBUG: //0x00004E70
|
||||
return SCE_INIT_BOOT_DISC; //0x00004E2C
|
||||
|
||||
case SCE_INIT_APITYPE_USBWLAN: //0x00004E9C
|
||||
case SCE_INIT_APITYPE_USBWLAN_DEBUG:
|
||||
case 0x132:
|
||||
case 0x133:
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN: //0x00004E9C
|
||||
case SCE_EXEC_FILE_APITYPE_USBWLAN_DEBUG:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK132:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK133:
|
||||
return SCE_INIT_BOOT_USBWLAN;
|
||||
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_INIT_APITYPE_NPDRM_MS: //0x00004E64
|
||||
case 0x117:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS1: //0x00004DF8
|
||||
case SCE_INIT_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_INIT_APITYPE_MS1: //0x00004EC4
|
||||
case SCE_INIT_APITYPE_MS2:
|
||||
case SCE_INIT_APITYPE_MS3:
|
||||
case SCE_INIT_APITYPE_MS5: //0x00004EEC
|
||||
case SCE_INIT_APITYPE_MS6:
|
||||
case SCE_INIT_APITYPE_MLNAPP_MS: //0x00004F10
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_MS:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_MS: //0x00004E64
|
||||
case SCE_EXEC_FILE_APITYPE_UNK117:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS1: //0x00004DF8
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS1: //0x00004EC4
|
||||
case SCE_EXEC_FILE_APITYPE_MS2:
|
||||
case SCE_EXEC_FILE_APITYPE_MS3:
|
||||
case SCE_EXEC_FILE_APITYPE_MS5: //0x00004EEC
|
||||
case SCE_EXEC_FILE_APITYPE_MS6:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_MS: //0x00004F10
|
||||
return SCE_INIT_BOOT_MS; //0x00004E30
|
||||
|
||||
case SCE_INIT_APITYPE_MS4:
|
||||
char *fileName = sceKernelInitFileName(); //0x00004F14
|
||||
if (strncmp(fileName, "flash3:", strlen("flash3:")) == 0) //0x00004F28 & 0x00004F38
|
||||
case SCE_EXEC_FILE_APITYPE_MS4:
|
||||
if (strncmp(sceKernelInitFileName(), "flash3:", strlen("flash3:")) == 0) // 0x00004F14 & 0x00004F28 & 0x00004F38
|
||||
return SCE_INIT_BOOT_FLASH3;
|
||||
return SCE_INIT_BOOT_MS;
|
||||
|
||||
case SCE_INIT_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_INIT_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_INIT_APITYPE_NPDRM_EF:
|
||||
case 0x119:
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF1: //0x00004EB0
|
||||
case SCE_INIT_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_INIT_APITYPE_EF1: //0x00004ED4
|
||||
case SCE_INIT_APITYPE_EF2:
|
||||
case SCE_INIT_APITYPE_EF3:
|
||||
case SCE_INIT_APITYPE_EF4:
|
||||
case SCE_INIT_APITYPE_EF5:
|
||||
case SCE_INIT_APITYPE_EF6:
|
||||
case SCE_INIT_APITYPE_MLNAPP_EF: //0x00004EF0
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_EBOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_EMU_BOOT_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_NPDRM_EF:
|
||||
case SCE_EXEC_FILE_APITYPE_UNK119:
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF1: //0x00004EB0
|
||||
case SCE_EXEC_FILE_APITYPE_DISC_EMU_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF1: //0x00004ED4
|
||||
case SCE_EXEC_FILE_APITYPE_EF2:
|
||||
case SCE_EXEC_FILE_APITYPE_EF3:
|
||||
case SCE_EXEC_FILE_APITYPE_EF4:
|
||||
case SCE_EXEC_FILE_APITYPE_EF5:
|
||||
case SCE_EXEC_FILE_APITYPE_EF6:
|
||||
case SCE_EXEC_FILE_APITYPE_MLNAPP_EF: //0x00004EF0
|
||||
return SCE_INIT_BOOT_EF; //0x00004E10
|
||||
|
||||
default:
|
||||
@ -148,35 +147,35 @@ char *sceKernelInitFileName(void)
|
||||
return (char *)g_init.fileModAddr;
|
||||
}
|
||||
|
||||
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *status)
|
||||
u32 sceKernelSetInitCallback(SceKernelBootCallbackFunction bootCBFunc, u32 flag, s32 *pStatus)
|
||||
{
|
||||
s32 result;
|
||||
SceBootCallback *curBootCallback;
|
||||
SceBootCallback *pCurBootCallback;
|
||||
|
||||
if (flag < 4) { //0x00004F64
|
||||
if (g_init.bootCallbacks1 == NULL) { //0x00004F78
|
||||
result = bootCBFunc(1, 0, NULL); //0x00004FC8
|
||||
if (status != NULL) //0x00004FD0
|
||||
*status = result;
|
||||
result = bootCBFunc((void *)1, 0, NULL); //0x00004FC8
|
||||
if (pStatus != NULL) //0x00004FD0
|
||||
*pStatus = result;
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
curBootCallback = g_init.curBootCallback1; //0x00004F80
|
||||
curBootCallback->bootCBFunc = (flag & 0x3) + bootCBFunc; //0x00004F90
|
||||
pCurBootCallback = g_init.curBootCallback1; //0x00004F80
|
||||
pCurBootCallback->bootCBFunc = (flag & 0x3) + bootCBFunc; //0x00004F90
|
||||
g_init.curBootCallback1 += 1; //0x00004FA0
|
||||
g_init.curBootCallback1->bootCBFunc = NULL; //0x00004FA8
|
||||
} else {
|
||||
if (g_init.bootCallbacks2 == NULL) { //0x00004FEC
|
||||
result = bootCBFunc(1, 0, NULL); //0x00004FC8
|
||||
if (status != NULL) //0x00004FD0
|
||||
*status = result;
|
||||
result = bootCBFunc((void *)1, 0, NULL); //0x00004FC8
|
||||
if (pStatus != NULL) //0x00004FD0
|
||||
*pStatus = result;
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
curBootCallback = g_init.curBootCallback2; //0x00004FF4
|
||||
curBootCallback->bootCBFunc = (flag & 0x3) + bootCBFunc; //0x00005004
|
||||
pCurBootCallback = g_init.curBootCallback2; //0x00004FF4
|
||||
pCurBootCallback->bootCBFunc = (flag & 0x3) + bootCBFunc; //0x00005004
|
||||
g_init.curBootCallback2 += 1; //0x00005010
|
||||
g_init.curBootCallback2->bootCBFunc = NULL; //0x00004FA8
|
||||
}
|
||||
curBootCallback->gp = sceKernelGetModuleGPByAddressForKernel(bootCBFunc); //0x00004F8C & 0x00004FA4
|
||||
pCurBootCallback->gp = sceKernelGetModuleGPByAddressForKernel((u32)bootCBFunc); //0x00004F8C & 0x00004FA4
|
||||
return SCE_BOOT_CALLBACK_FUNCTION_QUEUED;
|
||||
}
|
||||
|
||||
@ -197,7 +196,7 @@ u32 sceKernelShowIntrMaskTime(void)
|
||||
|
||||
SceInit *sceKernelQueryInitCB(void)
|
||||
{
|
||||
return g_init;
|
||||
return &g_init;
|
||||
}
|
||||
|
||||
s32 sceKernelInitApitype(void)
|
||||
@ -220,10 +219,10 @@ s32 sceKernelInitLptSummary(void)
|
||||
return g_init.lptSummary;
|
||||
}
|
||||
|
||||
void *sceKernelInitParamSfo(SceSize *size)
|
||||
void *sceKernelInitParamSfo(SceSize *pSize)
|
||||
{
|
||||
if (size != NULL)
|
||||
*size = g_init.paramSfoSize;
|
||||
if (pSize != NULL)
|
||||
*pSize = g_init.paramSfoSize;
|
||||
return g_init.paramSfoBase;
|
||||
}
|
||||
|
||||
|
2646
src/modulemgr/loadModule.c
Normal file
2646
src/modulemgr/loadModule.c
Normal file
File diff suppressed because it is too large
Load Diff
113
src/modulemgr/loadModuleChecks_inline.h
Normal file
113
src/modulemgr/loadModuleChecks_inline.h
Normal file
@ -0,0 +1,113 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef LOADMODULECHECKS_INLINE_H
|
||||
#define LOADMODULECHECKS_INLINE_H
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
#include <interruptman.h>
|
||||
#include <modulemgr_options.h>
|
||||
#include <sysmem_sysclib.h>
|
||||
#include <sysmem_kernel.h>
|
||||
|
||||
#include "modulemgr_int.h"
|
||||
|
||||
static inline s32 _checkCallConditionKernel(void)
|
||||
{
|
||||
if (pspK1IsUserMode())
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_PERMISSION_CALL;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
static inline s32 _checkCallConditionUser(void)
|
||||
{
|
||||
if (!pspK1IsUserMode())
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_PERMISSION_CALL;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
static inline s32 _checkPathConditions(const char *path)
|
||||
{
|
||||
if (path == NULL || !pspK1PtrOk(path))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
|
||||
/* Protection against formatted string attacks, path cannot contain a '%'. */
|
||||
if (strchr(path, '%'))
|
||||
return SCE_ERROR_KERNEL_UNKNOWN_MODULE_FILE;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
// sub_00007620
|
||||
static inline s32 _checkLMOptionConditions(const SceKernelLMOption *pOption)
|
||||
{
|
||||
s32 sdkVersion;
|
||||
|
||||
if (pOption == NULL)
|
||||
return SCE_ERROR_OK;
|
||||
|
||||
if (!pspK1StaBufOk(pOption, sizeof(SceKernelLMOption)))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
|
||||
sdkVersion = sceKernelGetCompiledSdkVersion() & 0xFFFF0000;
|
||||
if (sdkVersion >= 0x02080000 && pOption->size != sizeof(SceKernelLMOption))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_SIZE;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
// sub_00007620
|
||||
static inline s32 _checkSMOptionConditions(const SceKernelSMOption *pOption)
|
||||
{
|
||||
s32 sdkVersion;
|
||||
|
||||
if (pOption == NULL)
|
||||
return SCE_ERROR_OK;
|
||||
|
||||
if (!pspK1StaBufOk(pOption, sizeof(SceKernelSMOption)))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
|
||||
sdkVersion = sceKernelGetCompiledSdkVersion() & 0xFFFF0000;
|
||||
if (sdkVersion >= 0x02080000 && pOption->size != sizeof(SceKernelSMOption))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_SIZE;
|
||||
|
||||
if (pOption->attribute & ~THREAD_SM_LEGAL_ATTR)
|
||||
return SCE_ERROR_KERNEL_ERROR;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
static inline s32 _checkMemoryBlockInfoConditions(const SceSysmemMemoryBlockInfo *pBlkInfo, u64 offset)
|
||||
{
|
||||
u32 offsetLow;
|
||||
u32 offsetHigh;
|
||||
|
||||
if (!pspK1DynBufOk((void *)pBlkInfo->addr, pBlkInfo->memSize)) // 0x00000D00
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
|
||||
offsetLow = (u32)offset;
|
||||
offsetHigh = (u32)(offset >> 32);
|
||||
if (offsetHigh > 0 || ((offsetHigh == 0) && (pBlkInfo->memSize < offsetLow))) //0x00000D10 & 0x00000D18 & 0x00000E08
|
||||
return SCE_ERROR_KERNEL_INVALID_ARGUMENT;
|
||||
|
||||
/* Only allow offsets which are a multiple of 64. */
|
||||
if (offsetLow & 0x3F) // 0x00000D38
|
||||
return SCE_ERROR_KERNEL_INVALID_ARGUMENT;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
static inline s32 _checkSecureInstalledIdConditions(const char *secureInstallId)
|
||||
{
|
||||
if (secureInstallId == NULL || !pspK1StaBufOk(secureInstallId, SCE_SECURE_INSTALL_ID_LEN))
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
#endif /* LOADMODULECHECKS_INLINE_H */
|
||||
|
1841
src/modulemgr/modulemgr.c
Normal file
1841
src/modulemgr/modulemgr.c
Normal file
File diff suppressed because it is too large
Load Diff
91
src/modulemgr/modulemgr_int.h
Normal file
91
src/modulemgr/modulemgr_int.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef MODULEMGR_INT_H
|
||||
#define MODULEMGR_INT_H
|
||||
|
||||
#include <common_header.h>
|
||||
#include <loadcore.h>
|
||||
|
||||
#define THREAD_SM_LEGAL_ATTR (SCE_KERNEL_TH_NO_FILLSTACK | SCE_KERNEL_TH_CLEAR_STACK \
|
||||
| SCE_KERNEL_TH_LOW_STACK | SCE_KERNEL_TH_UNK_800000 \
|
||||
| SCE_KERNEL_TH_USE_VFPU | SCE_KERNEL_TH_NEVERUSE_FPU)
|
||||
|
||||
typedef struct {
|
||||
u8 modeStart; //0 The Operation to start on, Use one of the ModuleMgrExeModes modes
|
||||
u8 modeFinish; //1 The Operation to finish on, Use one of the ModuleMgrExeModes modes
|
||||
// SceSysMemBlockType position
|
||||
u8 position; //2
|
||||
u8 access; //3
|
||||
SceUID *pResult; //4
|
||||
SceUID *pNewBlockId; // 8
|
||||
SceModule *pMod; //12
|
||||
SceLoadCoreExecFileInfo *pExecInfo; //16
|
||||
u32 apiType; //20
|
||||
SceUID fd; // 24
|
||||
s32 threadPriority; //28
|
||||
u32 threadAttr; //32
|
||||
SceUID mpIdText; // 36
|
||||
SceUID mpIdData; // 40
|
||||
SceUID threadMpIdStack; //44
|
||||
SceSize stackSize; //48
|
||||
SceUID modId; //52
|
||||
SceUID callerModId; //56
|
||||
SceSize modSize; //60
|
||||
void *fileBase; // 64
|
||||
SceSize argSize; //68
|
||||
void *argp; //72
|
||||
u32 unk76; // 76
|
||||
u32 unk80; // 80
|
||||
s32 *pStatus; // 84
|
||||
SceUID eventId; // 88
|
||||
u32 unk92; // 92
|
||||
u32 unk96; // 96
|
||||
u32 unk100; // 100
|
||||
SceUID externMemBlockIdKernel; // 104
|
||||
SceUID externMemBlockPartitionId; // 108
|
||||
SceSize externMemBlockSize; // 112
|
||||
u32 unk116; // 116
|
||||
void *blockGzip; // 120
|
||||
u32 unk124; // 124
|
||||
char secureInstallId[SCE_SECURE_INSTALL_ID_LEN]; // 128
|
||||
SceUID externMemBlockIdUser; //144
|
||||
u32 unk148; // 148
|
||||
SceOff memBlockOffset; // 152
|
||||
} SceModuleMgrParam; //size = 160
|
||||
|
||||
typedef struct {
|
||||
SceUID threadId; // 0
|
||||
SceUID mutexId; // 4
|
||||
SceUID eventId; // 8
|
||||
SceUID userThreadId; // 12
|
||||
u32 unk16;
|
||||
void *unk20;
|
||||
void *unk24;
|
||||
u32 unk28;
|
||||
s32(*npDrmGetModuleKeyFunction)(SceUID fd, void *, void *); // 32
|
||||
SceModule *pModule;
|
||||
} SceModuleManagerCB;
|
||||
|
||||
enum ModuleMgrExecModes {
|
||||
CMD_LOAD_MODULE, //0
|
||||
CMD_RELOCATE_MODULE, //1
|
||||
CMD_START_MODULE, //2
|
||||
CMD_STOP_MODULE, //3
|
||||
CMD_UNLOAD_MODULE, //4
|
||||
};
|
||||
|
||||
extern SceModuleManagerCB g_ModuleManager;
|
||||
|
||||
// DEBUG
|
||||
//extern int c;
|
||||
|
||||
s32 ClearFreePartitionMemory(s32 partitionId);
|
||||
s32 _CheckUserModulePartition(SceUID memoryPartitionId);
|
||||
s32 _start_exe_thread(SceModuleMgrParam *pModParams);
|
||||
|
||||
void ChunkInit(void);
|
||||
|
||||
#endif /* MODULEMGR_INT_H */
|
||||
|
262
src/modulemgr/override.c
Normal file
262
src/modulemgr/override.c
Normal file
@ -0,0 +1,262 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
#include <iofilemgr_kernel.h>
|
||||
#include <modulemgr_init.h>
|
||||
#include <sysmem_sysclib.h>
|
||||
|
||||
#include "../loadcore/loadelf.h"
|
||||
|
||||
#define numElements(n) (sizeof(n) / sizeof(*(n)))
|
||||
|
||||
/**
|
||||
* uofw/src/modulemgr/override.c
|
||||
*
|
||||
* Starting with firmware 2.60, Sony moved several modules (mainly USB/Audio/Video modules), which were provided by
|
||||
* the PSP SDK, into flash memory. Override.c checks if one of those modules is provided by the
|
||||
* external bootable binary - i.e. a PSP game - to be loaded via sceKernelLoadModuleBufferUsbWlan()
|
||||
* and, if found, replaces it with the module version provided by the PSP kernel on the retrieving PSP.
|
||||
*
|
||||
* 1) This enables larger games to be transferred between PSPs as part of the game sharing functionality
|
||||
* (the transfer data limit is set to 8 MB).
|
||||
*
|
||||
* 2) Even if not required, the retrieving PSP will always use the newest module versions (provided by its
|
||||
* current PSP firmware) of the specified modules.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines an override rule to be used to replace a module provided by an external
|
||||
* bootable binary with the corresponding PSP kernel module.
|
||||
*/
|
||||
typedef struct {
|
||||
/** The path of the module that will be loaded instead. */
|
||||
char *overridePath; // 0
|
||||
/** The number of module hashes. */
|
||||
u32 numHashes; // 4
|
||||
/** List containing numHashes hashes, each of the size of 16 bytes. */
|
||||
void *pHashList; // 8
|
||||
} OverrideRule; // Size: 12
|
||||
|
||||
|
||||
// 0x0000949C
|
||||
u32 g_HashListAudiocodec260[][4] = {
|
||||
{ 0x7876376E, 0x872AFEEB, 0x361DF963, 0xD8F098BB },
|
||||
{ 0xFB64AA34, 0x56645CF2, 0x1DAEAD98, 0xB00D3C0E },
|
||||
{ 0xDD5F48DA, 0x11783859, 0x2DC39F5B, 0x3F8D84ED },
|
||||
{ 0x20323A8F, 0x3B2C8CDB, 0x51B05818, 0x0FA89AA6 },
|
||||
{ 0xA7B3D98B, 0x0464AA5C, 0x35E60616, 0x717B7262 },
|
||||
{ 0x5539BBDB, 0x00C3B31B, 0x2467FC5D, 0x4579D766 },
|
||||
{ 0xB1EBB191, 0xD325E72D, 0xAB99FA28, 0x8C0A52A8 },
|
||||
{ 0xF42ECE92, 0xFA7C6927, 0xFB510A2F, 0xF783B5F4 }
|
||||
};
|
||||
|
||||
// 0x0000951C
|
||||
u32 g_HashListAvcodec[][4] = {
|
||||
{ 0xEB97A208, 0x98CCC35B, 0x56E55510, 0x63EEA61B }
|
||||
};
|
||||
|
||||
// 0x0000952C
|
||||
u32 g_HashListCertLoader[][4] = {
|
||||
{ 0xEB97A208, 0x98CCC35B, 0x56E55510, 0x63EEA61B },
|
||||
{ 0xAA9F884F, 0x301F3F6C, 0x03EC68E1, 0x7AF22856 },
|
||||
{ 0x658533EC, 0xEF9945FC, 0x51917DA6, 0x1DC51A72 },
|
||||
{ 0xF01B5846, 0x65390520, 0x81F6DB31, 0x282021D2 },
|
||||
{ 0x9EF2B510, 0x2CD6537A, 0x7019D1D6, 0x092AE96D }
|
||||
};
|
||||
|
||||
// 0x0000957C
|
||||
u32 g_HashListIfhandle[][4] = {
|
||||
{ 0xE78C22A9, 0xD6D24E98, 0x0826F6F5, 0x85AF086B },
|
||||
{ 0xE03022E8, 0xE1AA30BF, 0x9C6A19DA, 0x98639D7F },
|
||||
{ 0x2BCA7A19, 0x0C7A8D82, 0x3537FCD6, 0x2F6D849B },
|
||||
{ 0x03C03988, 0x09517354, 0x440C0B6B, 0xBFEA08B0 },
|
||||
{ 0x6DF2D214, 0x767A3E51, 0x2F887742, 0x7F0866A0 },
|
||||
{ 0x91BDCA27, 0xF49D9C27, 0x749EB843, 0x9BD611E1 }
|
||||
};
|
||||
|
||||
// 0x00095DC
|
||||
u32 g_HashListMemab[][4] = {
|
||||
{ 0x5CEAA1D7, 0x74A363FF, 0x6DB369E0, 0x6BD19534 },
|
||||
{ 0x978734BC, 0xE35F4DB4, 0x1D60F483, 0xA67774CA },
|
||||
{ 0x95B8EA41, 0xF39178DD, 0xF16840C0, 0x13001E64 }
|
||||
};
|
||||
|
||||
// 0x0x0000960C
|
||||
u32 g_HashListMpegbase260[][4] = {
|
||||
{ 0xFA82ED38, 0xCD2A8263, 0x3FC77BDE, 0xE9D61EDC },
|
||||
{ 0x1D758D52, 0x74FB358F, 0xA17BA41F, 0x86A29BD5 },
|
||||
{ 0xDCDE4585, 0xDEC1EC4E, 0xDADA9CC0, 0x69700702 },
|
||||
{ 0x10D80729, 0xBB96A47C, 0xF022301C, 0x44C24BD5 },
|
||||
{ 0x5A84E1A8, 0x730B5E61, 0x6A66832A, 0x81921676 },
|
||||
{ 0xE61A1541, 0x03AB87B1, 0xFB76D0A7, 0xA7306A7F },
|
||||
{ 0x4FE63CA5, 0xF05D8191, 0x762E9556, 0xCA96B5B8 },
|
||||
{ 0x448D1EB8, 0x4B73E6DF, 0x2D4018A4, 0x858A7DC3 },
|
||||
{ 0xD706B7E3, 0x12869525, 0x75013660, 0xD7D1804A }
|
||||
};
|
||||
|
||||
// 0x0000969C
|
||||
u32 g_HashListPspnetAdhocAuth[][4] = {
|
||||
{ 0x9A341D9A, 0x9181E91B, 0x6FDB531A, 0x04277939 },
|
||||
{ 0x8BC2C3FD, 0x92447E47, 0x9D815AC7, 0x86D8059E },
|
||||
{ 0x956B25E3, 0xBAC6BB52, 0xBC0FD1DD, 0xE031A975 },
|
||||
{ 0xA7861ADB, 0xB8FF4240, 0x41836328, 0x692D3927 },
|
||||
{ 0xE57023CC, 0xADDF02AE, 0x02CFA543, 0xACD407E0 },
|
||||
{ 0xF7D1C4A5, 0x52EFD710, 0x108DD8D2, 0x31A69D6E }
|
||||
};
|
||||
|
||||
// 0x000096FC
|
||||
u32 g_HashListScSascore[][4] = {
|
||||
{ 0xD5378E43, 0xC35EEB6B, 0xB6E6BED6, 0x5D3C1B84 },
|
||||
{ 0xF6E2A9F5, 0x0C8C6F5E, 0x6A00C84C, 0x133E38B4 },
|
||||
{ 0x9A57DA9F, 0xA867593E, 0xF381A5D4, 0x301FBAC3 },
|
||||
{ 0xE7422100, 0x8F810797, 0x9DE915CB, 0x95D82C99 },
|
||||
{ 0x3AD38266, 0x69188BE9, 0xAF8A4094, 0x03EE89EC },
|
||||
{ 0xACF0E562, 0x91273C80, 0xB5567866, 0x8C7B168A },
|
||||
{ 0xEF4CDC26, 0x2BC68F9B, 0x817929F8, 0xF58910CA },
|
||||
{ 0x141D1D63, 0xD6FB060B, 0x3BBB2041, 0x0F5D3F93 },
|
||||
{ 0x50906B1E, 0x8F4C2CD5, 0xBCF9B2C2, 0xBA768623 }
|
||||
};
|
||||
|
||||
// 0x0000978C
|
||||
u32 g_HashListUsbacc[][4] = {
|
||||
{ 0x38B71CE8, 0xD8A55E81, 0x6E316F97, 0x1D897CD4 },
|
||||
{ 0x370B99BE, 0x4C39E7C1, 0x164EBB86, 0xA4902852 },
|
||||
{ 0x8AE90692, 0xBA16A146, 0xC13F5F95, 0x20BBEA10 }
|
||||
};
|
||||
|
||||
// 0x000097BC
|
||||
u32 g_HashListUsbgps[][4] = {
|
||||
{ 0x02419066, 0x2F763CFC, 0x390E5248, 0x374D6E95 }
|
||||
};
|
||||
|
||||
// 0x000097CC
|
||||
u32 g_HashListUsbmic[][4] = {
|
||||
{ 0x23C19622, 0x8417EB95, 0x3D6FF272, 0x90CE5A63 },
|
||||
{ 0xE1EB3B2E, 0x02D9D5EC, 0x235F070B, 0xAF34E772 },
|
||||
{ 0xD24B82AB, 0xC5B9C50B, 0x71CBB494, 0x37E8752D }
|
||||
};
|
||||
|
||||
// 0x000097FC
|
||||
u32 g_HashListUsbpspcm[][4] = {
|
||||
{ 0xECA51E6C, 0x2151DDE2, 0xE1C6C2FE, 0xA51EE0A6 },
|
||||
{ 0xEB4211E4, 0x111BD3A8, 0x85F9DFC6, 0x754CEE44 },
|
||||
{ 0x4A78E41A, 0x632E82C6, 0x5E17AA7A, 0x38F72BDB },
|
||||
{ 0x0740646F, 0x1261388E, 0x3732479E, 0x42A086F9 },
|
||||
{ 0x4C5A9C76, 0xD4B69C2A, 0xC5F23FD1, 0x6ED2FCC8 },
|
||||
{ 0xC8ECB894, 0xAAA64C73, 0xF4F48635, 0xCAB6BB25 },
|
||||
{ 0xFA82E5F0, 0xA313B44B, 0xAED52C22, 0x9AF8C66F },
|
||||
{ 0x1EDFAB4C, 0xFCE9495D, 0xEEA594D1, 0xC800E61A }
|
||||
};
|
||||
|
||||
// 0x0000987C
|
||||
u32 g_HashListVideocodec260[][4] = {
|
||||
{ 0x7B542C1F, 0x78B1BD53, 0x7E8DA5F9, 0x88764DB4 },
|
||||
{ 0x6A5D777C, 0x05B78E83, 0xEF2A46B0, 0xF310B2C0 },
|
||||
{ 0x030725A2, 0x203B2FAC, 0x9B870806, 0x438AA370 },
|
||||
{ 0x0E026711, 0xB0D7767C, 0xBFE36838, 0x9D5DC16D },
|
||||
{ 0xA58B4A70, 0xCC49BF56, 0xC8945D42, 0x57B26C39 },
|
||||
{ 0x44E2DD0F, 0x589BE5F0, 0xD99560F0, 0xA52E9BDE },
|
||||
{ 0xA96F1646, 0x7C294E21, 0xFCEF2951, 0x46B9DB61 },
|
||||
{ 0x73345004, 0xAA9BD0E2, 0xF668F4F5, 0x1B681E70 }
|
||||
};
|
||||
|
||||
// This is the list containing every override rule
|
||||
OverrideRule g_OverrideList[] = { // 0x000098FC
|
||||
{
|
||||
.overridePath = "flash0:/kd/audiocodec_260.prx",
|
||||
.numHashes = numElements(g_HashListAudiocodec260), // = 8
|
||||
.pHashList = g_HashListAudiocodec260,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/avcodec.prx",
|
||||
.numHashes = numElements(g_HashListAvcodec), // = 1
|
||||
.pHashList = g_HashListAvcodec,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/cert_loader.prx",
|
||||
.numHashes = numElements(g_HashListCertLoader), // = 5
|
||||
.pHashList = g_HashListCertLoader,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/ifhandle.prx",
|
||||
.numHashes = numElements(g_HashListIfhandle), // = 6
|
||||
.pHashList = g_HashListIfhandle,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/memab.prx",
|
||||
.numHashes = numElements(g_HashListMemab), // = 3
|
||||
.pHashList = g_HashListMemab,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/mpegbase_260.prx",
|
||||
.numHashes = numElements(g_HashListMpegbase260), // = 9
|
||||
.pHashList = g_HashListMpegbase260,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/pspnet_adhoc_auth.prx",
|
||||
.numHashes = numElements(g_HashListPspnetAdhocAuth), // = 6
|
||||
.pHashList = g_HashListPspnetAdhocAuth,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/sc_sascore.prx",
|
||||
.numHashes = numElements(g_HashListScSascore), // = 9
|
||||
.pHashList = g_HashListScSascore,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/usbacc.prx",
|
||||
.numHashes = numElements(g_HashListUsbacc), // = 3
|
||||
.pHashList = g_HashListUsbacc,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/usbgps.prx",
|
||||
.numHashes = numElements(g_HashListUsbgps), // = 1
|
||||
.pHashList = g_HashListUsbgps,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/usbmic.prx",
|
||||
.numHashes = numElements(g_HashListUsbmic), // = 3
|
||||
.pHashList = g_HashListUsbmic,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/usbpspcm.prx",
|
||||
.numHashes = numElements(g_HashListUsbpspcm), // = 8
|
||||
.pHashList = g_HashListUsbpspcm,
|
||||
}, {
|
||||
.overridePath = "flash0:/kd/videocodec_260.prx",
|
||||
.numHashes = numElements(g_HashListVideocodec260), // = 8
|
||||
.pHashList = g_HashListVideocodec260,
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Replace an external provided module by the corresponding kernel module.
|
||||
*
|
||||
* @param modBuf The external module to be loaded.
|
||||
*
|
||||
* Returns SCE_TRUE if the module was replaced by a kernel module, SCE_FALSE otherwise.
|
||||
*/
|
||||
SceBool _CheckOverride(s32 apiType, void *modBuf, SceUID *pFd) // 0x00008568
|
||||
{
|
||||
if (apiType != SCE_EXEC_FILE_APITYPE_MODULE_BUFFER_USBWLAN && apiType != SCE_EXEC_FILE_APITYPE_MODULE_USER) // 0x000085B0
|
||||
return SCE_FALSE;
|
||||
|
||||
SceHeader* pSceHeader = (SceHeader *)modBuf;
|
||||
if (((u32 *)pSceHeader->magic)[0] == SCE_MAGIC_LE) // 0x000085C4
|
||||
/* Skip SCE header. */
|
||||
modBuf += pSceHeader->size;
|
||||
|
||||
PspHeader *pPspHeader = (PspHeader *)modBuf;
|
||||
if (((u32 *)pPspHeader->magic)[0] != PSP_MAGIC_LE) // 0x000085DC,
|
||||
return SCE_FALSE;
|
||||
|
||||
/* Search for a matching hash in the override table. */
|
||||
u32 i;
|
||||
for (i = 0; i < numElements(g_OverrideList); i++) { // 0x00008630, 0x00008684, 0x0000868C
|
||||
OverrideRule *pCurRule = &g_OverrideList[i];
|
||||
|
||||
/* Scan current override rule for a matching hash. */
|
||||
u32 j;
|
||||
for (j = 0; j < pCurRule->numHashes; j++) {
|
||||
u32 *pCurHash = (u32 *)&((u32(*)[4])pCurRule->pHashList)[j];
|
||||
|
||||
s32 res = memcmp(pPspHeader->keyData4, pCurHash, sizeof pPspHeader->keyData4); // 0x0000865C
|
||||
if (res == 0) {
|
||||
/* We found a matching hash, load module provided by the PSP kernel. */
|
||||
*pFd = sceIoOpen(pCurRule->overridePath, SCE_O_ENCRYPTED | SCE_O_RDONLY, 0);
|
||||
return SCE_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCE_FALSE;
|
||||
}
|
13
src/modulemgr/override.h
Normal file
13
src/modulemgr/override.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef OVERRIDE_H
|
||||
#define OVERRIDE_H
|
||||
|
||||
#include <common_header.h>
|
||||
|
||||
SceBool _CheckOverride(s32 apiType, void *modBuf, SceUID *pFd);
|
||||
|
||||
#endif /* OVERRIDE_H */
|
||||
|
192
src/modulemgr/pbp.h
Normal file
192
src/modulemgr/pbp.h
Normal file
@ -0,0 +1,192 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
/**
|
||||
* A PSP Boot Package (PBP) - such as EBOOT.PBP - is used to distribute PSP applications, i.e. game software.
|
||||
* It contains a PSP system file (PARAM.SFO), content information files (ICON0.PNG, ICON1.PMF, PIC0.PNG,
|
||||
* PIC1.PNG, SND0.AT3) and files containing executable and linking information (DATA.PSP, DATA.PSAR).
|
||||
*
|
||||
* Content information files include data used in the display of games/applications and save data by the
|
||||
* system software. The displayed data includes icon graphics, description graphics, background music,
|
||||
* and the title name.
|
||||
*
|
||||
* For more information about the above listed files, check the following document in the uPSPD wiki: TODO
|
||||
*/
|
||||
|
||||
/*
|
||||
* PBP file layout:
|
||||
*
|
||||
* +--------------------------------------------+
|
||||
* | PBP header (40 Byte) |
|
||||
* |--------------------------------------------|
|
||||
* | PSF header (20 Byte) |
|
||||
* |--------------------------------------------|
|
||||
* | PSF keyInfo (n x 16 Byte)* |
|
||||
* | (*)n > 0; depends on the application type |
|
||||
* |--------------------------------------------|
|
||||
* | n x Keys & n x Values * |
|
||||
* | (*)size depends on the used keys |
|
||||
* |--------------------------------------------|
|
||||
* | Content information files (if any)* |
|
||||
* | (*)size >= 0 |
|
||||
* |--------------------------------------------|-------------------
|
||||
* | SCE Header (64 Byte) (optional) | |
|
||||
* |--------------------------------------------| |
|
||||
* | PSP header (336 Byte)* | |
|
||||
* | (*)ONLY for encrypted/compressed files | |
|
||||
* |--------------------------------------------| DATA.PSP
|
||||
* | ELF header (52 Byte) | |
|
||||
* |--------------------------------------------| |
|
||||
* | Rest of ELF file | |
|
||||
* |--------------------------------------------|-------------------
|
||||
* | PSAR header (optional) | |
|
||||
* |--------------------------------------------| DATA.PSAR
|
||||
* | PSAR data (if any) | |
|
||||
* +--------------------------------------------+-------------------
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* Identifies a file as a .PBP file. */
|
||||
#define PBP_MAGIC (0x00504250) /* " PBP" */
|
||||
|
||||
/*
|
||||
* This structure represents the .PBP header.
|
||||
*
|
||||
* If an application does not have any specified content information files,
|
||||
* the members icon0Off to snd0Off can be filled with default values.
|
||||
*/
|
||||
typedef struct {
|
||||
/* PBP magic value. */
|
||||
u8 magic[4]; // 0
|
||||
/* PBP header version. */
|
||||
u32 version; // 4
|
||||
/* The PARAM.SFO file offset in bytes. */
|
||||
u32 paramOff; // 8
|
||||
/* The ICON0.PNG file offset in bytes. */
|
||||
u32 icon0Off; // 12
|
||||
/* The ICON1.PMF file offset in bytes. */
|
||||
u32 icon1Off; // 16
|
||||
/* The PIC0.PNG file offset in bytes. */
|
||||
u32 pic0Off; // 20
|
||||
/* The PIC1.PNG file offset in bytes. */
|
||||
u32 pic1Off; // 24
|
||||
/* The SND0.AT3 file offset in bytes. */
|
||||
u32 snd0Off; // 28
|
||||
/* The DATA.PSP file offset in bytes. */
|
||||
u32 dataPSPOff; // 32
|
||||
/* The DATA.PSAR file offset in bytes. */
|
||||
u32 dataPSAROff; // 36
|
||||
} PBPHeader; // size = 40
|
||||
|
||||
/* Identifies a file as a PARAM.SFO file. */
|
||||
#define PSF_MAGIC (0x00505346) /* " PSF" */
|
||||
|
||||
/**
|
||||
* This structure represents the PARAM.SFO (PSF) header.
|
||||
*
|
||||
* The .SFO header belongs to the PARAM.SFO file, a system file which stores
|
||||
* parameters used for display by the PSP system software, such as the game title,
|
||||
* user age restriction value, etc., as well as parameters used internally, such as
|
||||
* the product number or the disc serial number. The required parameters depend on
|
||||
* the type of the executable file (i.e. game, video, audio).
|
||||
*/
|
||||
typedef struct {
|
||||
/** PSF magic value. */
|
||||
u8 magic[4];
|
||||
/** PSF header version. */
|
||||
u32 version;
|
||||
/** File offset in bytes to the table containing the used keys. */
|
||||
u32 keyTableOffset;
|
||||
/** File offset in bytes to the table containing the values for the used keys. */
|
||||
u32 dataTableOffset;
|
||||
/** The number of keys used in the file. */
|
||||
u32 numKeys;
|
||||
} PSFHeader;
|
||||
|
||||
/** PSF Value formats */
|
||||
|
||||
#define PSF_VALUE_FMT_UNKNOWN (0x0004) /* TODO: Verify: Used in contents generated by the system (e.g.: save data). */
|
||||
#define PSF_VALUE_FMT_STRING_UTF8 (0x0204) /* Character string including '\0'. */
|
||||
#define PSF_VALUE_FMT_UINT32 (0x0404) /* 32 Bit unsigned integer. */
|
||||
|
||||
typedef struct {
|
||||
/** Offset relative to start of the keyTable (in bytes). Directs to a key. */
|
||||
u16 keyOffset;
|
||||
/** Type of the value of the key specified by <keyOffset>. */
|
||||
u16 valueFmt;
|
||||
/** Actual length of the value of the key specified by <keyOffset>. */
|
||||
u32 valueLen;
|
||||
/** Maximum length of the value of the key specified by <keyOffset>. */
|
||||
u32 valueMaxLen;
|
||||
/**
|
||||
* Offset relative to start of the dataTable (in bytes). Directs to the value of the key
|
||||
* specified by <keyOffset>.
|
||||
*/
|
||||
u32 valueOffset;
|
||||
} PSFKeyInfo;
|
||||
|
||||
/** PSF Keys */
|
||||
|
||||
#define PSF_KEY_APP_VER "APP_VER" /** Version of the application or patch. */
|
||||
#define PSF_KEY_ATTRIBUTE "ATTRIBUTE"
|
||||
#define PSF_KEY_BOOTABLE "BOOTABLE" /** Whether or not the application is bootable. */
|
||||
#define PSF_KEY_DISC_ID "DISC_ID" /** Product number. */
|
||||
#define PSF_KEY_CATEGORY "CATEGORY" /** System file category. */
|
||||
#define PSF_KEY_DISC_NUMBER "DISC_NUMBER" /** Disc number within a disc set. */
|
||||
#define PSF_KEY_DISC_TOTAL "DISC_TOTAL" /** The total number of discs in a disc set. */
|
||||
#define PSF_KEY_DISC_VERSION "DISC_VERSION" /** The disc version. Format X.YZ (X,Y,Z: 0-9). */
|
||||
#define PSF_KEY_DRIVER_PATH "DRIVER_PATH" /** Pathname of the device driver. */
|
||||
#define PSF_KEY_GAMEDATA_ID "GAMEDATA_ID" /** Identifier used in place of the product number to allow patch sharing. */
|
||||
#define PSF_KEY_HRKGMP_VER "HRKGMP_VER"
|
||||
#define PSF_KEY_MEMSIZE "MEMSIZE" /** Add extra RAM for application (not for PSP-100X). */
|
||||
#define PSF_KEY_PARENTAL_LEVEL "PARENTAL_LEVEL" /** Restriction level for applications. */
|
||||
#define PSF_KEY_PBOOT_TITLE "PBOOT_TITLE" /** Patch title name. */
|
||||
#define PSF_KEY_PSP_SYSTEM_VER "PSP_SYSTEM_VER" /** PSP system software version required to execute the application. */
|
||||
#define PSF_KEY_REGION "REGION" /** The region of the PSP hardware where the application can be executed. */
|
||||
#define PSF_KEY_TARGET_APP_VER "TARGET_APP_VER"
|
||||
/**
|
||||
* Title of the application (default language). USE "TITLE_XY" (X,Y:0-9) for every other
|
||||
* instance of translated title.
|
||||
*/
|
||||
#define PSF_KEY_TITLE "TITLE"
|
||||
#define PSF_KEY_UPDATER_VER "UPDATER_VER" /** The version of the updater. */
|
||||
#define PSF_KEY_USE_USB "USE_USB" /** Indicates whether or not the USB accessory is used. */
|
||||
|
||||
/** PSF Values */
|
||||
|
||||
#define PSF_VALUE_CATEGORY_APPS "MA" /** category: Memory Stick application */
|
||||
#define PSF_VALUE_CATEGORY_PS1_GAME "ME" /** category: PS1 game */
|
||||
#define PSF_VALUE_CATEGORY_MS_GAME "MG" /** category: Memory Stick game */
|
||||
#define PSF_VALUE_CATEGORY_SAVEDATA "MS" /** category: Save data for games & applications */
|
||||
#define PSF_VALUE_CATEGORY_PATCH_GAME "PG" /** category: Patch for a game */
|
||||
#define PSF_VALUE_CATEGORY_UMD_GAME "UG" /** category: UMD game */
|
||||
#define PSF_VALUE_CATEGORY_WLAN_GAME "WG" /** category: External bootable binary */
|
||||
#define PSF_VALUE_CATEGORY_SYSTEM_SOFTWARE_UPDATE "MSTKUPDATE" /** category: System Software update */
|
||||
|
||||
#define PSF_VALUE_TITLE_MAX_LEN (128) /* Including '\0'. */
|
||||
#define PSF_VALUE_PBOOT_TITLE_MAX_LEN (128) /* Including '\0'. */
|
||||
|
||||
/* Parental lock level - Lower level means less restrictions. */
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_0 (0)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_1 (1)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_2 (2)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_3 (3)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_4 (4)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_5 (5)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_6 (6)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_7 (7)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_8 (8)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_9 (9)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_10 (10)
|
||||
#define PSF_VALUE_PARENTAL_LEVEL_11 (11)
|
||||
|
||||
#define PSF_VALUE_REGION_ALL_REGIONS (0x8000)
|
||||
|
||||
/* Product number - allowed characters: A-Z, 0-9 */
|
||||
#define PSF_VALUE_DISC_ID_MAX_LEN (16) /* Including '\0'. */
|
||||
|
||||
#define PSF_VALUE_DRIVER_PATH_MAX_LEN (64)
|
307
src/modulemgr/queryModule.c
Normal file
307
src/modulemgr/queryModule.c
Normal file
@ -0,0 +1,307 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
#include <interruptman.h>
|
||||
#include <loadcore.h>
|
||||
#include <modulemgr_kernel.h>
|
||||
#include <sysmem_kernel.h>
|
||||
#include <sysmem_sysclib.h>
|
||||
|
||||
#include "modulemgr_int.h"
|
||||
|
||||
/**
|
||||
* Find the id of the module from which this function is called
|
||||
*
|
||||
* @param pModIdList A pointer which will hold the module id list
|
||||
* @param size Maximum size of the returned buffer
|
||||
* @param pIdCount The number of module ids in the list (can be greater than the number of returned ids)
|
||||
*
|
||||
* @return SCE_ERROR_OK on success, < 0 on error.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_ADDR if the provided pointers can't be accessed from the current context or are NULL.
|
||||
*/
|
||||
// Subroutine ModuleMgrForUser_644395E2 - Address 0x000041E8 - Aliases: ModuleMgrForKernel_303FAB7F
|
||||
s32 sceKernelGetModuleIdList(SceUID *pModIdList, SceSize size, u32 *pIdCount)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 status;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
if (pModIdList == NULL || pIdCount == NULL || !pspK1DynBufOk(pModIdList, size) || !pspK1StaBufOk(pIdCount, sizeof *pIdCount)) { // 0x00004200, 0x00004220, 0x00004238, 0x00004244
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = sceKernelGetModuleIdListForKernel(pModIdList, size, pIdCount, pspK1IsUserMode());
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module information from id
|
||||
*
|
||||
* @param modId The module id
|
||||
* @param pModInfo Pointer to SceKernelModuleInfo, content will be modified on success with info from the module
|
||||
*
|
||||
* @return SCE_ERROR_OK on success, < 0 on error.
|
||||
* @return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT if function was called in an interruption.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_ADDR if the provided pointer is NULL or can't be accessed from the current context.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_SIZE if SDK version >= 2.80 and modInfo->size != sizeof(SceKernelModuleInfoV1) && modInfo->size != sizeof(*modInfo)
|
||||
* @return SCE_ERROR_KERNEL_UNKNOWN_MODULE if module couldn't be found
|
||||
* @return SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO if you don't have the right to access information about this module
|
||||
*/
|
||||
// Subroutine ModuleMgrForUser_748CBED9 - Address 0x00004270 - Aliases: ModuleMgrForKernel_22BDBEFF
|
||||
s32 sceKernelQueryModuleInfo(SceUID modId, SceKernelModuleInfo *pModInfo)
|
||||
{
|
||||
s32 oldK1;
|
||||
u32 sdkVersion;
|
||||
s32 intrState;
|
||||
SceModule *pMod;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
// Cannot be called from interrupt
|
||||
if (sceKernelIsIntrContext()) { // 0x0000429C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (pModInfo == NULL || !pspK1StaBufOk(pModInfo, sizeof(*pModInfo))) { // 0x000042AC, 0x000042BC
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
sdkVersion = sceKernelGetCompiledSdkVersion() & 0xFFFF0000; // 0x000042F4
|
||||
|
||||
if (sdkVersion >= 0x02080000 && pModInfo->size != sizeof(SceKernelModuleInfoV1) // 0x0000430C, 0x00004320
|
||||
&& pModInfo->size != sizeof(SceKernelModuleInfo)) { // 0x00004324
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_SIZE;
|
||||
}
|
||||
|
||||
intrState = sceKernelLoadCoreLock(); // 0x00004334
|
||||
|
||||
pMod = sceKernelFindModuleByUID(modId); // 0x00004340
|
||||
if (pMod == NULL) { // 0x00004348
|
||||
sceKernelLoadCoreUnlock(intrState);
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_UNKNOWN_MODULE;
|
||||
}
|
||||
|
||||
if (pspK1IsUserMode()) { // 0x00004350
|
||||
if (!(pMod->status & SCE_MODULE_USER_MODULE)) {
|
||||
sceKernelLoadCoreUnlock(intrState);
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO;
|
||||
}
|
||||
|
||||
s32 userLevel = sceKernelGetUserLevel();
|
||||
u16 modPrivilegeLvl = pMod->attribute & SCE_MODULE_PRIVILEGE_LEVELS;
|
||||
if (!(userLevel == SCE_USER_LEVEL_USBWLAN && modPrivilegeLvl == SCE_MODULE_USB_WLAN) // 0x00004368,0x00004370,0x000044C0
|
||||
&& !(userLevel == SCE_USER_LEVEL_MS && modPrivilegeLvl == SCE_MODULE_MS) // 0x0000437C,0x00004388,0x000044A8
|
||||
&& !(userLevel == SCE_USER_LEVEL_APP && modPrivilegeLvl == SCE_MODULE_APP) // 0x00004390,0x0000439C,0x00004490
|
||||
&& (modPrivilegeLvl & SCE_MODULE_PRIVILEGE_LEVELS)) { // 0x000043A8
|
||||
sceKernelLoadCoreUnlock(intrState);
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
/* Only obtain information about modules currently loaded in the system. */
|
||||
s32 modStatus = GET_MCB_STATUS(pMod->status);
|
||||
if (modStatus != MCB_STATUS_RELOCATED && modStatus != MCB_STATUS_STARTING && modStatus != MCB_STATUS_STARTED
|
||||
&& modStatus != MCB_STATUS_STOPPING && modStatus != MCB_STATUS_STOPPED) { // 0x000043C0
|
||||
sceKernelLoadCoreUnlock(intrState);
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_GET_MODULE_INFO;
|
||||
}
|
||||
pModInfo->nsegment = pMod->nSegments; // 0x000043C8
|
||||
|
||||
s32 i;
|
||||
for (i = 0; i < SCE_KERNEL_MAX_MODULE_SEGMENT; i++) { // 0x000043F0
|
||||
pModInfo->segmentAddr[i] = pMod->segmentAddr[i]; // 0x000043E4
|
||||
pModInfo->segmentSize[i] = pMod->segmentSize[i]; // 0x000043F4
|
||||
}
|
||||
|
||||
pModInfo->entryAddr = pMod->entryAddr; // 0x00004404
|
||||
pModInfo->gpValue = pMod->gpValue; // 0x0000440C
|
||||
pModInfo->textAddr = pMod->textAddr; // 0x00004414
|
||||
pModInfo->textSize = pMod->textSize; // 0x0000441C
|
||||
pModInfo->dataSize = pMod->dataSize; // 0x00004424
|
||||
pModInfo->bssSize = pMod->bssSize; // 0x00004430
|
||||
|
||||
/* If we are working with a <SceKernelModuleInfo> object, copy the remaining data. */
|
||||
if (pModInfo->size == sizeof(SceKernelModuleInfo)) { // 0x0000442C
|
||||
pModInfo->attribute = pMod->attribute & ~SCE_MODULE_PRIVILEGE_LEVELS;
|
||||
pModInfo->version[MODULE_VERSION_MINOR] = pMod->version[MODULE_VERSION_MINOR];
|
||||
pModInfo->version[MODULE_VERSION_MAJOR] = pMod->version[MODULE_VERSION_MAJOR];
|
||||
strncpy(pModInfo->modName, pMod->modName, SCE_MODULE_NAME_LEN);
|
||||
pModInfo->terminal = pMod->terminal;
|
||||
}
|
||||
|
||||
sceKernelLoadCoreUnlock(intrState);
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the id of the module from which this function is called
|
||||
*
|
||||
* @return The module id on success, < 0 on error.
|
||||
* @return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT if function was called in an interruption.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_ADDR if the provided pointer can't be accessed from the current context.
|
||||
* @return SCE_ERROR_KERNEL_ERROR if module couldn't be found.
|
||||
*/
|
||||
// Subroutine ModuleMgrForUser_F0A26395 - Address 0x000058F8 - Aliases: ModuleMgrForKernel_CECA0FFC
|
||||
SceUID sceKernelGetModuleId(void)
|
||||
{
|
||||
s32 oldK1;
|
||||
SceUID modId;
|
||||
s32 intrState;
|
||||
SceModule *pMod;
|
||||
void *callerAddr;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
callerAddr = (void *)pspGetRa();
|
||||
|
||||
if (sceKernelIsIntrContext()) { //0x0000450C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (pspK1IsUserMode()) //0x00004520
|
||||
callerAddr = (void *)sceKernelGetSyscallRA();
|
||||
|
||||
if (!pspK1PtrOk(callerAddr)) { //0x0000452C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
intrState = sceKernelLoadCoreLock();
|
||||
|
||||
pMod = sceKernelFindModuleByAddress((u32)callerAddr); //0x00004544
|
||||
if (pMod == NULL)
|
||||
modId = SCE_ERROR_KERNEL_ERROR;
|
||||
else
|
||||
modId = pMod->modId;
|
||||
|
||||
sceKernelLoadCoreUnlock(intrState); //0x0000455C
|
||||
pspSetK1(oldK1);
|
||||
return modId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the id of the module whose codeAddr belongs to
|
||||
*
|
||||
* @param addr An address inside the module
|
||||
*
|
||||
* @return The module id on success, < 0 on error.
|
||||
* @return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT if function was called in an interruption.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_ADDR if the provided pointer can't be accessed from the current context.
|
||||
* @return SCE_ERROR_KERNEL_UNKNOWN_MODULE if module couldn't be found.
|
||||
*/
|
||||
// Subroutine ModuleMgrForUser_D8B73127 - Address 0x00004598 - Aliases: ModuleMgrForKernel_433D5287
|
||||
SceUID sceKernelGetModuleIdByAddress(const void *addr)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 intrState;
|
||||
SceUID modId;
|
||||
SceModule *pMod;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
if (sceKernelIsIntrContext()) { // 0x000045B4
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (!pspK1PtrOk(addr)) { // 0x000045D0
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
intrState = sceKernelLoadCoreLock(); // 0x000045D8
|
||||
|
||||
pMod = sceKernelFindModuleByAddress((u32)addr); // 0x000045E4
|
||||
if (pMod == NULL)
|
||||
modId = SCE_ERROR_KERNEL_UNKNOWN_MODULE;
|
||||
else
|
||||
modId = pMod->modId;
|
||||
|
||||
sceKernelLoadCoreUnlock(intrState); // 0x00004600
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return modId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the offset from the start of the TEXT segment of the module whose codeAddr belongs to
|
||||
*
|
||||
* @param addr An address inside the module
|
||||
* @param pGP A pointer to a location where the GP offset will be stored
|
||||
*
|
||||
* @return SCE_ERROR_OK and sets pGP on success, < 0 on error.
|
||||
* @return SCE_ERROR_KERNEL_ILLEGAL_ADDR if the provided pointer can't be accessed from the current context.
|
||||
* @return SCE_ERROR_KERNEL_UNKNOWN_MODULE if module couldn't be found.
|
||||
*/
|
||||
// Subroutine ModuleMgrForUser_D2FBC957 - Address 0x00004628
|
||||
s32 sceKernelGetModuleGPByAddress(const void *addr, u32 *pGP)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 intrState;
|
||||
s32 status;
|
||||
SceModule *pMod;
|
||||
|
||||
oldK1 = pspShiftK1(); // 0x0000463C
|
||||
|
||||
if (!pspK1PtrOk(addr) || pGP == NULL || !pspK1PtrOk(pGP)) { // 0x00004660, 0x00004670, 0x0000467C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
intrState = sceKernelLoadCoreLock(); // 0x00004684
|
||||
|
||||
pMod = sceKernelFindModuleByAddress((u32)addr); // 0x00004698
|
||||
if (pMod == NULL) // 0x000046A0
|
||||
status = SCE_ERROR_KERNEL_UNKNOWN_MODULE; // 0x0000469C
|
||||
else {
|
||||
status = SCE_ERROR_OK; // 0x000046AC
|
||||
*pGP = pMod->gpValue; // 0x000046B0
|
||||
}
|
||||
|
||||
sceKernelLoadCoreUnlock(intrState); // 0x000046B4
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForKernel_D86DD11B - Address 0x00005A80
|
||||
SceUID sceKernelSearchModuleByName(const char *name)
|
||||
{
|
||||
s32 oldK1;
|
||||
SceModule *pMod;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
if (!pspK1PtrOk(name)) {
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
pMod = sceKernelFindModuleByName(name); // 0x00005AA8
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return (pMod != NULL) ? pMod->modId : (SceUID)SCE_ERROR_KERNEL_UNKNOWN_MODULE;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForKernel_12F99392 - Address 0x00005AE0
|
||||
SceUID sceKernelSearchModuleByAddress(const void *addr)
|
||||
{
|
||||
SceModule *pMod;
|
||||
|
||||
pMod = sceKernelFindModuleByAddress((u32)addr); // 0x00005AE8
|
||||
|
||||
return (pMod != NULL) ? pMod->modId : (SceUID)SCE_ERROR_KERNEL_UNKNOWN_MODULE;
|
||||
}
|
203
src/modulemgr/rebootModule.c
Normal file
203
src/modulemgr/rebootModule.c
Normal file
@ -0,0 +1,203 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
#include <loadcore.h>
|
||||
#include <modulemgr_kernel.h>
|
||||
#include <modulemgr_options.h>
|
||||
#include <sysmem_kdebug.h>
|
||||
#include <threadman_kernel.h>
|
||||
|
||||
#include "loadModuleChecks_inline.h"
|
||||
#include "modulemgr_int.h"
|
||||
|
||||
// Subroutine ModuleMgrForKernel_CC873DFA - Address 0x000046E4
|
||||
s32 sceKernelRebootBeforeForUser(void *arg)
|
||||
{
|
||||
s32 oldGp;
|
||||
u32 modCount;
|
||||
s32 status;
|
||||
SceUID uidBlkId;
|
||||
SceUID *pUidList;
|
||||
char threadArgs[16];
|
||||
|
||||
oldGp = pspGetGp();
|
||||
sceKernelLockMutex(g_ModuleManager.mutexId, 1, NULL); //0x00004724
|
||||
|
||||
memcpy(threadArgs, arg, sizeof threadArgs); //0x00004734
|
||||
((u32 *)threadArgs)[0] = sizeof threadArgs;
|
||||
|
||||
uidBlkId = sceKernelGetModuleListWithAlloc(&modCount); //0x00004744
|
||||
if (uidBlkId < SCE_ERROR_OK)
|
||||
return uidBlkId;
|
||||
|
||||
pUidList = sceKernelGetBlockHeadAddr(uidBlkId); //0x00004754
|
||||
|
||||
s32 i;
|
||||
SceModule *pMod;
|
||||
s32 threadMode;
|
||||
for (i = modCount - 1; i >= 0; i--) { //0x00004760
|
||||
pMod = sceKernelFindModuleByUID(pUidList[i]); //0x00004774
|
||||
if (pMod == NULL || pMod->moduleRebootBefore == SCE_KERNEL_PTR_UNITIALIZED) //0x0000477C
|
||||
continue;
|
||||
|
||||
if (GET_MCB_STATUS(pMod->status) != MCB_STATUS_STARTED || !(pMod->status & SCE_MODULE_USER_MODULE)) //0x0000479C - 0x00004830
|
||||
continue;
|
||||
|
||||
s32 priority = pMod->moduleRebootBeforeThreadPriority;
|
||||
if (priority == SCE_KERNEL_VALUE_UNITIALIZED)
|
||||
priority = SCE_KERNEL_MODULE_INIT_PRIORITY; //0x00004864
|
||||
|
||||
s32 stackSize = pMod->moduleRebootBeforeThreadStacksize;
|
||||
if (stackSize == SCE_KERNEL_VALUE_UNITIALIZED) //0x00004870
|
||||
stackSize = SCE_KERNEL_TH_KERNEL_DEFAULT_STACKSIZE;
|
||||
|
||||
s32 attr = pMod->moduleRebootBeforeThreadAttr;
|
||||
if (attr == SCE_KERNEL_VALUE_UNITIALIZED) //0x00004874
|
||||
attr = SCE_KERNEL_TH_DEFAULT_ATTR;
|
||||
|
||||
switch (pMod->attribute & SCE_MODULE_PRIVILEGE_LEVELS) {
|
||||
case SCE_MODULE_VSH:
|
||||
threadMode = SCE_KERNEL_TH_VSH_MODE;
|
||||
break;
|
||||
case SCE_MODULE_APP: //0x00004884
|
||||
threadMode = SCE_KERNEL_TH_APP_MODE;
|
||||
break;
|
||||
case SCE_MODULE_USB_WLAN: //0x00004890
|
||||
threadMode = SCE_KERNEL_TH_USB_WLAN_MODE;
|
||||
break;
|
||||
case SCE_MODULE_MS: //0x0000489C
|
||||
threadMode = SCE_KERNEL_TH_MS_MODE;
|
||||
break;
|
||||
default: //0x000048A4
|
||||
threadMode = SCE_KERNEL_TH_USER_MODE;
|
||||
break;
|
||||
}
|
||||
|
||||
SceKernelThreadOptParam threadParams;
|
||||
threadParams.size = sizeof threadParams; //0x000048AC
|
||||
threadParams.stackMpid = pMod->mpIdData; //0x000048CC
|
||||
|
||||
status = _CheckUserModulePartition(threadParams.stackMpid); // 0x000048BC - 0x000048E0
|
||||
if (status < SCE_ERROR_OK)
|
||||
threadParams.stackMpid = SCE_KERNEL_PRIMARY_USER_PARTITION;
|
||||
|
||||
pspSetGp(pMod->gpValue); //0x00004900
|
||||
|
||||
pMod->userModThid = sceKernelCreateThread("SceModmgrRebootBefore", (SceKernelThreadEntry)pMod->moduleRebootBefore, priority,
|
||||
stackSize, threadMode | attr, &threadParams); //0x0000491C
|
||||
|
||||
pspSetGp(oldGp);
|
||||
|
||||
// TODO: Add proper structure for threadArgs
|
||||
status = sceKernelStartThread(pMod->userModThid, sizeof threadArgs, threadArgs); //0x00004934
|
||||
if (status == SCE_ERROR_OK)
|
||||
sceKernelWaitThreadEnd(pMod->userModThid, NULL); //0x000049AC
|
||||
|
||||
sceKernelDeleteThread(pMod->userModThid); //0x00004944
|
||||
pMod->userModThid = SCE_KERNEL_VALUE_UNITIALIZED;
|
||||
|
||||
if (!sceKernelIsToolMode()) //0x00004954
|
||||
continue;
|
||||
|
||||
status = sceKernelDipsw(25); //0x0000495C
|
||||
if (status == 1) //0x00004968
|
||||
continue;
|
||||
|
||||
s32 sdkVersion = sceKernelGetCompiledSdkVersion(); //0x00004970
|
||||
if (sdkVersion < 0x03030000) //0x00004984
|
||||
continue;
|
||||
|
||||
s32 checkSum = sceKernelSegmentChecksum(pMod);
|
||||
if (checkSum == (s32)pMod->segmentChecksum)
|
||||
continue;
|
||||
|
||||
pspBreak(SCE_BREAKCODE_ZERO);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = ClearFreePartitionMemory(uidBlkId); // 0x000047BC - 0x000047F0
|
||||
// TODO: UOFW: Missing sceKernelUnlockMutex()?
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForKernel_9B7102E2 - Address 0x000049BC
|
||||
s32 sceKernelRebootPhaseForKernel(s32 arg1, void *argp, s32 arg3, s32 arg4)
|
||||
{
|
||||
SceUID uidBlkId;
|
||||
SceUID *pUidList;
|
||||
SceModule *pMod;
|
||||
u32 modCount;
|
||||
s32 status;
|
||||
|
||||
uidBlkId = sceKernelGetModuleListWithAlloc(&modCount); //0x000049F8
|
||||
if (uidBlkId < SCE_ERROR_OK)
|
||||
return uidBlkId;
|
||||
|
||||
pUidList = sceKernelGetBlockHeadAddr(uidBlkId); //0x00004A08
|
||||
|
||||
s32 i;
|
||||
for (i = modCount - 1; i >= 0; i--) { //0x00004A14 - 0x00004A64
|
||||
pMod = sceKernelFindModuleByUID(pUidList[i]); //0x00004A34
|
||||
if (pMod == NULL || pMod->moduleRebootPhase == SCE_KERNEL_PTR_UNITIALIZED) //0x00004A3C, 0x00004A48
|
||||
continue;
|
||||
|
||||
if (GET_MCB_STATUS(pMod->status) != MCB_STATUS_STARTED || (pMod->status & SCE_MODULE_USER_MODULE)) //0x00004A58 - 0x00004B04
|
||||
continue;
|
||||
|
||||
pMod->moduleRebootPhase(arg1, (u32)argp, arg3, arg4); //0x00004B0C
|
||||
|
||||
if (!sceKernelIsToolMode()) //0x00004B1C
|
||||
continue;
|
||||
|
||||
status = sceKernelDipsw(25); //0x00004B24
|
||||
if (status == 1) //0x00004B30
|
||||
continue;
|
||||
|
||||
s32 sdkVersion = sceKernelGetCompiledSdkVersion(); //0x00004B38
|
||||
if (sdkVersion < 0x03030000) //0x00004B44
|
||||
continue;
|
||||
|
||||
s32 checkSum = sceKernelSegmentChecksum(pMod); //0x00004B4C
|
||||
if (checkSum == (s32)pMod->segmentChecksum) //0x00004B58
|
||||
continue;
|
||||
|
||||
pspBreak(SCE_BREAKCODE_ZERO);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = ClearFreePartitionMemory(uidBlkId); // 0x00004A74 - 0x00004AB4
|
||||
return pspMin(status, SCE_ERROR_OK);
|
||||
}
|
||||
|
||||
// ModuleMgrForKernel_5FC3B3DA - Address 0x00004B6C
|
||||
s32 sceKernelRebootBeforeForKernel(void *argp, s32 arg2, s32 arg3, s32 arg4)
|
||||
{
|
||||
SceUID uidBlkId;
|
||||
SceUID *pUidList;
|
||||
SceModule *pMod;
|
||||
u32 modCount;
|
||||
s32 status;
|
||||
|
||||
uidBlkId = sceKernelGetModuleListWithAlloc(&modCount); //0x00004BA8
|
||||
if (uidBlkId < SCE_ERROR_OK)
|
||||
return uidBlkId;
|
||||
|
||||
pUidList = sceKernelGetBlockHeadAddr(uidBlkId); //0x00004BB8
|
||||
|
||||
s32 i;
|
||||
for (i = modCount - 1; i >= 0; i--) { //0x00004BC4 - 0x00004C10
|
||||
pMod = sceKernelFindModuleByUID(pUidList[i]); //0x00004BE4
|
||||
if (pMod == NULL || pMod->moduleRebootBefore == SCE_KERNEL_PTR_UNITIALIZED) //0x00004BEC, 0x00004BF8
|
||||
continue;
|
||||
|
||||
if (GET_MCB_STATUS(pMod->status) != MCB_STATUS_STARTED || (pMod->status & SCE_MODULE_USER_MODULE)) //0x00004C08, 0x00004CB0
|
||||
continue;
|
||||
|
||||
pMod->moduleRebootBefore((u32)argp, arg2, arg3, arg4); //0x00004CB8
|
||||
}
|
||||
|
||||
status = ClearFreePartitionMemory(uidBlkId); // 0x00004C24 - 0x00004C60
|
||||
return pspMin(status, SCE_ERROR_OK);
|
||||
}
|
320
src/modulemgr/start-stopModule.c
Normal file
320
src/modulemgr/start-stopModule.c
Normal file
@ -0,0 +1,320 @@
|
||||
/* Copyright (C) 2011 - 2015 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
#include <modulemgr_kernel.h>
|
||||
#include <modulemgr_options.h>
|
||||
|
||||
#include <iofilemgr_kernel.h>
|
||||
|
||||
#include "loadModuleChecks_inline.h"
|
||||
#include "modulemgr_int.h"
|
||||
|
||||
static s32 _SelfStopUnloadModule(s32 returnStatus, const void *codeAddr, SceSize args, void *argp, s32 *pStatus,
|
||||
const SceKernelSMOption *pOption);
|
||||
static s32 _StopUnloadSelfModuleWithStatus(s32 returnStatus, void *addr, SceSize args, void *argp, s32 *pStatus,
|
||||
const SceKernelSMOption *pOption);
|
||||
|
||||
// Subroutine ModuleMgrForUser_50F0C1EC - Address 0x00003D98 - Aliases: ModuleMgrForKernel_3FF74DF1
|
||||
s32 sceKernelStartModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 status;
|
||||
SceModuleMgrParam modParams;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
if (sceKernelIsIntrContext()) { //0x00003DA4
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (argp != NULL && !pspK1DynBufOk(argp, args)) { //0x00003DE4, 0x00003DFC
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
if (pModResult != NULL && !pspK1PtrOk(pModResult)) { //0x00003E18, 0x00003E10
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = _checkSMOptionConditions(pOption); //0x00003FB8 - 0x00003EAC
|
||||
if (status < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
pspClearMemory32(&modParams, sizeof modParams); //0x00003EBC
|
||||
|
||||
// 0x00003EC8
|
||||
modParams.modeFinish = CMD_START_MODULE;
|
||||
modParams.modeStart = CMD_START_MODULE;
|
||||
modParams.modId = modId; // 0x00003ECC
|
||||
modParams.argSize = args;
|
||||
modParams.argp = (void *)argp;
|
||||
modParams.pStatus = pModResult;
|
||||
|
||||
if (pOption != NULL) { //0x00003EDC
|
||||
modParams.threadMpIdStack = pOption->mpIdStack;
|
||||
modParams.stackSize = pOption->stackSize;
|
||||
modParams.threadPriority = pOption->priority;
|
||||
modParams.threadAttr = pOption->attribute;
|
||||
} else { //0x00003F14
|
||||
modParams.threadMpIdStack = SCE_KERNEL_UNKNOWN_PARTITION;
|
||||
modParams.stackSize = 0;
|
||||
modParams.threadPriority = SCE_KERNEL_INVALID_PRIORITY;
|
||||
modParams.threadAttr = SCE_KERNEL_TH_DEFAULT_ATTR;
|
||||
}
|
||||
|
||||
status = _start_exe_thread(&modParams); //0x00003F04
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForUser_D1FF982A - Address 0x00003F28 - Aliases: ModuleMgrForKernel_E5D6087B
|
||||
s32 sceKernelStopModule(SceUID modId, SceSize args, const void *argp, s32 *pModResult, const SceKernelSMOption *pOption)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 status;
|
||||
void *callerAddr;
|
||||
SceModule *pMod;
|
||||
SceModuleMgrParam modParams;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
callerAddr = (void *)pspGetRa();
|
||||
|
||||
if (sceKernelIsIntrContext()) { //0x00003F68
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (argp != NULL && !pspK1DynBufOk(argp, args)) { //0x00003F7C, 0x00003F94
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
if (pModResult != NULL && !pspK1StaBufOk(pModResult, sizeof *pModResult)) { //0x00003F9C, 0x00003FB0
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = _checkSMOptionConditions(pOption); //0x00003FB8 - 0x0000404C
|
||||
if (status < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// TODO: Why do we need to check if the module which calls this API is still loaded?
|
||||
pMod = sceKernelFindModuleByAddress((u32)callerAddr); //0x00004054
|
||||
if (pMod == NULL) {
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_MODULE_CANNOT_STOP;
|
||||
}
|
||||
|
||||
pspClearMemory32(&modParams, sizeof modParams); //0x00004078
|
||||
|
||||
modParams.pMod = sceKernelGetModuleFromUID(modId); //0x00004080
|
||||
if (modParams.pMod && modParams.pMod->attribute & SCE_MODULE_ATTR_CANT_STOP) {
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_MODULE_CANNOT_STOP;
|
||||
}
|
||||
|
||||
// 0x000040A4
|
||||
modParams.modeFinish = CMD_STOP_MODULE;
|
||||
modParams.modeStart = CMD_STOP_MODULE;
|
||||
modParams.modId = modId; // 0x000040AC
|
||||
modParams.callerModId = pMod->modId; // 0x000040BC
|
||||
modParams.argSize = args;
|
||||
modParams.argp = (void *)argp;
|
||||
modParams.pStatus = pModResult;
|
||||
|
||||
if (pOption != NULL) { //0x000040C4
|
||||
modParams.threadMpIdStack = pOption->mpIdStack;
|
||||
modParams.stackSize = pOption->stackSize;
|
||||
modParams.threadPriority = pOption->priority;
|
||||
modParams.threadAttr = pOption->attribute;
|
||||
} else { //0x000040FC
|
||||
modParams.threadMpIdStack = SCE_KERNEL_UNKNOWN_PARTITION;
|
||||
modParams.stackSize = 0;
|
||||
modParams.threadPriority = SCE_KERNEL_INVALID_PRIORITY;
|
||||
modParams.threadAttr = SCE_KERNEL_TH_DEFAULT_ATTR;
|
||||
}
|
||||
status = _start_exe_thread(&modParams); //0x000040EC
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForUser_D675EBB8 - Address 0x00004110 - Aliases: ModuleMgrForKernel_5805C1CA
|
||||
s32 sceKernelSelfStopUnloadModule(s32 exitStatus, SceSize args, void *argp)
|
||||
{
|
||||
s32 oldK1;
|
||||
void *callerAddr;
|
||||
s32 status;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
callerAddr = (void *)pspGetRa();
|
||||
|
||||
if (sceKernelIsIntrContext()) { //0x0000414C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (argp != NULL && !pspK1DynBufOk(argp, args)) { //0x00004158, 0x0000416C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
if (pspK1IsUserMode()) //0x00004174
|
||||
callerAddr = (void *)sceKernelGetSyscallRA();
|
||||
|
||||
if (!pspK1PtrOk(callerAddr)) { //0x0000419C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = _SelfStopUnloadModule(exitStatus, callerAddr, args, argp, NULL, NULL); //0x000041A4
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForUser_2E0911AA - Address 0x00005990 - Aliases: ModuleMgrForKernel_387E3CA9
|
||||
SceUID sceKernelUnloadModule(SceUID modId)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 status;
|
||||
SceModuleMgrParam modParams;
|
||||
|
||||
oldK1 = pspShiftK1(); // 0x0000599C
|
||||
|
||||
// Cannot be called in an interruption
|
||||
if (sceKernelIsIntrContext()) { // 0x000059A8
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
pspClearMemory32(&modParams, sizeof modParams); //0x000059C8
|
||||
|
||||
modParams.modeFinish = CMD_UNLOAD_MODULE; // 0x000059D8
|
||||
modParams.modeStart = CMD_UNLOAD_MODULE; // 0x000059DC
|
||||
modParams.modId = modId; // 0x000059E0
|
||||
modParams.argSize = 0; // 0x000059E4
|
||||
modParams.argp = NULL; // 0x000059E8
|
||||
modParams.pStatus = NULL; // 0x000059F0
|
||||
|
||||
status = _start_exe_thread(&modParams); // 0x000059EC
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForUser_8F2DF740 - Address 0x00005A14 - Aliases: ModuleMgrForKernel_EE6E8F49
|
||||
s32 sceKernelStopUnloadSelfModuleWithStatus(s32 exitStatus, SceSize args, void *argp, s32 *pModResult,
|
||||
const SceKernelSMOption *pOption)
|
||||
{
|
||||
return _StopUnloadSelfModuleWithStatus(exitStatus, (void *)pspGetRa(), args, argp, pModResult, pOption);
|
||||
}
|
||||
|
||||
// Subroutine ModuleMgrForUser_CC1D3699 - Address 0x00005A4C - Aliases: ModuleMgrForKernel_E97E0DB7
|
||||
s32 sceKernelStopUnloadSelfModule(SceSize args, void *argp, s32 *pModResult, const SceKernelSMOption *pOption)
|
||||
{
|
||||
return _StopUnloadSelfModuleWithStatus(SCE_ERROR_OK, (void *)pspGetRa(), args, argp, pModResult, pOption);
|
||||
}
|
||||
|
||||
// Subroutine sub_000076CC - Address 0x000076CC
|
||||
static s32 _SelfStopUnloadModule(s32 returnStatus, const void *codeAddr, SceSize args, void *argp, s32 *pStatus,
|
||||
const SceKernelSMOption *pOption)
|
||||
{
|
||||
SceModule *pMod;
|
||||
s32 status;
|
||||
SceModuleMgrParam modParams;
|
||||
s32 status2;
|
||||
|
||||
pMod = sceKernelFindModuleByAddress((u32)codeAddr); // 0x000076FC
|
||||
if (pMod == NULL || pMod->attribute & SCE_MODULE_ATTR_CANT_STOP) // 0x0000770C & 0x00007720
|
||||
return SCE_ERROR_KERNEL_MODULE_CANNOT_STOP;
|
||||
|
||||
pspClearMemory32(&modParams, sizeof modParams); // 0x00007734
|
||||
|
||||
modParams.modeStart = CMD_STOP_MODULE; // 0x00007744
|
||||
modParams.modeFinish = CMD_UNLOAD_MODULE; // 0x00007748
|
||||
modParams.argp = argp; // 0x00007750
|
||||
modParams.modId = pMod->modId; // 0x00007754
|
||||
modParams.argSize = args; // 0x0000775C
|
||||
modParams.callerModId = pMod->modId; // 0x00007764
|
||||
|
||||
if (pStatus == NULL) // 0x00007760
|
||||
modParams.pStatus = &status2; // 0x000077EC
|
||||
else
|
||||
modParams.pStatus = pStatus; // 0x00007768
|
||||
|
||||
if (pOption == NULL) { // 0x0000776C
|
||||
modParams.threadMpIdStack = SCE_KERNEL_UNKNOWN_PARTITION;
|
||||
modParams.stackSize = 0;
|
||||
modParams.threadPriority = SCE_KERNEL_INVALID_PRIORITY;
|
||||
modParams.threadAttr = SCE_KERNEL_TH_DEFAULT_ATTR;
|
||||
} else {
|
||||
modParams.threadMpIdStack = pOption->mpIdStack; // 0x00007784
|
||||
modParams.stackSize = pOption->stackSize; // 0x00007788
|
||||
modParams.threadPriority = pOption->priority; // 0x0000778C
|
||||
modParams.threadAttr = pOption->attribute; // 0x00007790
|
||||
}
|
||||
|
||||
status = _start_exe_thread(&modParams); // 0x00007794
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* Terminate and delete the calling thread (belonging to the stopped & unloaded module). */
|
||||
sceKernelExitDeleteThread(returnStatus); // 0x000077A4
|
||||
return status;
|
||||
}
|
||||
|
||||
// Subroutine sub_000077F0 - Address 0x000077F0
|
||||
static s32 _StopUnloadSelfModuleWithStatus(s32 returnStatus, void *addr, SceSize args, void *argp, s32 *pStatus,
|
||||
const SceKernelSMOption *pOption)
|
||||
{
|
||||
s32 oldK1;
|
||||
s32 status;
|
||||
|
||||
oldK1 = pspShiftK1();
|
||||
|
||||
// Cannot be called from interrupt
|
||||
if (sceKernelIsIntrContext()) { // 0x0000783C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
|
||||
}
|
||||
|
||||
if (argp != NULL && !pspK1DynBufOk(argp, args)) { // 0x0000785C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
if (pStatus != NULL && !pspK1StaBufOk(pStatus, sizeof *pStatus)) { // 0x00007878
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = _checkSMOptionConditions(pOption); // 0x000078E4 - 0x000078F8
|
||||
if (status < 0) {
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (pspK1IsUserMode()) // 0x0000791C
|
||||
addr = (void *)sceKernelGetSyscallRA(); // 0x00007958
|
||||
|
||||
if (!pspK1PtrOk(addr)) { // 0x0000792C
|
||||
pspSetK1(oldK1);
|
||||
return SCE_ERROR_KERNEL_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
status = _SelfStopUnloadModule(returnStatus, addr, args, argp, pStatus, pOption); // 0x00007948
|
||||
|
||||
pspSetK1(oldK1);
|
||||
return status;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
s32 (*gRebootFunc)(void *arg);
|
||||
|
||||
// 13FE8
|
||||
s32 (*gGetIdFunc)();
|
||||
s32(*gGetIdFunc)(const char *path, char *id);
|
||||
|
||||
// 13FEC
|
||||
SceKernelGameInfo SystemGameInfo;
|
||||
@ -657,12 +657,12 @@ s32 sceKernelRegisterGetIdFunc(void *func)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceKernelGetId()
|
||||
s32 sceKernelGetId(const char *path, char *id)
|
||||
{
|
||||
if (gGetIdFunc == NULL || gGetIdFunc == (void*)-1)
|
||||
return 0x80020001;
|
||||
// A164
|
||||
s32 ret = gGetIdFunc();
|
||||
s32 ret = gGetIdFunc(path, id);
|
||||
gGetIdFunc = (void*)-1;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user