diff --git a/core/runtime/runtimeExport.h b/core/runtime/runtimeExport.h index d423d03..925b8e9 100644 --- a/core/runtime/runtimeExport.h +++ b/core/runtime/runtimeExport.h @@ -21,8 +21,8 @@ struct alignas(32) EntryParams { }; struct ModulInfo { - uint64_t address; - uint64_t size; + uint64_t seg0Addr; + uint64_t seg0Size; uint64_t procParamAddr; }; diff --git a/core/runtime/runtimeLinker.cpp b/core/runtime/runtimeLinker.cpp index f0850b2..49ed6a8 100644 --- a/core/runtime/runtimeLinker.cpp +++ b/core/runtime/runtimeLinker.cpp @@ -302,7 +302,7 @@ class RuntimeLinker: public IRuntimeLinker { ModulInfo mainModuleInfo() const final { auto prog = accessMainProg(); - return {prog->baseVaddr, prog->baseSize, prog->procParamVaddr}; + return {prog->moduleInfoEx.segments[0].address, prog->moduleInfoEx.segments[0].size, prog->procParamVaddr}; } SceKernelModuleInfoEx const* getModuleInfoEx(uint64_t vaddr) const final { diff --git a/modules/libkernel/entry.cpp b/modules/libkernel/entry.cpp index a6bebad..c28bba0 100644 --- a/modules/libkernel/entry.cpp +++ b/modules/libkernel/entry.cpp @@ -100,10 +100,17 @@ EXPORT SYSV_ABI void* _sceModuleParam() { return reinterpret_cast(procParamVaddr); } -EXPORT SYSV_ABI int sceKernelInternalMemoryGetModuleSegmentInfo(ModulInfo* info) { +struct ModuleSegmentInfo { + uint64_t addr; + uint64_t size; +}; + +EXPORT SYSV_ABI int sceKernelInternalMemoryGetModuleSegmentInfo(ModuleSegmentInfo* info) { if (info == nullptr) return getErr(ErrCode::_EFAULT); - *info = accessRuntimeLinker().mainModuleInfo(); + auto mainInfo = accessRuntimeLinker().mainModuleInfo(); + info->addr = mainInfo.seg0Addr; + info->size = mainInfo.seg0Size; return Ok; }