runtime| fix modulinfo

This commit is contained in:
SysRay 2024-05-23 12:44:39 +02:00
parent f5ad20ae72
commit dd2d60d2be
3 changed files with 12 additions and 5 deletions

View File

@ -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;
};

View File

@ -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 {

View File

@ -100,10 +100,17 @@ EXPORT SYSV_ABI void* _sceModuleParam() {
return reinterpret_cast<void*>(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;
}