From d0170118826f99c409332d4cf47e64a5c003161f Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 25 Aug 2013 10:48:32 +0800 Subject: [PATCH] Add ThreadManForKernel and ModuleForKernel Sample log:https://gist.github.com/sum2012/3bb5deb1a806ef18f5f3 --- Core/HLE/HLETables.cpp | 2 ++ Core/HLE/sceKernel.cpp | 27 +++++++++++++++++++++++++-- Core/HLE/sceKernel.h | 1 + Core/HLE/sceKernelModule.cpp | 27 +++++++++++++++++++++++++++ Core/HLE/sceKernelModule.h | 1 + 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index 51c80b111..0c6c7ec65 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -256,12 +256,14 @@ static const int numModules = sizeof(moduleList)/sizeof(HLEModule); void RegisterAllModules() { Register_Kernel_Library(); Register_ThreadManForUser(); + Register_ThreadManForKernel(); Register_LoadExecForUser(); Register_UtilsForKernel(); Register_SysMemUserForUser(); Register_InterruptManager(); Register_IoFileMgrForUser(); Register_ModuleMgrForUser(); + Register_ModuleMgrForKernel(); Register_StdioForUser(); Register_sceHprm(); diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 3cb9784c3..962d0da20 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -636,6 +636,18 @@ int sceKernelReferGlobalProfiler(u32 statusPtr) { return 0; } +int ThreadManForKernel_446d8de6(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr) +{ + WARN_LOG(HLE,"Not support this patcher"); + return sceKernelCreateThread(threadName, entry, prio, stacksize, attr, optionAddr); +} + +int ThreadManForKernel_f475845d(SceUID threadToStartID, int argSize, u32 argBlockPtr) +{ + WARN_LOG(HLE,"Not support this patcher"); + return sceKernelStartThread(threadToStartID,argSize,argBlockPtr); +} + const HLEFunction ThreadManForUser[] = { {0x55C20A00,&WrapI_CUUU, "sceKernelCreateEventFlag"}, @@ -820,6 +832,13 @@ const HLEFunction ThreadManForUser[] = // {0x6E9EA350, _sceKernelReturnFromCallback,"_sceKernelReturnFromCallback"}, }; +const HLEFunction ThreadManForKernel[] = +{ + {0xceadeb47, 0, "ThreadManForKernel_ceadeb47"}, + {0x446d8de6, WrapI_CUUIUU, "ThreadManForKernel_446d8de6"},//Not sure right + {0xf475845d, &WrapI_IIU, "ThreadManForKernel_f475845d"},//Not sure right +}; + void Register_ThreadManForUser() { RegisterModule("ThreadManForUser", ARRAY_SIZE(ThreadManForUser), ThreadManForUser); @@ -841,8 +860,6 @@ void Register_LoadExecForUser() RegisterModule("LoadExecForUser", ARRAY_SIZE(LoadExecForUser), LoadExecForUser); } - - const HLEFunction ExceptionManagerForKernel[] = { {0x3FB264FC, 0, "sceKernelRegisterExceptionHandler"}, @@ -888,3 +905,9 @@ void Register_UtilsForKernel() { RegisterModule("UtilsForKernel", ARRAY_SIZE(UtilsForKernel), UtilsForKernel); } + +void Register_ThreadManForKernel() +{ + RegisterModule("ThreadManForKernel", ARRAY_SIZE(ThreadManForKernel), ThreadManForKernel); + +} \ No newline at end of file diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index d47b71d6d..fe8f3dbe3 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -557,5 +557,6 @@ extern KernelStats kernelStats; extern u32 registeredExitCbId; void Register_ThreadManForUser(); +void Register_ThreadManForKernel(); void Register_LoadExecForUser(); void Register_UtilsForKernel(); diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 985565b15..3bea2c32e 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1496,6 +1496,18 @@ u32 sceKernelQueryModuleInfo(u32 uid, u32 infoAddr) return 0; } +u32 ModuleMgrForKernel_977de386(const char *name, u32 flags, u32 optionAddr) +{ + WARN_LOG(HLE,"Not support this patcher"); + return sceKernelLoadModule(name, flags, optionAddr); +} + +void ModuleMgrForKernel_50f0c1ec(u32 moduleId, u32 argsize, u32 argAddr, u32 returnValueAddr, u32 optionAddr) +{ + WARN_LOG(HLE,"Not support this patcher"); + sceKernelStartModule(moduleId, argsize, argAddr, returnValueAddr, optionAddr); +} + const HLEFunction ModuleMgrForUser[] = { {0x977DE386,&WrapU_CUU,"sceKernelLoadModule"}, @@ -1519,7 +1531,22 @@ const HLEFunction ModuleMgrForUser[] = }; +const HLEFunction ModuleMgrForKernel[] = +{ + {0x50f0c1ec,&WrapV_UUUUU, "ModuleMgrForKernel_50f0c1ec"},//Not sure right + {0x977de386, &WrapU_CUU, "ModuleMgrForKernel_977de386"},//Not sure right + {0xa1a78c58, 0, "ModuleMgrForKernel_a1a78c58"}, +}; + + + void Register_ModuleMgrForUser() { RegisterModule("ModuleMgrForUser", ARRAY_SIZE(ModuleMgrForUser), ModuleMgrForUser); } + +void Register_ModuleMgrForKernel() +{ + RegisterModule("ModuleMgrForKernel", ARRAY_SIZE(ModuleMgrForKernel), ModuleMgrForKernel); + +}; \ No newline at end of file diff --git a/Core/HLE/sceKernelModule.h b/Core/HLE/sceKernelModule.h index f6288fb27..caa74f841 100644 --- a/Core/HLE/sceKernelModule.h +++ b/Core/HLE/sceKernelModule.h @@ -29,3 +29,4 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str void __KernelReturnFromModuleFunc(); void Register_ModuleMgrForUser(); +void Register_ModuleMgrForKernel(); \ No newline at end of file