mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
loader: correct GetCapabilityId allowal
This commit is contained in:
parent
f7e83a72a9
commit
b8471bcd4e
2 changed files with 8 additions and 5 deletions
|
@ -507,6 +507,11 @@
|
||||||
return R_SUCCEEDED(::ams::svc::GetInfo(std::addressof(dummy), ::ams::svc::InfoType_MesosphereMeta, ::ams::svc::InvalidHandle, ::ams::svc::MesosphereMetaInfo_KernelVersion));
|
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
|
#endif
|
|
@ -419,11 +419,9 @@ namespace ams::ldr::caps {
|
||||||
switch (GetCapabilityId(cur_cap)) {
|
switch (GetCapabilityId(cur_cap)) {
|
||||||
case CapabilityId::MapRegion:
|
case CapabilityId::MapRegion:
|
||||||
{
|
{
|
||||||
/* MapRegion was added in 8.0.0+. */
|
/* MapRegion was added in 8.0.0+, and is only allowed under kernels which have the relevant mappings. */
|
||||||
/* To prevent kernel error, we should reject the descriptor on lower firmwares. */
|
/* However, we allow it under all firmwares on mesosphere, to facilitate KTrace usage by hbl. */
|
||||||
/* NOTE: We also allow it on any firmware under mesosphere, as an extension. */
|
if (!svc::IsKTraceEnabled()) {
|
||||||
const bool is_allowed = (hos::GetVersion() >= hos::Version_8_0_0 || svc::IsKernelMesosphere());
|
|
||||||
if (!is_allowed) {
|
|
||||||
caps[i] = EmptyCapability;
|
caps[i] = EmptyCapability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue