boot2: update for 10.0.0

This commit is contained in:
Michael Scire 2020-04-14 03:30:03 -07:00
parent 353e27b9e2
commit 8547802904

View file

@ -39,6 +39,7 @@ namespace ams::boot2 {
ncm::SystemProgramId::NvServices, /* nvservices */
ncm::SystemProgramId::NvnFlinger, /* nvnflinger */
ncm::SystemProgramId::Vi, /* vi */
ncm::SystemProgramId::Pgl, /* pgl */
ncm::SystemProgramId::Ns, /* ns */
ncm::SystemProgramId::LogManager, /* lm */
ncm::SystemProgramId::Ppc, /* ppc */
@ -84,6 +85,7 @@ namespace ams::boot2 {
ncm::SystemProgramId::NvServices, /* nvservices */
ncm::SystemProgramId::NvnFlinger, /* nvnflinger */
ncm::SystemProgramId::Vi, /* vi */
ncm::SystemProgramId::Pgl, /* pgl */
ncm::SystemProgramId::Ns, /* ns */
ncm::SystemProgramId::LogManager, /* lm */
ncm::SystemProgramId::Ppc, /* ppc */
@ -133,19 +135,29 @@ namespace ams::boot2 {
return c == '\r' || c == '\n';
}
inline bool IsAllowedLaunchProgram(const ncm::ProgramLocation &loc) {
if (loc.program_id == ncm::SystemProgramId::Pgl) {
return hos::GetVersion() >= hos::Version_10_0_0;
}
return true;
}
void LaunchProgram(os::ProcessId *out_process_id, const ncm::ProgramLocation &loc, u32 launch_flags) {
os::ProcessId process_id = os::InvalidProcessId;
/* Launch, lightly validate result. */
{
const auto launch_result = pm::shell::LaunchProgram(&process_id, loc, launch_flags);
AMS_ABORT_UNLESS(!(svc::ResultOutOfResource::Includes(launch_result)));
AMS_ABORT_UNLESS(!(svc::ResultOutOfMemory::Includes(launch_result)));
AMS_ABORT_UNLESS(!(svc::ResultLimitReached::Includes(launch_result)));
}
/* Only launch the process if we're allowed to. */
if (IsAllowedLaunchProgram(loc)) {
/* Launch, lightly validate result. */
{
const auto launch_result = pm::shell::LaunchProgram(&process_id, loc, launch_flags);
AMS_ABORT_UNLESS(!(svc::ResultOutOfResource::Includes(launch_result)));
AMS_ABORT_UNLESS(!(svc::ResultOutOfMemory::Includes(launch_result)));
AMS_ABORT_UNLESS(!(svc::ResultLimitReached::Includes(launch_result)));
}
if (out_process_id) {
*out_process_id = process_id;
if (out_process_id) {
*out_process_id = process_id;
}
}
}