Fix LDREX/STREX
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "dynarmic/interface/A32/a32.h"
|
#include "dynarmic/interface/A32/a32.h"
|
||||||
#include "dynarmic/interface/A32/config.h"
|
#include "dynarmic/interface/A32/config.h"
|
||||||
|
#include "dynarmic/interface/exclusive_monitor.h"
|
||||||
#include "dynarmic_cp15.hpp"
|
#include "dynarmic_cp15.hpp"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel.hpp"
|
#include "kernel.hpp"
|
||||||
@@ -45,6 +46,26 @@ public:
|
|||||||
mem.write64(vaddr, value);
|
mem.write64(vaddr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MemoryWriteExclusive8(u32 addr, u8 value, u8 expected) override {
|
||||||
|
mem.write8(addr, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MemoryWriteExclusive16(u32 addr, u16 value, u16 expected) override {
|
||||||
|
mem.write16(addr, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MemoryWriteExclusive32(u32 addr, u32 value, u32 expected) override {
|
||||||
|
mem.write32(addr, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MemoryWriteExclusive64(u32 addr, u64 value, u64 expected) override {
|
||||||
|
mem.write64(addr, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void InterpreterFallback(u32 pc, size_t num_instructions) override {
|
void InterpreterFallback(u32 pc, size_t num_instructions) override {
|
||||||
// This is never called in practice.
|
// This is never called in practice.
|
||||||
std::terminate();
|
std::terminate();
|
||||||
@@ -76,6 +97,9 @@ public:
|
|||||||
class CPU {
|
class CPU {
|
||||||
std::unique_ptr<Dynarmic::A32::Jit> jit;
|
std::unique_ptr<Dynarmic::A32::Jit> jit;
|
||||||
std::shared_ptr<CP15> cp15;
|
std::shared_ptr<CP15> cp15;
|
||||||
|
|
||||||
|
// Make exclusive monitor with only 1 CPU core
|
||||||
|
Dynarmic::ExclusiveMonitor exclusiveMonitor{1};
|
||||||
MyEnvironment env;
|
MyEnvironment env;
|
||||||
Memory& mem;
|
Memory& mem;
|
||||||
|
|
||||||
@@ -106,6 +130,7 @@ public:
|
|||||||
void runFrame() {
|
void runFrame() {
|
||||||
env.ticksLeft = 268111856 / 60;
|
env.ticksLeft = 268111856 / 60;
|
||||||
const auto exitReason = jit->Run();
|
const auto exitReason = jit->Run();
|
||||||
Helpers::panic("Exit reason: %d", (u32)exitReason);
|
for (u32 i = 0; i < 4; i++)printf("r%d: %08X\n", i, getReg(i));
|
||||||
|
Helpers::panic("Exit reason: %d\nPC: %08X", (u32)exitReason, getReg(15));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5,8 +5,13 @@ CPU::CPU(Memory& mem, Kernel& kernel) : mem(mem), env(mem, kernel) {
|
|||||||
cp15 = std::make_shared<CP15>();
|
cp15 = std::make_shared<CP15>();
|
||||||
|
|
||||||
Dynarmic::A32::UserConfig config;
|
Dynarmic::A32::UserConfig config;
|
||||||
|
config.arch_version = Dynarmic::A32::ArchVersion::v6K;
|
||||||
config.callbacks = &env;
|
config.callbacks = &env;
|
||||||
config.coprocessors[15] = cp15;
|
config.coprocessors[15] = cp15;
|
||||||
|
// config.define_unpredictable_behaviour = true;
|
||||||
|
config.global_monitor = &exclusiveMonitor;
|
||||||
|
config.processor_id = 0;
|
||||||
|
|
||||||
jit = std::make_unique<Dynarmic::A32::Jit>(config);
|
jit = std::make_unique<Dynarmic::A32::Jit>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,16 @@ std::optional<u32> Memory::findPaddr(u32 size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u8 Memory::read8(u32 vaddr) {
|
u8 Memory::read8(u32 vaddr) {
|
||||||
Helpers::panic("Unimplemented 8-bit read, addr: %08X", vaddr);
|
const u32 page = vaddr >> pageShift;
|
||||||
|
const u32 offset = vaddr & pageMask;
|
||||||
|
|
||||||
|
uintptr_t pointer = readTable[page];
|
||||||
|
if (pointer != 0) [[likely]] {
|
||||||
|
return *(u8*)(pointer + offset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Helpers::panic("Unimplemented 8-bit read, addr: %08X", vaddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 Memory::read16(u32 vaddr) {
|
u16 Memory::read16(u32 vaddr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user