arm_interface: Support unmapping previously mapped memory.
This commit is contained in:
parent
34a29ad051
commit
403f8e79ea
|
@ -39,8 +39,12 @@ public:
|
||||||
Run(1);
|
Run(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Maps a backing memory region for the CPU
|
||||||
virtual void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
virtual void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
||||||
Kernel::VMAPermission perms) {}
|
Kernel::VMAPermission perms) = 0;
|
||||||
|
|
||||||
|
/// Unmaps a region of memory that was previously mapped using MapBackingMemory
|
||||||
|
virtual void UnmapMemory(VAddr address, size_t size) = 0;
|
||||||
|
|
||||||
/// Clear all instruction cache
|
/// Clear all instruction cache
|
||||||
virtual void ClearInstructionCache() = 0;
|
virtual void ClearInstructionCache() = 0;
|
||||||
|
|
|
@ -136,6 +136,10 @@ void ARM_Dynarmic::MapBackingMemory(u64 address, size_t size, u8* memory,
|
||||||
inner_unicorn.MapBackingMemory(address, size, memory, perms);
|
inner_unicorn.MapBackingMemory(address, size, memory, perms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARM_Dynarmic::UnmapMemory(u64 address, size_t size) {
|
||||||
|
inner_unicorn.UnmapMemory(address, size);
|
||||||
|
}
|
||||||
|
|
||||||
void ARM_Dynarmic::SetPC(u64 pc) {
|
void ARM_Dynarmic::SetPC(u64 pc) {
|
||||||
jit->SetPC(pc);
|
jit->SetPC(pc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
||||||
Kernel::VMAPermission perms) override;
|
Kernel::VMAPermission perms) override;
|
||||||
|
void UnmapMemory(u64 address, size_t size) override;
|
||||||
void SetPC(u64 pc) override;
|
void SetPC(u64 pc) override;
|
||||||
u64 GetPC() const override;
|
u64 GetPC() const override;
|
||||||
u64 GetReg(int index) const override;
|
u64 GetReg(int index) const override;
|
||||||
|
|
|
@ -77,6 +77,10 @@ void ARM_Unicorn::MapBackingMemory(VAddr address, size_t size, u8* memory,
|
||||||
CHECKED(uc_mem_map_ptr(uc, address, size, static_cast<u32>(perms), memory));
|
CHECKED(uc_mem_map_ptr(uc, address, size, static_cast<u32>(perms), memory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARM_Unicorn::UnmapMemory(VAddr address, size_t size) {
|
||||||
|
CHECKED(uc_mem_unmap(uc, address, size));
|
||||||
|
}
|
||||||
|
|
||||||
void ARM_Unicorn::SetPC(u64 pc) {
|
void ARM_Unicorn::SetPC(u64 pc) {
|
||||||
CHECKED(uc_reg_write(uc, UC_ARM64_REG_PC, &pc));
|
CHECKED(uc_reg_write(uc, UC_ARM64_REG_PC, &pc));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ public:
|
||||||
~ARM_Unicorn();
|
~ARM_Unicorn();
|
||||||
void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
void MapBackingMemory(VAddr address, size_t size, u8* memory,
|
||||||
Kernel::VMAPermission perms) override;
|
Kernel::VMAPermission perms) override;
|
||||||
|
void UnmapMemory(VAddr address, size_t size) override;
|
||||||
void SetPC(u64 pc) override;
|
void SetPC(u64 pc) override;
|
||||||
u64 GetPC() const override;
|
u64 GetPC() const override;
|
||||||
u64 GetReg(int index) const override;
|
u64 GetReg(int index) const override;
|
||||||
|
|
|
@ -184,6 +184,9 @@ ResultCode VMManager::UnmapRange(VAddr target, u64 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(FindVMA(target)->second.size >= size);
|
ASSERT(FindVMA(target)->second.size >= size);
|
||||||
|
|
||||||
|
Core::CPU().UnmapMemory(target, size);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue