[GSP::GPU] We can now request interrupts

This commit is contained in:
wheremyfoodat 2022-09-20 23:22:35 +03:00
parent 194761ca54
commit 3ccba6db40
5 changed files with 37 additions and 0 deletions

View file

@ -18,6 +18,7 @@ namespace Result {
void GPUService::reset() {
privilegedProcess = 0xFFFFFFFF; // Set the privileged process to an invalid handle
sharedMem = nullptr;
}
void GPUService::handleSyncRequest(u32 messagePointer) {
@ -63,6 +64,19 @@ void GPUService::registerInterruptRelayQueue(u32 messagePointer) {
mem.write32(messagePointer + 16, KernelHandles::GSPSharedMemHandle);
}
void GPUService::requestInterrupt(GPUInterrupt type) {
if (sharedMem == nullptr) [[unlikely]] { // Shared memory hasn't been set up yet
return;
}
u8 index = sharedMem[0];
u8& interruptCount = sharedMem[1];
u8 flagIndex = (index + interruptCount) % 0x34;
interruptCount++;
sharedMem[0xC + flagIndex] = static_cast<u8>(type);
}
void GPUService::writeHwRegs(u32 messagePointer) {
u32 ioAddr = mem.read32(messagePointer + 4); // GPU address based at 0x1EB00000, word aligned
const u32 size = mem.read32(messagePointer + 8); // Size in bytes