Pass system into arm interpreter; fix tests
This commit is contained in:
parent
c6b3186475
commit
e87dc17da2
12 changed files with 48 additions and 38 deletions
|
@ -68,14 +68,14 @@ private:
|
|||
u32 fpexc;
|
||||
};
|
||||
|
||||
ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) {
|
||||
state = std::make_unique<ARMul_State>(initial_mode);
|
||||
ARM_DynCom::ARM_DynCom(Core::System& system, PrivilegeMode initial_mode) : system(system) {
|
||||
state = std::make_unique<ARMul_State>(system, initial_mode);
|
||||
}
|
||||
|
||||
ARM_DynCom::~ARM_DynCom() {}
|
||||
|
||||
void ARM_DynCom::Run() {
|
||||
ExecuteInstructions(std::max<s64>(Core::System::GetInstance().CoreTiming().GetDowncount(), 0));
|
||||
ExecuteInstructions(std::max<s64>(system.CoreTiming().GetDowncount(), 0));
|
||||
}
|
||||
|
||||
void ARM_DynCom::Step() {
|
||||
|
@ -146,7 +146,7 @@ void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) {
|
|||
void ARM_DynCom::ExecuteInstructions(u64 num_instructions) {
|
||||
state->NumInstrsToExecute = num_instructions;
|
||||
unsigned ticks_executed = InterpreterMainLoop(state.get());
|
||||
Core::System::GetInstance().CoreTiming().AddTicks(ticks_executed);
|
||||
system.CoreTiming().AddTicks(ticks_executed);
|
||||
state->ServeBreak();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
#include "core/arm/skyeye_common/arm_regformat.h"
|
||||
#include "core/arm/skyeye_common/armstate.h"
|
||||
|
||||
namespace Core {
|
||||
struct System;
|
||||
}
|
||||
|
||||
class ARM_DynCom final : public ARM_Interface {
|
||||
public:
|
||||
explicit ARM_DynCom(PrivilegeMode initial_mode);
|
||||
explicit ARM_DynCom(Core::System& system, PrivilegeMode initial_mode);
|
||||
~ARM_DynCom();
|
||||
|
||||
void Run() override;
|
||||
|
@ -44,5 +48,6 @@ public:
|
|||
private:
|
||||
void ExecuteInstructions(u64 num_instructions);
|
||||
|
||||
Core::System& system;
|
||||
std::unique_ptr<ARMul_State> state;
|
||||
};
|
||||
|
|
|
@ -811,7 +811,7 @@ MICROPROFILE_DEFINE(DynCom_Decode, "DynCom", "Decode", MP_RGB(255, 64, 64));
|
|||
static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, const u32 phys_addr,
|
||||
ARM_INST_PTR& inst_base) {
|
||||
u32 inst_size = 4;
|
||||
u32 inst = Core::System::GetInstance().Memory().Read32(phys_addr & 0xFFFFFFFC);
|
||||
u32 inst = cpu->system.Memory().Read32(phys_addr & 0xFFFFFFFC);
|
||||
|
||||
// If we are in Thumb mode, we'll translate one Thumb instruction to the corresponding ARM
|
||||
// instruction
|
||||
|
@ -3860,11 +3860,11 @@ SUB_INST : {
|
|||
SWI_INST : {
|
||||
if (inst_base->cond == ConditionCode::AL || CondPassed(cpu, inst_base->cond)) {
|
||||
swi_inst* const inst_cream = (swi_inst*)inst_base->component;
|
||||
Core::System::GetInstance().CoreTiming().AddTicks(num_instrs);
|
||||
cpu->system.CoreTiming().AddTicks(num_instrs);
|
||||
cpu->NumInstrsToExecute =
|
||||
num_instrs >= cpu->NumInstrsToExecute ? 0 : cpu->NumInstrsToExecute - num_instrs;
|
||||
num_instrs = 0;
|
||||
Kernel::SVCContext{Core::System::GetInstance()}.CallSVC(inst_cream->num & 0xFFFF);
|
||||
Kernel::SVCContext{cpu->system}.CallSVC(inst_cream->num & 0xFFFF);
|
||||
// The kernel would call ERET to get here, which clears exclusive memory state.
|
||||
cpu->UnsetExclusiveMemoryAddress();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue