Add basic scheduler structure

This commit is contained in:
wheremyfoodat 2024-01-20 23:17:35 +02:00
parent b5718010ee
commit 7343497f36
4 changed files with 85 additions and 28 deletions

View file

@ -1,32 +1,37 @@
#ifdef CPU_DYNARMIC
#include "cpu_dynarmic.hpp"
#include "arm_defs.hpp"
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;
config.arch_version = Dynarmic::A32::ArchVersion::v6K;
config.callbacks = &env;
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);
Dynarmic::A32::UserConfig config;
config.arch_version = Dynarmic::A32::ArchVersion::v6K;
config.callbacks = &env;
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);
}
void CPU::reset() {
setCPSR(CPSR::UserMode);
setFPSCR(FPSCR::MainThreadDefault);
env.totalTicks = 0;
setCPSR(CPSR::UserMode);
setFPSCR(FPSCR::MainThreadDefault);
env.totalTicks = 0;
cp15->reset();
cp15->setTLSBase(VirtualAddrs::TLSBase); // Set cp15 TLS pointer to the main thread's thread-local storage
jit->Reset();
jit->ClearCache();
jit->Regs().fill(0);
jit->ExtRegs().fill(0);
cp15->reset();
cp15->setTLSBase(VirtualAddrs::TLSBase); // Set cp15 TLS pointer to the main thread's thread-local storage
jit->Reset();
jit->ClearCache();
jit->Regs().fill(0);
jit->ExtRegs().fill(0);
// Reset scheduler and add a VBlank event
scheduler.reset();
scheduler.addEvent(Scheduler::EventType::VBlank, ticksPerSec / 60);
}
#endif // CPU_DYNARMIC
#endif // CPU_DYNARMIC