Bare minimum createAddressArbiter HLE
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
#include "dynarmic/interface/A32/a32.h"
|
||||
#include "dynarmic/interface/A32/config.h"
|
||||
#include "helpers.hpp"
|
||||
#include "kernel.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
class MyEnvironment final : public Dynarmic::A32::UserCallbacks {
|
||||
public:
|
||||
u64 ticks_left = 0;
|
||||
Memory& mem;
|
||||
Kernel& kernel;
|
||||
|
||||
u8 MemoryRead8(u32 vaddr) override {
|
||||
return mem.read8(vaddr);
|
||||
@@ -49,7 +51,7 @@ public:
|
||||
}
|
||||
|
||||
void CallSVC(u32 swi) override {
|
||||
Helpers::panic("Called SVC %d", swi);
|
||||
kernel.serviceSVC(swi);
|
||||
}
|
||||
|
||||
void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override {
|
||||
@@ -68,7 +70,7 @@ public:
|
||||
return ticks_left;
|
||||
}
|
||||
|
||||
MyEnvironment(Memory& mem) : mem(mem) {}
|
||||
MyEnvironment(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||
};
|
||||
|
||||
class CPU {
|
||||
@@ -77,7 +79,7 @@ class CPU {
|
||||
Memory& mem;
|
||||
|
||||
public:
|
||||
CPU(Memory& mem);
|
||||
CPU(Memory& mem, Kernel& kernel);
|
||||
void reset();
|
||||
|
||||
void setReg(int index, u32 value) {
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
class Emulator {
|
||||
CPU cpu;
|
||||
Memory memory;
|
||||
Kernel kernel;
|
||||
|
||||
sf::RenderWindow window;
|
||||
static constexpr u32 width = 400;
|
||||
static constexpr u32 height = 240 * 2; // * 2 because 2 screens
|
||||
|
||||
public:
|
||||
Emulator() : window(sf::VideoMode(width, height), "Alber", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 3)),
|
||||
cpu(memory) {
|
||||
kernel(cpu.regs(), memory), cpu(memory, kernel) {
|
||||
reset();
|
||||
window.setActive(true);
|
||||
}
|
||||
|
||||
22
include/kernel.hpp
Normal file
22
include/kernel.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include "helpers.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
namespace SVCResult {
|
||||
enum : u32 {
|
||||
Success = 0
|
||||
};
|
||||
}
|
||||
|
||||
class Kernel {
|
||||
std::array<u32, 16>& regs;
|
||||
Memory& mem;
|
||||
|
||||
public:
|
||||
Kernel(std::array<u32, 16>& regs, Memory& mem) : regs(regs), mem(mem) {}
|
||||
void serviceSVC(u32 svc);
|
||||
void reset();
|
||||
|
||||
void createAddressArbiter();
|
||||
};
|
||||
Reference in New Issue
Block a user