Browse Source

arm_interface: Support unmapping previously mapped memory.

nce_cpp
bunnei 8 years ago
parent
commit
256153c50c
  1. 6
      src/core/arm/arm_interface.h
  2. 4
      src/core/arm/dynarmic/arm_dynarmic.cpp
  3. 2
      src/core/arm/dynarmic/arm_dynarmic.h
  4. 4
      src/core/arm/unicorn/arm_unicorn.cpp
  5. 1
      src/core/arm/unicorn/arm_unicorn.h
  6. 3
      src/core/hle/kernel/vm_manager.cpp

6
src/core/arm/arm_interface.h

@ -39,8 +39,12 @@ public:
Run(1);
}
/// Maps a backing memory region for the CPU
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
virtual void ClearInstructionCache() = 0;

4
src/core/arm/dynarmic/arm_dynarmic.cpp

@ -136,6 +136,10 @@ void ARM_Dynarmic::MapBackingMemory(u64 address, size_t size, u8* memory,
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) {
jit->SetPC(pc);
}

2
src/core/arm/dynarmic/arm_dynarmic.h

@ -19,7 +19,7 @@ public:
void MapBackingMemory(VAddr address, size_t size, u8* memory,
Kernel::VMAPermission perms) override;
void UnmapMemory(u64 address, size_t size) override;
void SetPC(u64 pc) override;
u64 GetPC() const override;
u64 GetReg(int index) const override;

4
src/core/arm/unicorn/arm_unicorn.cpp

@ -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));
}
void ARM_Unicorn::UnmapMemory(VAddr address, size_t size) {
CHECKED(uc_mem_unmap(uc, address, size));
}
void ARM_Unicorn::SetPC(u64 pc) {
CHECKED(uc_reg_write(uc, UC_ARM64_REG_PC, &pc));
}

1
src/core/arm/unicorn/arm_unicorn.h

@ -14,6 +14,7 @@ public:
~ARM_Unicorn();
void MapBackingMemory(VAddr address, size_t size, u8* memory,
Kernel::VMAPermission perms) override;
void UnmapMemory(VAddr address, size_t size) override;
void SetPC(u64 pc) override;
u64 GetPC() const override;
u64 GetReg(int index) const override;

3
src/core/hle/kernel/vm_manager.cpp

@ -184,6 +184,9 @@ ResultCode VMManager::UnmapRange(VAddr target, u64 size) {
}
ASSERT(FindVMA(target)->second.size >= size);
Core::CPU().UnmapMemory(target, size);
return RESULT_SUCCESS;
}

Loading…
Cancel
Save