debugger: Find and build IOP module list

This commit is contained in:
Ziemas
2025-04-06 23:07:16 +02:00
committed by Ty
parent 44733d7655
commit 643c83c2a0
3 changed files with 47 additions and 13 deletions

View File

@@ -69,3 +69,29 @@ std::vector<std::unique_ptr<BiosThread>> getIOPThreads()
return threads;
}
std::vector<IopMod> getIOPModules()
{
u32 maddr = iopMemRead32(CurrentBiosInformation.iopModListAddr);
std::vector<IopMod> modlist;
while (maddr != 0)
{
IopMod mod;
mod.name = iopMemReadString(iopMemRead32(maddr + 4));
mod.version = iopMemRead16(maddr + 8);
mod.entry = iopMemRead32(maddr + 0x10);
mod.gp = iopMemRead32(maddr + 0x14);
mod.text_addr = iopMemRead32(maddr + 0x18);
mod.text_size = iopMemRead32(maddr + 0x1c);
mod.data_size = iopMemRead32(maddr + 0x20);
mod.bss_size = iopMemRead32(maddr + 0x24);
modlist.push_back(mod);
maddr = iopMemRead32(maddr);
}
return modlist;
}

View File

@@ -178,5 +178,18 @@ private:
IOPInternalThread data;
};
struct IopMod
{
std::string name;
u16 version;
u32 text_addr;
u32 entry;
u32 gp;
u32 text_size;
u32 data_size;
u32 bss_size;
};
std::vector<std::unique_ptr<BiosThread>> getIOPThreads();
std::vector<IopMod> getIOPModules();
std::vector<std::unique_ptr<BiosThread>> getEEThreads();

View File

@@ -1073,27 +1073,22 @@ namespace R3000A
u32 GetModList(u32 a0reg)
{
u32 lcptr = iopMemRead32(0x3f0);
u32 lcstring = irxFindLoadcore(lcptr);
u32 list = 0;
/* Loadcore puts a pointer to a static array at 0x3f0 */
u32 bootmodes_ptr = iopMemRead32(0x3f0);
/* Search for the main loadcore struct from there */
u32 lcstring = irxFindLoadcore(bootmodes_ptr);
u32 lc_struct = 0;
if (lcstring == 0)
{
list = lcptr - 0x20;
lc_struct = bootmodes_ptr - 0x20;
}
else
{
list = lcstring + 0x18;
lc_struct = lcstring + 0x18;
}
u32 mod = iopMemRead32(list);
while (mod != 0)
{
mod = iopMemRead32(mod);
}
return list;
return lc_struct + 0x10;
}
// Gets the thread list ptr from thbase