MemoryState: Add additional memory states and improve naming.
This commit is contained in:
parent
07ae1f972d
commit
8be7131033
|
@ -153,9 +153,9 @@ void Process::LoadModule(SharedPtr<CodeSet> module_, VAddr base_addr) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map CodeSet segments
|
// Map CodeSet segments
|
||||||
MapSegment(module_->code, VMAPermission::ReadExecute, MemoryState::Code);
|
MapSegment(module_->code, VMAPermission::ReadExecute, MemoryState::CodeStatic);
|
||||||
MapSegment(module_->rodata, VMAPermission::Read, MemoryState::Static);
|
MapSegment(module_->rodata, VMAPermission::Read, MemoryState::CodeMutable);
|
||||||
MapSegment(module_->data, VMAPermission::ReadWrite, MemoryState::Static);
|
MapSegment(module_->data, VMAPermission::ReadWrite, MemoryState::CodeMutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
VAddr Process::GetLinearHeapAreaAddress() const {
|
VAddr Process::GetLinearHeapAreaAddress() const {
|
||||||
|
|
|
@ -468,7 +468,7 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
|
||||||
memory_info->base_address = 0;
|
memory_info->base_address = 0;
|
||||||
memory_info->permission = static_cast<u32>(VMAPermission::None);
|
memory_info->permission = static_cast<u32>(VMAPermission::None);
|
||||||
memory_info->size = 0;
|
memory_info->size = 0;
|
||||||
memory_info->type = static_cast<u32>(MemoryState::Free);
|
memory_info->type = static_cast<u32>(MemoryState::Unmapped);
|
||||||
} else {
|
} else {
|
||||||
memory_info->base_address = vma->second.base;
|
memory_info->base_address = vma->second.base;
|
||||||
memory_info->permission = static_cast<u32>(vma->second.permissions);
|
memory_info->permission = static_cast<u32>(vma->second.permissions);
|
||||||
|
|
|
@ -314,7 +314,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
||||||
// TODO(Subv): Find the correct MemoryState for this region.
|
// TODO(Subv): Find the correct MemoryState for this region.
|
||||||
vm_manager.MapMemoryBlock(Memory::TLS_AREA_VADDR + available_page * Memory::PAGE_SIZE,
|
vm_manager.MapMemoryBlock(Memory::TLS_AREA_VADDR + available_page * Memory::PAGE_SIZE,
|
||||||
linheap_memory, offset, Memory::PAGE_SIZE,
|
linheap_memory, offset, Memory::PAGE_SIZE,
|
||||||
MemoryState::ThreadLocalStorage);
|
MemoryState::ThreadLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark the slot as used
|
// Mark the slot as used
|
||||||
|
|
|
@ -18,8 +18,26 @@ namespace Kernel {
|
||||||
|
|
||||||
static const char* GetMemoryStateName(MemoryState state) {
|
static const char* GetMemoryStateName(MemoryState state) {
|
||||||
static const char* names[] = {
|
static const char* names[] = {
|
||||||
"Free", "Reserved", "IO", "Static", "Code", "Private",
|
"Unmapped",
|
||||||
"Shared", "Continuous", "Aliased", "Alias", "AliasCode", "Locked",
|
"Io",
|
||||||
|
"Normal",
|
||||||
|
"CodeStatic",
|
||||||
|
"CodeMutable",
|
||||||
|
"Heap",
|
||||||
|
"Shared",
|
||||||
|
"Unknown1"
|
||||||
|
"ModuleCodeStatic",
|
||||||
|
"ModuleCodeMutable",
|
||||||
|
"IpcBuffer0",
|
||||||
|
"Mapped",
|
||||||
|
"ThreadLocal",
|
||||||
|
"TransferMemoryIsolated",
|
||||||
|
"TransferMemory",
|
||||||
|
"ProcessMemory",
|
||||||
|
"Unknown2"
|
||||||
|
"IpcBuffer1",
|
||||||
|
"IpcBuffer3",
|
||||||
|
"KernelStack",
|
||||||
};
|
};
|
||||||
|
|
||||||
return names[(int)state];
|
return names[(int)state];
|
||||||
|
@ -142,7 +160,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::Free;
|
vma.meminfo_state = MemoryState::Unmapped;
|
||||||
|
|
||||||
vma.backing_block = nullptr;
|
vma.backing_block = nullptr;
|
||||||
vma.offset = 0;
|
vma.offset = 0;
|
||||||
|
|
|
@ -41,15 +41,24 @@ enum class VMAPermission : u8 {
|
||||||
|
|
||||||
/// Set of values returned in MemoryInfo.state by svcQueryMemory.
|
/// Set of values returned in MemoryInfo.state by svcQueryMemory.
|
||||||
enum class MemoryState : u32 {
|
enum class MemoryState : u32 {
|
||||||
Free = 0,
|
Unmapped = 0x0,
|
||||||
IO = 1,
|
Io = 0x1,
|
||||||
Normal = 2,
|
Normal = 0x2,
|
||||||
Code = 3,
|
CodeStatic = 0x3,
|
||||||
Static = 4,
|
CodeMutable = 0x4,
|
||||||
Heap = 5,
|
Heap = 0x5,
|
||||||
Shared = 6,
|
Shared = 0x6,
|
||||||
Mapped = 6,
|
ModuleCodeStatic = 0x8,
|
||||||
ThreadLocalStorage = 12,
|
ModuleCodeMutable = 0x9,
|
||||||
|
IpcBuffer0 = 0xA,
|
||||||
|
Mapped = 0xB,
|
||||||
|
ThreadLocal = 0xC,
|
||||||
|
TransferMemoryIsolated = 0xD,
|
||||||
|
TransferMemory = 0xE,
|
||||||
|
ProcessMemory = 0xF,
|
||||||
|
IpcBuffer1 = 0x11,
|
||||||
|
IpcBuffer3 = 0x12,
|
||||||
|
KernelStack = 0x13,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +75,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.
|
/// Tag returned by svcQueryMemory. Not otherwise used.
|
||||||
MemoryState meminfo_state = MemoryState::Free;
|
MemoryState meminfo_state = MemoryState::Unmapped;
|
||||||
|
|
||||||
// Settings for type = AllocatedMemoryBlock
|
// Settings for type = AllocatedMemoryBlock
|
||||||
/// Memory block backing this VMA.
|
/// Memory block backing this VMA.
|
||||||
|
|
Reference in New Issue