Core: Refactor ARM Interface.

This commit is contained in:
Fernando Sahmkow
2020-02-29 13:58:50 -04:00
parent 534466754f
commit 1b82ccec22
10 changed files with 69 additions and 42 deletions

View File

@ -63,8 +63,9 @@ static bool UnmappedMemoryHook(uc_engine* uc, uc_mem_type type, u64 addr, int si
return false;
}
ARM_Unicorn::ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture)
: ARM_Interface{system, interrupt_handler} {
ARM_Unicorn::ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture,
std::size_t core_index)
: ARM_Interface{system, interrupt_handler}, core_index{core_index} {
const auto arch = architecture == Arch::AArch32 ? UC_ARCH_ARM : UC_ARCH_ARM64;
CHECKED(uc_open(arch, UC_MODE_ARM, &uc));
@ -163,7 +164,7 @@ void ARM_Unicorn::Run() {
ExecuteInstructions(std::max(4000000U, 0U));
} else {
while (true) {
if (interrupt_handler.IsInterrupted()) {
if (interrupt_handlers[core_index].IsInterrupted()) {
return;
}
ExecuteInstructions(10);

View File

@ -11,7 +11,6 @@
namespace Core {
class CPUInterruptHandler;
class System;
class ARM_Unicorn final : public ARM_Interface {
@ -21,7 +20,8 @@ public:
AArch64, // 64-bit ARM
};
explicit ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture);
explicit ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture,
std::size_t core_index);
~ARM_Unicorn() override;
void SetPC(u64 pc) override;
@ -56,6 +56,7 @@ private:
uc_engine* uc{};
GDBStub::BreakpointAddress last_bkpt{};
bool last_bkpt_hit = false;
std::size_t core_index;
};
} // namespace Core