Hacks to let the kernel access the CPU and vice versa (TODO: Fix)
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include "kernel.hpp"
|
||||
#include "memory.hpp"
|
||||
|
||||
class CPU;
|
||||
|
||||
class MyEnvironment final : public Dynarmic::A32::UserCallbacks {
|
||||
public:
|
||||
u64 ticksLeft = 0;
|
||||
@@ -89,7 +91,7 @@ public:
|
||||
return ticksLeft;
|
||||
}
|
||||
|
||||
MyEnvironment(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||
MyEnvironment(Memory& mem, Kernel& kernel, CPU& cpu) : mem(mem), kernel(kernel) {}
|
||||
};
|
||||
|
||||
class CPU {
|
||||
|
||||
@@ -28,7 +28,7 @@ class Emulator {
|
||||
|
||||
public:
|
||||
Emulator() : window(sf::VideoMode(width, height), "Alber", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 3)),
|
||||
kernel(cpu.regs(), memory), cpu(memory, kernel) {
|
||||
kernel(cpu, memory), cpu(memory, kernel) {
|
||||
reset();
|
||||
window.setActive(true);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
#include "memory.hpp"
|
||||
#include "services/service_manager.hpp"
|
||||
|
||||
class CPU;
|
||||
|
||||
class Kernel {
|
||||
std::array<u32, 16>& regs;
|
||||
CPU& cpu;
|
||||
Memory& mem;
|
||||
|
||||
// The handle number for the next kernel object to be created
|
||||
@@ -89,11 +92,7 @@ class Kernel {
|
||||
void outputDebugString();
|
||||
|
||||
public:
|
||||
Kernel(std::array<u32, 16>& regs, Memory& mem)
|
||||
: regs(regs), mem(mem), handleCounter(0), serviceManager(regs, mem, currentProcess) {
|
||||
objects.reserve(512); // Make room for a few objects to avoid further memory allocs later
|
||||
portHandles.reserve(32);
|
||||
}
|
||||
Kernel(CPU& cpu, Memory& mem);
|
||||
void serviceSVC(u32 svc);
|
||||
void reset();
|
||||
};
|
||||
Reference in New Issue
Block a user