summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/process.cpp16
-rw-r--r--src/core/hle/kernel/process.h11
-rw-r--r--src/core/hle/kernel/svc.cpp26
-rw-r--r--src/core/hle/kernel/vm_manager.cpp2
-rw-r--r--src/core/hle/kernel/vm_manager.h2
5 files changed, 48 insertions, 9 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 0775a89fb..63a3707b2 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -72,10 +72,26 @@ SharedPtr<ResourceLimit> Process::GetResourceLimit() const {
72 return resource_limit; 72 return resource_limit;
73} 73}
74 74
75u64 Process::GetTotalPhysicalMemoryAvailable() const {
76 return vm_manager.GetTotalPhysicalMemoryAvailable();
77}
78
79u64 Process::GetTotalPhysicalMemoryAvailableWithoutMmHeap() const {
80 // TODO: Subtract the personal heap size from this when the
81 // personal heap is implemented.
82 return GetTotalPhysicalMemoryAvailable();
83}
84
75u64 Process::GetTotalPhysicalMemoryUsed() const { 85u64 Process::GetTotalPhysicalMemoryUsed() const {
76 return vm_manager.GetCurrentHeapSize() + main_thread_stack_size + code_memory_size; 86 return vm_manager.GetCurrentHeapSize() + main_thread_stack_size + code_memory_size;
77} 87}
78 88
89u64 Process::GetTotalPhysicalMemoryUsedWithoutMmHeap() const {
90 // TODO: Subtract the personal heap size from this when the
91 // personal heap is implemented.
92 return GetTotalPhysicalMemoryUsed();
93}
94
79void Process::RegisterThread(const Thread* thread) { 95void Process::RegisterThread(const Thread* thread) {
80 thread_list.push_back(thread); 96 thread_list.push_back(thread);
81} 97}
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index f027fafa3..9c20eb7f8 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -186,9 +186,20 @@ public:
186 return random_entropy.at(index); 186 return random_entropy.at(index);
187 } 187 }
188 188
189 /// Retrieves the total physical memory available to this process in bytes.
190 u64 GetTotalPhysicalMemoryAvailable() const;
191
192 /// Retrieves the total physical memory available to this process in bytes,
193 /// without the size of the personal heap added to it.
194 u64 GetTotalPhysicalMemoryAvailableWithoutMmHeap() const;
195
189 /// Retrieves the total physical memory used by this process in bytes. 196 /// Retrieves the total physical memory used by this process in bytes.
190 u64 GetTotalPhysicalMemoryUsed() const; 197 u64 GetTotalPhysicalMemoryUsed() const;
191 198
199 /// Retrieves the total physical memory used by this process in bytes,
200 /// without the size of the personal heap added to it.
201 u64 GetTotalPhysicalMemoryUsedWithoutMmHeap() const;
202
192 /// Gets the list of all threads created with this process as their owner. 203 /// Gets the list of all threads created with this process as their owner.
193 const std::list<const Thread*>& GetThreadList() const { 204 const std::list<const Thread*>& GetThreadList() const {
194 return thread_list; 205 return thread_list;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 5a5851f66..f9c606bc5 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -710,13 +710,13 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
710 MapRegionSize = 3, 710 MapRegionSize = 3,
711 HeapRegionBaseAddr = 4, 711 HeapRegionBaseAddr = 4,
712 HeapRegionSize = 5, 712 HeapRegionSize = 5,
713 TotalMemoryUsage = 6, 713 TotalPhysicalMemoryAvailable = 6,
714 TotalPhysicalMemoryUsed = 7, 714 TotalPhysicalMemoryUsed = 7,
715 IsCurrentProcessBeingDebugged = 8, 715 IsCurrentProcessBeingDebugged = 8,
716 RegisterResourceLimit = 9, 716 RegisterResourceLimit = 9,
717 IdleTickCount = 10, 717 IdleTickCount = 10,
718 RandomEntropy = 11, 718 RandomEntropy = 11,
719 PerformanceCounter = 0xF0000002, 719 ThreadTickCount = 0xF0000002,
720 // 2.0.0+ 720 // 2.0.0+
721 ASLRRegionBaseAddr = 12, 721 ASLRRegionBaseAddr = 12,
722 ASLRRegionSize = 13, 722 ASLRRegionSize = 13,
@@ -730,7 +730,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
730 PrivilegedProcessId = 19, 730 PrivilegedProcessId = 19,
731 // 5.0.0+ 731 // 5.0.0+
732 UserExceptionContextAddr = 20, 732 UserExceptionContextAddr = 20,
733 ThreadTickCount = 0xF0000002, 733 // 6.0.0+
734 TotalPhysicalMemoryAvailableWithoutMmHeap = 21,
735 TotalPhysicalMemoryUsedWithoutMmHeap = 22,
734 }; 736 };
735 737
736 const auto info_id_type = static_cast<GetInfoType>(info_id); 738 const auto info_id_type = static_cast<GetInfoType>(info_id);
@@ -746,12 +748,14 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
746 case GetInfoType::ASLRRegionSize: 748 case GetInfoType::ASLRRegionSize:
747 case GetInfoType::NewMapRegionBaseAddr: 749 case GetInfoType::NewMapRegionBaseAddr:
748 case GetInfoType::NewMapRegionSize: 750 case GetInfoType::NewMapRegionSize:
749 case GetInfoType::TotalMemoryUsage: 751 case GetInfoType::TotalPhysicalMemoryAvailable:
750 case GetInfoType::TotalPhysicalMemoryUsed: 752 case GetInfoType::TotalPhysicalMemoryUsed:
751 case GetInfoType::IsVirtualAddressMemoryEnabled: 753 case GetInfoType::IsVirtualAddressMemoryEnabled:
752 case GetInfoType::PersonalMmHeapUsage: 754 case GetInfoType::PersonalMmHeapUsage:
753 case GetInfoType::TitleId: 755 case GetInfoType::TitleId:
754 case GetInfoType::UserExceptionContextAddr: { 756 case GetInfoType::UserExceptionContextAddr:
757 case GetInfoType::TotalPhysicalMemoryAvailableWithoutMmHeap:
758 case GetInfoType::TotalPhysicalMemoryUsedWithoutMmHeap: {
755 if (info_sub_id != 0) { 759 if (info_sub_id != 0) {
756 return ERR_INVALID_ENUM_VALUE; 760 return ERR_INVALID_ENUM_VALUE;
757 } 761 }
@@ -804,8 +808,8 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
804 *result = process->VMManager().GetNewMapRegionSize(); 808 *result = process->VMManager().GetNewMapRegionSize();
805 return RESULT_SUCCESS; 809 return RESULT_SUCCESS;
806 810
807 case GetInfoType::TotalMemoryUsage: 811 case GetInfoType::TotalPhysicalMemoryAvailable:
808 *result = process->VMManager().GetTotalMemoryUsage(); 812 *result = process->GetTotalPhysicalMemoryAvailable();
809 return RESULT_SUCCESS; 813 return RESULT_SUCCESS;
810 814
811 case GetInfoType::TotalPhysicalMemoryUsed: 815 case GetInfoType::TotalPhysicalMemoryUsed:
@@ -826,6 +830,14 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
826 *result = 0; 830 *result = 0;
827 return RESULT_SUCCESS; 831 return RESULT_SUCCESS;
828 832
833 case GetInfoType::TotalPhysicalMemoryAvailableWithoutMmHeap:
834 *result = process->GetTotalPhysicalMemoryAvailable();
835 return RESULT_SUCCESS;
836
837 case GetInfoType::TotalPhysicalMemoryUsedWithoutMmHeap:
838 *result = process->GetTotalPhysicalMemoryUsedWithoutMmHeap();
839 return RESULT_SUCCESS;
840
829 default: 841 default:
830 break; 842 break;
831 } 843 }
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index 48b13cfdd..6d6980aba 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -758,7 +758,7 @@ VMManager::CheckResults VMManager::CheckRangeState(VAddr address, u64 size, Memo
758 std::make_tuple(initial_state, initial_permissions, initial_attributes & ~ignore_mask)); 758 std::make_tuple(initial_state, initial_permissions, initial_attributes & ~ignore_mask));
759} 759}
760 760
761u64 VMManager::GetTotalMemoryUsage() const { 761u64 VMManager::GetTotalPhysicalMemoryAvailable() const {
762 LOG_WARNING(Kernel, "(STUBBED) called"); 762 LOG_WARNING(Kernel, "(STUBBED) called");
763 return 0xF8000000; 763 return 0xF8000000;
764} 764}
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h
index ec84d9a70..dfbf7a894 100644
--- a/src/core/hle/kernel/vm_manager.h
+++ b/src/core/hle/kernel/vm_manager.h
@@ -499,7 +499,7 @@ public:
499 void LogLayout() const; 499 void LogLayout() const;
500 500
501 /// Gets the total memory usage, used by svcGetInfo 501 /// Gets the total memory usage, used by svcGetInfo
502 u64 GetTotalMemoryUsage() const; 502 u64 GetTotalPhysicalMemoryAvailable() const;
503 503
504 /// Gets the address space base address 504 /// Gets the address space base address
505 VAddr GetAddressSpaceBaseAddress() const; 505 VAddr GetAddressSpaceBaseAddress() const;