Memory: move GetPhysicalPointer and IsValidPhysicalAddress into class

This commit is contained in:
Weiyi Wang 2018-11-21 12:01:19 -05:00
parent cfee59c6db
commit 296c458e0e
18 changed files with 76 additions and 65 deletions

View file

@ -46,6 +46,7 @@ class SharedMemory;
class ThreadManager;
class TimerManager;
class VMManager;
struct AddressMapping;
enum class ResetType {
OneShot,
@ -216,6 +217,8 @@ public:
MemoryRegionInfo* GetMemoryRegion(MemoryRegion region);
void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping);
std::array<MemoryRegionInfo, 3> memory_regions;
/// Adds a port to the named port table

View file

@ -83,7 +83,7 @@ MemoryRegionInfo* KernelSystem::GetMemoryRegion(MemoryRegion region) {
}
}
void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {
void KernelSystem::HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping) {
using namespace Memory;
struct MemoryArea {
@ -128,7 +128,7 @@ void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mappin
return;
}
u8* target_pointer = Memory::GetPhysicalPointer(area->paddr_base + offset_into_region);
u8* target_pointer = memory.GetPhysicalPointer(area->paddr_base + offset_into_region);
// TODO(yuriks): This flag seems to have some other effect, but it's unknown what
MemoryState memory_state = mapping.unk_flag ? MemoryState::Static : MemoryState::IO;

View file

@ -62,6 +62,4 @@ struct MemoryRegionInfo {
void Free(u32 offset, u32 size);
};
void HandleSpecialMapping(VMManager& address_space, const AddressMapping& mapping);
} // namespace Kernel

View file

@ -136,7 +136,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
// Map special address mappings
kernel.MapSharedPages(vm_manager);
for (const auto& mapping : address_mappings) {
HandleSpecialMapping(vm_manager, mapping);
kernel.HandleSpecialMapping(vm_manager, mapping);
}
status = ProcessStatus::Running;