Merge pull request #2275 from lioncash/memflags
kernel/vm_manager: Amend flag value for code data
This commit is contained in:
commit
4d95adcac5
|
@ -220,9 +220,9 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map CodeSet segments
|
// Map CodeSet segments
|
||||||
MapSegment(module_.CodeSegment(), VMAPermission::ReadExecute, MemoryState::CodeStatic);
|
MapSegment(module_.CodeSegment(), VMAPermission::ReadExecute, MemoryState::Code);
|
||||||
MapSegment(module_.RODataSegment(), VMAPermission::Read, MemoryState::CodeMutable);
|
MapSegment(module_.RODataSegment(), VMAPermission::Read, MemoryState::CodeData);
|
||||||
MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeMutable);
|
MapSegment(module_.DataSegment(), VMAPermission::ReadWrite, MemoryState::CodeData);
|
||||||
|
|
||||||
// Clear instruction cache in CPU JIT
|
// Clear instruction cache in CPU JIT
|
||||||
system.InvalidateCpuInstructionCaches();
|
system.InvalidateCpuInstructionCaches();
|
||||||
|
|
|
@ -20,16 +20,16 @@ namespace Kernel {
|
||||||
namespace {
|
namespace {
|
||||||
const char* GetMemoryStateName(MemoryState state) {
|
const char* GetMemoryStateName(MemoryState state) {
|
||||||
static constexpr const char* names[] = {
|
static constexpr const char* names[] = {
|
||||||
"Unmapped", "Io",
|
"Unmapped", "Io",
|
||||||
"Normal", "CodeStatic",
|
"Normal", "Code",
|
||||||
"CodeMutable", "Heap",
|
"CodeData", "Heap",
|
||||||
"Shared", "Unknown1",
|
"Shared", "Unknown1",
|
||||||
"ModuleCodeStatic", "ModuleCodeMutable",
|
"ModuleCode", "ModuleCodeData",
|
||||||
"IpcBuffer0", "Stack",
|
"IpcBuffer0", "Stack",
|
||||||
"ThreadLocal", "TransferMemoryIsolated",
|
"ThreadLocal", "TransferMemoryIsolated",
|
||||||
"TransferMemory", "ProcessMemory",
|
"TransferMemory", "ProcessMemory",
|
||||||
"Inaccessible", "IpcBuffer1",
|
"Inaccessible", "IpcBuffer1",
|
||||||
"IpcBuffer3", "KernelStack",
|
"IpcBuffer3", "KernelStack",
|
||||||
};
|
};
|
||||||
|
|
||||||
return names[ToSvcMemoryState(state)];
|
return names[ToSvcMemoryState(state)];
|
||||||
|
|
|
@ -165,12 +165,12 @@ enum class MemoryState : u32 {
|
||||||
Unmapped = 0x00,
|
Unmapped = 0x00,
|
||||||
Io = 0x01 | FlagMapped,
|
Io = 0x01 | FlagMapped,
|
||||||
Normal = 0x02 | FlagMapped | FlagQueryPhysicalAddressAllowed,
|
Normal = 0x02 | FlagMapped | FlagQueryPhysicalAddressAllowed,
|
||||||
CodeStatic = 0x03 | CodeFlags | FlagMapProcess,
|
Code = 0x03 | CodeFlags | FlagMapProcess,
|
||||||
CodeMutable = 0x04 | CodeFlags | FlagMapProcess | FlagCodeMemory,
|
CodeData = 0x04 | DataFlags | FlagMapProcess | FlagCodeMemory,
|
||||||
Heap = 0x05 | DataFlags | FlagCodeMemory,
|
Heap = 0x05 | DataFlags | FlagCodeMemory,
|
||||||
Shared = 0x06 | FlagMapped | FlagMemoryPoolAllocated,
|
Shared = 0x06 | FlagMapped | FlagMemoryPoolAllocated,
|
||||||
ModuleCodeStatic = 0x08 | CodeFlags | FlagModule | FlagMapProcess,
|
ModuleCode = 0x08 | CodeFlags | FlagModule | FlagMapProcess,
|
||||||
ModuleCodeMutable = 0x09 | DataFlags | FlagModule | FlagMapProcess | FlagCodeMemory,
|
ModuleCodeData = 0x09 | DataFlags | FlagModule | FlagMapProcess | FlagCodeMemory,
|
||||||
|
|
||||||
IpcBuffer0 = 0x0A | FlagMapped | FlagQueryPhysicalAddressAllowed | FlagMemoryPoolAllocated |
|
IpcBuffer0 = 0x0A | FlagMapped | FlagQueryPhysicalAddressAllowed | FlagMemoryPoolAllocated |
|
||||||
IPCFlags | FlagSharedDevice | FlagSharedDeviceAligned,
|
IPCFlags | FlagSharedDevice | FlagSharedDeviceAligned,
|
||||||
|
|
|
@ -319,15 +319,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(vm_manager
|
ASSERT(vm_manager
|
||||||
.MirrorMemory(*map_address, nro_addr, nro_size,
|
.MirrorMemory(*map_address, nro_addr, nro_size, Kernel::MemoryState::ModuleCode)
|
||||||
Kernel::MemoryState::ModuleCodeStatic)
|
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
ASSERT(vm_manager.UnmapRange(nro_addr, nro_size).IsSuccess());
|
ASSERT(vm_manager.UnmapRange(nro_addr, nro_size).IsSuccess());
|
||||||
|
|
||||||
if (bss_size > 0) {
|
if (bss_size > 0) {
|
||||||
ASSERT(vm_manager
|
ASSERT(vm_manager
|
||||||
.MirrorMemory(*map_address + nro_size, bss_addr, bss_size,
|
.MirrorMemory(*map_address + nro_size, bss_addr, bss_size,
|
||||||
Kernel::MemoryState::ModuleCodeStatic)
|
Kernel::MemoryState::ModuleCode)
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
ASSERT(vm_manager.UnmapRange(bss_addr, bss_size).IsSuccess());
|
ASSERT(vm_manager.UnmapRange(bss_addr, bss_size).IsSuccess());
|
||||||
}
|
}
|
||||||
|
@ -388,8 +387,7 @@ public:
|
||||||
const auto& nro_size = iter->second.size;
|
const auto& nro_size = iter->second.size;
|
||||||
|
|
||||||
ASSERT(vm_manager
|
ASSERT(vm_manager
|
||||||
.MirrorMemory(heap_addr, mapped_addr, nro_size,
|
.MirrorMemory(heap_addr, mapped_addr, nro_size, Kernel::MemoryState::ModuleCode)
|
||||||
Kernel::MemoryState::ModuleCodeStatic)
|
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
ASSERT(vm_manager.UnmapRange(mapped_addr, nro_size).IsSuccess());
|
ASSERT(vm_manager.UnmapRange(mapped_addr, nro_size).IsSuccess());
|
||||||
|
|
||||||
|
|
Reference in New Issue