1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

kern: allow ktrace map capability when ktrace is disabled

This commit is contained in:
Michael Scire 2023-12-27 23:17:52 -07:00
parent 1fa41c3e2a
commit 3217df147e
2 changed files with 6 additions and 9 deletions

View file

@ -184,6 +184,11 @@ namespace ams::kern {
case RegionType::NoMapping: case RegionType::NoMapping:
break; break;
case RegionType::KernelTraceBuffer: case RegionType::KernelTraceBuffer:
/* NOTE: This does not match official, but is used to make pre-processing hbl capabilities in userland unnecessary. */
/* If ktrace isn't enabled, allow ktrace to succeed without mapping anything. */
if constexpr (!ams::kern::IsKTraceEnabled) {
break;
}
case RegionType::OnMemoryBootImage: case RegionType::OnMemoryBootImage:
case RegionType::DTB: case RegionType::DTB:
R_TRY(f(MemoryRegions[static_cast<u32>(type)], perm)); R_TRY(f(MemoryRegions[static_cast<u32>(type)], perm));

View file

@ -418,15 +418,7 @@ namespace ams::ldr {
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
const auto cap = kac[i]; const auto cap = kac[i];
switch (GetCapabilityId(cap)) { switch (GetCapabilityId(cap)) {
case CapabilityId::MapRegion: /* NOTE: Currently, there is no pre-processing necessary. */
{
/* 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()) {
kac[i] = EmptyCapability;
}
}
break;
default: default:
break; break;
} }