diff options
| author | 2018-12-06 10:59:22 -0500 | |
|---|---|---|
| committer | 2018-12-06 15:02:17 -0500 | |
| commit | d4c1b9d311c978a6354574d09c451522ceb74e82 (patch) | |
| tree | 4fd85da1f82ec31892c6645e45d2a04f6e010b9f /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #1870 from heapo/pagetable_shrink_to_fit (diff) | |
| download | yuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.tar.gz yuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.tar.xz yuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.zip | |
vm_manager: Make vma_map private
This was only ever public so that code could check whether or not a
handle was valid or not. Instead of exposing the object directly and
allowing external code to potentially mess with the map contents, we
just provide a member function that allows checking whether or not a
handle is valid.
This makes all member variables of the VMManager class private except
for the page table.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index e6c77f9db..049d756d0 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -239,7 +239,7 @@ static ResultCode SetMemoryPermission(VAddr addr, u64 size, u32 prot) { | |||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | const VMManager::VMAHandle iter = vm_manager.FindVMA(addr); | 241 | const VMManager::VMAHandle iter = vm_manager.FindVMA(addr); |
| 242 | if (iter == vm_manager.vma_map.end()) { | 242 | if (!vm_manager.IsValidHandle(iter)) { |
| 243 | LOG_ERROR(Kernel_SVC, "Unable to find VMA for address=0x{:016X}", addr); | 243 | LOG_ERROR(Kernel_SVC, "Unable to find VMA for address=0x{:016X}", addr); |
| 244 | return ERR_INVALID_ADDRESS_STATE; | 244 | return ERR_INVALID_ADDRESS_STATE; |
| 245 | } | 245 | } |
| @@ -1077,19 +1077,23 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i | |||
| 1077 | process_handle); | 1077 | process_handle); |
| 1078 | return ERR_INVALID_HANDLE; | 1078 | return ERR_INVALID_HANDLE; |
| 1079 | } | 1079 | } |
| 1080 | auto vma = process->VMManager().FindVMA(addr); | 1080 | |
| 1081 | const auto& vm_manager = process->VMManager(); | ||
| 1082 | const auto vma = vm_manager.FindVMA(addr); | ||
| 1083 | |||
| 1081 | memory_info->attributes = 0; | 1084 | memory_info->attributes = 0; |
| 1082 | if (vma == process->VMManager().vma_map.end()) { | 1085 | if (vm_manager.IsValidHandle(vma)) { |
| 1083 | memory_info->base_address = 0; | ||
| 1084 | memory_info->permission = static_cast<u32>(VMAPermission::None); | ||
| 1085 | memory_info->size = 0; | ||
| 1086 | memory_info->type = static_cast<u32>(MemoryState::Unmapped); | ||
| 1087 | } else { | ||
| 1088 | memory_info->base_address = vma->second.base; | 1086 | memory_info->base_address = vma->second.base; |
| 1089 | memory_info->permission = static_cast<u32>(vma->second.permissions); | 1087 | memory_info->permission = static_cast<u32>(vma->second.permissions); |
| 1090 | memory_info->size = vma->second.size; | 1088 | memory_info->size = vma->second.size; |
| 1091 | memory_info->type = static_cast<u32>(vma->second.meminfo_state); | 1089 | memory_info->type = static_cast<u32>(vma->second.meminfo_state); |
| 1090 | } else { | ||
| 1091 | memory_info->base_address = 0; | ||
| 1092 | memory_info->permission = static_cast<u32>(VMAPermission::None); | ||
| 1093 | memory_info->size = 0; | ||
| 1094 | memory_info->type = static_cast<u32>(MemoryState::Unmapped); | ||
| 1092 | } | 1095 | } |
| 1096 | |||
| 1093 | return RESULT_SUCCESS; | 1097 | return RESULT_SUCCESS; |
| 1094 | } | 1098 | } |
| 1095 | 1099 | ||