loader: update for 11.0.0 (anti-dg + set program args abi)

This commit is contained in:
Michael Scire 2020-11-30 22:06:52 -08:00 committed by SciresM
parent 694e3b579e
commit 632c8984c8
8 changed files with 111 additions and 26 deletions

View File

@ -57,6 +57,8 @@ namespace ams::hos {
Version_10_0_3 = ::ams::TargetFirmware_10_0_3,
Version_10_0_4 = ::ams::TargetFirmware_10_0_4,
Version_10_1_0 = ::ams::TargetFirmware_10_1_0,
Version_10_2_0 = ::ams::TargetFirmware_10_2_0,
Version_11_0_0 = ::ams::TargetFirmware_11_0_0,
Version_Current = ::ams::TargetFirmware_Current,

View File

@ -22,7 +22,8 @@
namespace ams::ldr::impl {
#define AMS_LDR_I_DEBUG_MONITOR_INTERFACE_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size)) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArgumentsDeprecated, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size), hos::Version_Min, hos::Version_10_2_0) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args), hos::Version_11_0_0 ) \
AMS_SF_METHOD_INFO(C, H, 1, Result, FlushArguments, ()) \
AMS_SF_METHOD_INFO(C, H, 2, Result, GetProcessModuleInfo, (sf::Out<u32> count, const sf::OutPointerArray<ModuleInfo> &out, os::ProcessId process_id)) \
AMS_SF_METHOD_INFO(C, H, 65000, void, AtmosphereHasLaunchedProgram, (sf::Out<bool> out, ncm::ProgramId program_id))

View File

@ -22,7 +22,8 @@
namespace ams::ldr::impl {
#define AMS_LDR_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size)) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArgumentsDeprecated, (ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size), hos::Version_Min, hos::Version_10_2_0) \
AMS_SF_METHOD_INFO(C, H, 0, Result, SetProgramArguments, (ncm::ProgramId program_id, const sf::InPointerBuffer &args), hos::Version_11_0_0 ) \
AMS_SF_METHOD_INFO(C, H, 1, Result, FlushArguments, ()) \
AMS_SF_METHOD_INFO(C, H, 65000, Result, AtmosphereRegisterExternalCode, (sf::OutMoveHandle out, ncm::ProgramId program_id)) \
AMS_SF_METHOD_INFO(C, H, 65001, void, AtmosphereUnregisterExternalCode, (ncm::ProgramId program_id))

View File

@ -36,7 +36,7 @@ namespace ams::pgl::sf {
AMS_SF_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled)) \
AMS_SF_METHOD_INFO(C, H, 12, Result, TriggerApplicationSnapShotDumper, (SnapShotDumpType dump_type, const ams::sf::InBuffer &arg)) \
AMS_SF_METHOD_INFO(C, H, 20, Result, GetShellEventObserver, (ams::sf::Out<std::shared_ptr<pgl::sf::IEventObserver>> out)) \
AMS_SF_METHOD_INFO(C, H, 21, Result, Command21NotImplemented, (ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2))
AMS_SF_METHOD_INFO(C, H, 21, Result, Command21NotImplemented, (ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2), hos::Version_11_0_0)
AMS_SF_DEFINE_INTERFACE(IShellInterface, AMS_PGL_I_SHELL_INTERFACE_INTERFACE_INFO);

View File

@ -324,3 +324,76 @@ constexpr MinimumProgramVersion g_MinimumProgramVersions1010[] = {
{ncm::WebAppletId::WifiWebAuth, MakeSystemVersion(10, 0, 0)},
};
constexpr size_t g_MinimumProgramVersionsCount1010 = util::size(g_MinimumProgramVersions1010);
constexpr MinimumProgramVersion g_MinimumProgramVersions1100[] = {
/* All non-Development System Modules. */
{ncm::SystemProgramId::Usb, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Tma, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Boot2, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Settings, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Bus, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Bluetooth, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Bcat, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Dmnt, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Friends, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Nifm, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Ptm, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Shell, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::BsdSockets, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Hid, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Audio, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::LogManager, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Wlan, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Cs, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Ldn, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::NvServices, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Pcv, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Ppc, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::NvnFlinger, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Pcie, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Account, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Ns, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Nfc, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Psc, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::CapSrv, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Am, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Ssl, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Nim, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Cec, MakeSystemVersion(11, 0, 0)}, */
/* {ncm::SystemProgramId::Tspm, MakeSystemVersion(11, 0, 0)}, */
/* {ncm::SystemProgramId::Spl, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Lbl, MakeSystemVersion(10, 0, 0)},
{ncm::SystemProgramId::Btm, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Erpt, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Time, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Vi, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Pctl, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Npns, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Eupld, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Glue, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Eclct, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Es, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Fatal, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Grc, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Creport, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Ro, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Profiler, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Sdb, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Migration, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Jit, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::JpegDec, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::SafeMode, MakeSystemVersion(11, 0, 0)},
{ncm::SystemProgramId::Olsc, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Dt, MakeSystemVersion(11, 0, 0)}, */
/* {ncm::SystemProgramId::Nd, MakeSystemVersion(11, 0, 0)}, */
{ncm::SystemProgramId::Ngct, MakeSystemVersion(11, 0, 0)},
/* {ncm::SystemProgramId::Pgl, MakeSystemVersion(11, 0, 0)}, */
/* All Web Applets. */
{ncm::WebAppletId::Web, MakeSystemVersion(11, 0, 0)},
{ncm::WebAppletId::Shop, MakeSystemVersion(11, 0, 0)},
{ncm::WebAppletId::OfflineWeb, MakeSystemVersion(11, 0, 0)},
{ncm::WebAppletId::LoginShare, MakeSystemVersion(11, 0, 0)},
{ncm::WebAppletId::WifiWebAuth, MakeSystemVersion(11, 0, 0)},
};
constexpr size_t g_MinimumProgramVersionsCount1100 = util::size(g_MinimumProgramVersions1100);

View File

@ -84,10 +84,14 @@ namespace ams::ldr {
return ldr::ro::UnpinProgram(id);
}
Result LoaderService::SetProgramArguments(ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size) {
Result LoaderService::SetProgramArgumentsDeprecated(ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size) {
return args::Set(program_id, args.GetPointer(), std::min(args.GetSize(), size_t(args_size)));
}
Result LoaderService::SetProgramArguments(ncm::ProgramId program_id, const sf::InPointerBuffer &args) {
return args::Set(program_id, args.GetPointer(), args.GetSize());
}
Result LoaderService::FlushArguments() {
return args::Flush();
}

View File

@ -25,7 +25,8 @@ namespace ams::ldr {
Result GetProgramInfo(sf::Out<ProgramInfo> out_program_info, const ncm::ProgramLocation &loc);
Result PinProgram(sf::Out<PinId> out_id, const ncm::ProgramLocation &loc);
Result UnpinProgram(PinId id);
Result SetProgramArguments(ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size);
Result SetProgramArgumentsDeprecated(ncm::ProgramId program_id, const sf::InPointerBuffer &args, u32 args_size);
Result SetProgramArguments(ncm::ProgramId program_id, const sf::InPointerBuffer &args);
Result FlushArguments();
Result GetProcessModuleInfo(sf::Out<u32> count, const sf::OutPointerArray<ModuleInfo> &out, os::ProcessId process_id);
Result SetEnabledProgramVerification(bool enabled);

View File

@ -96,7 +96,10 @@ namespace ams::ldr {
size_t num_entries = 0;
const auto hos_version = hos::GetVersion();
if (hos_version >= hos::Version_10_1_0) {
if (hos_version >= hos::Version_11_0_0) {
entries = g_MinimumProgramVersions1100;
num_entries = g_MinimumProgramVersionsCount1100;
} else if (hos_version >= hos::Version_10_1_0) {
entries = g_MinimumProgramVersions1010;
num_entries = g_MinimumProgramVersionsCount1010;
} else if (hos_version >= hos::Version_10_0_0) {