mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-20 01:45:07 -04:00
kern: support 2-pool layout on 2.x-4.x instead of modern 4-pool layout
This commit is contained in:
parent
ce95af89ef
commit
e8ffbe630f
7 changed files with 204 additions and 92 deletions
|
@ -168,6 +168,17 @@ namespace ams::pm::resource {
|
|||
}
|
||||
}
|
||||
|
||||
bool IsKTraceEnabled() {
|
||||
if (!svc::IsKernelMesosphere()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u64 value = 0;
|
||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(value), svc::InfoType_MesosphereMeta, INVALID_HANDLE, svc::MesosphereMetaInfo_IsKTraceEnabled));
|
||||
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Resource API. */
|
||||
|
@ -265,6 +276,14 @@ namespace ams::pm::resource {
|
|||
g_memory_resource_limits[i][ResourceLimitGroup_System] += extra_memory_size;
|
||||
g_memory_resource_limits[i][src_group] -= extra_memory_size;
|
||||
}
|
||||
|
||||
/* If KTrace is enabled, account for that by subtracting the memory from the applet pool. */
|
||||
if (IsKTraceEnabled()) {
|
||||
constexpr size_t KTraceBufferSize = 16_MB;
|
||||
for (size_t i = 0; i < spl::MemoryArrangement_Count; i++) {
|
||||
g_memory_resource_limits[i][ResourceLimitGroup_Applet] -= KTraceBufferSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Actually set resource limits. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue