mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 12:53:03 +00:00
kernel/process: Report total physical memory used to svcGetInfo
Reports the (mostly) correct size through svcGetInfo now for queries to total used physical memory. This still doesn't correctly handle memory allocated via svcMapPhysicalMemory, however, we don't currently handle that case anyways.
This commit is contained in:
parent
2289e895aa
commit
3a846aa80f
|
@ -76,6 +76,10 @@ SharedPtr<ResourceLimit> Process::GetResourceLimit() const {
|
||||||
return resource_limit;
|
return resource_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 Process::GetTotalPhysicalMemoryUsed() const {
|
||||||
|
return vm_manager.GetCurrentHeapSize() + main_thread_stack_size + code_memory_size;
|
||||||
|
}
|
||||||
|
|
||||||
ResultCode Process::ClearSignalState() {
|
ResultCode Process::ClearSignalState() {
|
||||||
if (status == ProcessStatus::Exited) {
|
if (status == ProcessStatus::Exited) {
|
||||||
LOG_ERROR(Kernel, "called on a terminated process instance.");
|
LOG_ERROR(Kernel, "called on a terminated process instance.");
|
||||||
|
|
|
@ -186,6 +186,9 @@ public:
|
||||||
return random_entropy.at(index);
|
return random_entropy.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Retrieves the total physical memory used by this process in bytes.
|
||||||
|
u64 GetTotalPhysicalMemoryUsed() const;
|
||||||
|
|
||||||
/// Clears the signaled state of the process if and only if it's signaled.
|
/// Clears the signaled state of the process if and only if it's signaled.
|
||||||
///
|
///
|
||||||
/// @pre The process must not be already terminated. If this is called on a
|
/// @pre The process must not be already terminated. If this is called on a
|
||||||
|
|
|
@ -709,7 +709,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
|
||||||
HeapRegionBaseAddr = 4,
|
HeapRegionBaseAddr = 4,
|
||||||
HeapRegionSize = 5,
|
HeapRegionSize = 5,
|
||||||
TotalMemoryUsage = 6,
|
TotalMemoryUsage = 6,
|
||||||
TotalHeapUsage = 7,
|
TotalPhysicalMemoryUsed = 7,
|
||||||
IsCurrentProcessBeingDebugged = 8,
|
IsCurrentProcessBeingDebugged = 8,
|
||||||
RegisterResourceLimit = 9,
|
RegisterResourceLimit = 9,
|
||||||
IdleTickCount = 10,
|
IdleTickCount = 10,
|
||||||
|
@ -745,7 +745,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
|
||||||
case GetInfoType::NewMapRegionBaseAddr:
|
case GetInfoType::NewMapRegionBaseAddr:
|
||||||
case GetInfoType::NewMapRegionSize:
|
case GetInfoType::NewMapRegionSize:
|
||||||
case GetInfoType::TotalMemoryUsage:
|
case GetInfoType::TotalMemoryUsage:
|
||||||
case GetInfoType::TotalHeapUsage:
|
case GetInfoType::TotalPhysicalMemoryUsed:
|
||||||
case GetInfoType::IsVirtualAddressMemoryEnabled:
|
case GetInfoType::IsVirtualAddressMemoryEnabled:
|
||||||
case GetInfoType::PersonalMmHeapUsage:
|
case GetInfoType::PersonalMmHeapUsage:
|
||||||
case GetInfoType::TitleId:
|
case GetInfoType::TitleId:
|
||||||
|
@ -805,8 +805,8 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
|
||||||
*result = process->VMManager().GetTotalMemoryUsage();
|
*result = process->VMManager().GetTotalMemoryUsage();
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
||||||
case GetInfoType::TotalHeapUsage:
|
case GetInfoType::TotalPhysicalMemoryUsed:
|
||||||
*result = process->VMManager().GetCurrentHeapSize();
|
*result = process->GetTotalPhysicalMemoryUsed();
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
||||||
case GetInfoType::IsVirtualAddressMemoryEnabled:
|
case GetInfoType::IsVirtualAddressMemoryEnabled:
|
||||||
|
|
Loading…
Reference in a new issue