Core/Boot: Pass around System.

This commit is contained in:
Admiral H. Curtiss
2023-03-08 02:50:29 +01:00
parent 912cd456fb
commit 7044cff011
10 changed files with 43 additions and 40 deletions

View File

@ -403,7 +403,7 @@ static std::vector<u8> ReadBootContent(FSDevice* fs, const std::string& path, si
// This corresponds to syscall 0x41, which loads a binary from the NAND and bootstraps the PPC.
// Unlike 0x42, IOS will set up some constants in memory before booting the PPC.
bool Kernel::BootstrapPPC(const std::string& boot_content_path)
bool Kernel::BootstrapPPC(Core::System& system, const std::string& boot_content_path)
{
// Seeking and processing overhead is ignored as most time is spent reading from the NAND.
u64 ticks = 0;
@ -422,12 +422,11 @@ bool Kernel::BootstrapPPC(const std::string& boot_content_path)
if (dol.IsAncast())
INFO_LOG_FMT(IOS, "BootstrapPPC: Loading ancast image");
if (!dol.LoadIntoMemory())
if (!dol.LoadIntoMemory(system))
return false;
INFO_LOG_FMT(IOS, "BootstrapPPC: {}", boot_content_path);
Core::System::GetInstance().GetCoreTiming().ScheduleEvent(ticks, s_event_finish_ppc_bootstrap,
dol.IsAncast());
system.GetCoreTiming().ScheduleEvent(ticks, s_event_finish_ppc_bootstrap, dol.IsAncast());
return true;
}
@ -478,7 +477,8 @@ static constexpr SystemTimers::TimeBaseTick GetIOSBootTicks(u32 version)
// Passing a boot content path is optional because we do not require IOSes
// to be installed at the moment. If one is passed, the boot binary must exist
// on the NAND, or the call will fail like on a Wii.
bool Kernel::BootIOS(const u64 ios_title_id, HangPPC hang_ppc, const std::string& boot_content_path)
bool Kernel::BootIOS(Core::System& system, const u64 ios_title_id, HangPPC hang_ppc,
const std::string& boot_content_path)
{
// IOS suspends regular PPC<->ARM IPC before loading a new IOS.
// IPC is not resumed if the boot fails for any reason.
@ -494,7 +494,7 @@ bool Kernel::BootIOS(const u64 ios_title_id, HangPPC hang_ppc, const std::string
return false;
ElfReader elf{binary.GetElf()};
if (!elf.LoadIntoMemory(true))
if (!elf.LoadIntoMemory(system, true))
return false;
}
@ -503,8 +503,8 @@ bool Kernel::BootIOS(const u64 ios_title_id, HangPPC hang_ppc, const std::string
if (Core::IsRunningAndStarted())
{
Core::System::GetInstance().GetCoreTiming().ScheduleEvent(
GetIOSBootTicks(GetVersion()), s_event_finish_ios_boot, ios_title_id);
system.GetCoreTiming().ScheduleEvent(GetIOSBootTicks(GetVersion()), s_event_finish_ios_boot,
ios_title_id);
}
else
{