yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

vm_manager: Rename meminfo_state to state

This is shorter and more concise. This also removes the now-innaccurate
comment, as it's not returned wholesale to svcQueryMemory anymore.
This commit is contained in:
Lioncash 2018-12-14 20:59:08 -05:00
parent 34b24a47e9
commit 4dc8a7da3f
2 changed files with 9 additions and 10 deletions

View File

@ -37,8 +37,8 @@ static const char* GetMemoryStateName(MemoryState state) {
bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const { bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const {
ASSERT(base + size == next.base); ASSERT(base + size == next.base);
if (permissions != next.permissions || meminfo_state != next.meminfo_state || if (permissions != next.permissions || state != next.state || attribute != next.attribute ||
attribute != next.attribute || type != next.type) { type != next.type) {
return false; return false;
} }
if (type == VMAType::AllocatedMemoryBlock && if (type == VMAType::AllocatedMemoryBlock &&
@ -115,7 +115,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
final_vma.type = VMAType::AllocatedMemoryBlock; final_vma.type = VMAType::AllocatedMemoryBlock;
final_vma.permissions = VMAPermission::ReadWrite; final_vma.permissions = VMAPermission::ReadWrite;
final_vma.meminfo_state = state; final_vma.state = state;
final_vma.backing_block = std::move(block); final_vma.backing_block = std::move(block);
final_vma.offset = offset; final_vma.offset = offset;
UpdatePageTableForVMA(final_vma); UpdatePageTableForVMA(final_vma);
@ -140,7 +140,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapBackingMemory(VAddr target, u8* me
final_vma.type = VMAType::BackingMemory; final_vma.type = VMAType::BackingMemory;
final_vma.permissions = VMAPermission::ReadWrite; final_vma.permissions = VMAPermission::ReadWrite;
final_vma.meminfo_state = state; final_vma.state = state;
final_vma.backing_memory = memory; final_vma.backing_memory = memory;
UpdatePageTableForVMA(final_vma); UpdatePageTableForVMA(final_vma);
@ -177,7 +177,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMMIO(VAddr target, PAddr paddr, u6
final_vma.type = VMAType::MMIO; final_vma.type = VMAType::MMIO;
final_vma.permissions = VMAPermission::ReadWrite; final_vma.permissions = VMAPermission::ReadWrite;
final_vma.meminfo_state = state; final_vma.state = state;
final_vma.paddr = paddr; final_vma.paddr = paddr;
final_vma.mmio_handler = std::move(mmio_handler); final_vma.mmio_handler = std::move(mmio_handler);
UpdatePageTableForVMA(final_vma); UpdatePageTableForVMA(final_vma);
@ -189,7 +189,7 @@ VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) {
VirtualMemoryArea& vma = vma_handle->second; VirtualMemoryArea& vma = vma_handle->second;
vma.type = VMAType::Free; vma.type = VMAType::Free;
vma.permissions = VMAPermission::None; vma.permissions = VMAPermission::None;
vma.meminfo_state = MemoryState::Unmapped; vma.state = MemoryState::Unmapped;
vma.backing_block = nullptr; vma.backing_block = nullptr;
vma.offset = 0; vma.offset = 0;
@ -311,7 +311,7 @@ MemoryInfo VMManager::QueryMemory(VAddr address) const {
memory_info.attributes = ToSvcMemoryAttribute(vma->second.attribute); memory_info.attributes = ToSvcMemoryAttribute(vma->second.attribute);
memory_info.permission = static_cast<u32>(vma->second.permissions); memory_info.permission = static_cast<u32>(vma->second.permissions);
memory_info.size = vma->second.size; memory_info.size = vma->second.size;
memory_info.state = ToSvcMemoryState(vma->second.meminfo_state); memory_info.state = ToSvcMemoryState(vma->second.state);
} else { } else {
memory_info.base_address = address_space_end; memory_info.base_address = address_space_end;
memory_info.permission = static_cast<u32>(VMAPermission::None); memory_info.permission = static_cast<u32>(VMAPermission::None);
@ -365,7 +365,7 @@ void VMManager::LogLayout() const {
(u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
(u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
(u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-',
GetMemoryStateName(vma.meminfo_state)); GetMemoryStateName(vma.state));
} }
} }

View File

@ -263,8 +263,7 @@ struct VirtualMemoryArea {
VMAType type = VMAType::Free; VMAType type = VMAType::Free;
VMAPermission permissions = VMAPermission::None; VMAPermission permissions = VMAPermission::None;
/// Tag returned by svcQueryMemory. Not otherwise used. MemoryState state = MemoryState::Unmapped;
MemoryState meminfo_state = MemoryState::Unmapped;
MemoryAttribute attribute = MemoryAttribute::None; MemoryAttribute attribute = MemoryAttribute::None;
// Settings for type = AllocatedMemoryBlock // Settings for type = AllocatedMemoryBlock