1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-17 17:36:44 +00:00

loader: correct GetCapabilityId allowal

This commit is contained in:
Michael Scire 2020-12-17 04:10:25 -08:00
parent f7e83a72a9
commit b8471bcd4e
2 changed files with 8 additions and 5 deletions

View file

@ -507,6 +507,11 @@
return R_SUCCEEDED(::ams::svc::GetInfo(std::addressof(dummy), ::ams::svc::InfoType_MesosphereMeta, ::ams::svc::InvalidHandle, ::ams::svc::MesosphereMetaInfo_KernelVersion));
}
ALWAYS_INLINE bool IsKTraceEnabled() {
uint64_t value = 0;
return R_SUCCEEDED(::ams::svc::GetInfo(std::addressof(value), ::ams::svc::InfoType_MesosphereMeta, ::ams::svc::InvalidHandle, ::ams::svc::MesosphereMetaInfo_IsKTraceEnabled)) && value != 0;
}
}
#endif

View file

@ -419,11 +419,9 @@ namespace ams::ldr::caps {
switch (GetCapabilityId(cur_cap)) {
case CapabilityId::MapRegion:
{
/* MapRegion was added in 8.0.0+. */
/* To prevent kernel error, we should reject the descriptor on lower firmwares. */
/* NOTE: We also allow it on any firmware under mesosphere, as an extension. */
const bool is_allowed = (hos::GetVersion() >= hos::Version_8_0_0 || svc::IsKernelMesosphere());
if (!is_allowed) {
/* MapRegion was added in 8.0.0+, and is only allowed under kernels which have the relevant mappings. */
/* However, we allow it under all firmwares on mesosphere, to facilitate KTrace usage by hbl. */
if (!svc::IsKTraceEnabled()) {
caps[i] = EmptyCapability;
}
}