diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/svc.cpp | 36 | ||||
| -rw-r--r-- | src/core/hle/svc.h | 40 |
2 files changed, 41 insertions, 35 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index fa6fd9ab1..6ec151d94 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -194,16 +194,38 @@ static void OutputDebugString(VAddr address, s32 len) { | |||
| 194 | LOG_DEBUG(Debug_Emulated, "%.*s", len, string.data()); | 194 | LOG_DEBUG(Debug_Emulated, "%.*s", len, string.data()); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | /// Gets system/memory information for the current process | ||
| 197 | static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { | 198 | static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { |
| 198 | LOG_TRACE(Kernel_SVC, "called, info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id, info_sub_id, handle); | 199 | LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id, |
| 200 | info_sub_id, handle); | ||
| 199 | 201 | ||
| 200 | if (!handle) { | 202 | auto& vm_manager = Kernel::g_current_process->vm_manager; |
| 201 | switch (info_id) { | 203 | switch (static_cast<GetInfoType>(info_id)) { |
| 202 | case 0xB: | 204 | case GetInfoType::TotalMemoryUsage: |
| 203 | *result = 0; // Used for PRNG seed | 205 | *result = vm_manager.GetTotalMemoryUsage(); |
| 204 | return RESULT_SUCCESS; | 206 | break; |
| 205 | } | 207 | case GetInfoType::TotalHeapUsage: |
| 208 | *result = vm_manager.GetTotalHeapUsage(); | ||
| 209 | break; | ||
| 210 | case GetInfoType::RandomEntropy: | ||
| 211 | *result = 0; | ||
| 212 | break; | ||
| 213 | case GetInfoType::AddressSpaceBaseAddr: | ||
| 214 | *result = vm_manager.GetAddressSpaceBaseAddr(); | ||
| 215 | break; | ||
| 216 | case GetInfoType::AddressSpaceSize: | ||
| 217 | *result = vm_manager.GetAddressSpaceSize(); | ||
| 218 | break; | ||
| 219 | case GetInfoType::NewMapRegionBaseAddr: | ||
| 220 | *result = vm_manager.GetNewMapRegionBaseAddr(); | ||
| 221 | break; | ||
| 222 | case GetInfoType::NewMapRegionSize: | ||
| 223 | *result = vm_manager.GetNewMapRegionSize(); | ||
| 224 | break; | ||
| 225 | default: | ||
| 226 | UNIMPLEMENTED(); | ||
| 206 | } | 227 | } |
| 228 | |||
| 207 | return RESULT_SUCCESS; | 229 | return RESULT_SUCCESS; |
| 208 | } | 230 | } |
| 209 | 231 | ||
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h index 417a1735f..fd001a38e 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h | |||
| @@ -26,35 +26,19 @@ struct PageInfo { | |||
| 26 | 26 | ||
| 27 | namespace SVC { | 27 | namespace SVC { |
| 28 | 28 | ||
| 29 | /// Values accepted by svcGetSystemInfo's type parameter. | 29 | /// Values accepted by svcGetInfo |
| 30 | enum class SystemInfoType { | 30 | enum class GetInfoType : u64 { |
| 31 | /** | 31 | // 1.0.0+ |
| 32 | * Reports total used memory for all regions or a specific one, according to the extra | 32 | TotalMemoryUsage = 6, |
| 33 | * parameter. See `SystemInfoMemUsageRegion`. | 33 | TotalHeapUsage = 7, |
| 34 | */ | 34 | RandomEntropy = 11, |
| 35 | REGION_MEMORY_USAGE = 0, | 35 | // 2.0.0+ |
| 36 | /** | 36 | AddressSpaceBaseAddr = 12, |
| 37 | * Returns the memory usage for certain allocations done internally by the kernel. | 37 | AddressSpaceSize = 13, |
| 38 | */ | 38 | NewMapRegionBaseAddr = 14, |
| 39 | KERNEL_ALLOCATED_PAGES = 2, | 39 | NewMapRegionSize = 15, |
| 40 | /** | ||
| 41 | * "This returns the total number of processes which were launched directly by the kernel. | ||
| 42 | * For the ARM11 NATIVE_FIRM kernel, this is 5, for processes sm, fs, pm, loader, and pxi." | ||
| 43 | */ | ||
| 44 | KERNEL_SPAWNED_PIDS = 26, | ||
| 45 | }; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * Accepted by svcGetSystemInfo param with REGION_MEMORY_USAGE type. Selects a region to query | ||
| 49 | * memory usage of. | ||
| 50 | */ | ||
| 51 | enum class SystemInfoMemUsageRegion { | ||
| 52 | ALL = 0, | ||
| 53 | APPLICATION = 1, | ||
| 54 | SYSTEM = 2, | ||
| 55 | BASE = 3, | ||
| 56 | }; | 40 | }; |
| 57 | 41 | ||
| 58 | void CallSVC(u32 immediate); | 42 | void CallSVC(u32 immediate); |
| 59 | 43 | ||
| 60 | } // namespace | 44 | } // namespace SVC |