Handle interrupt return values.

This commit is contained in:
Unknown W. Brackets 2012-12-19 08:10:48 -08:00
parent d6d1f687a8
commit 529818c9cd
2 changed files with 8 additions and 1 deletions

View file

@ -259,7 +259,6 @@ bool __RunOnePendingInterrupt()
__KernelSwitchOffThread("interrupt");
PendingInterrupt pend = pendingInterrupts.front();
pendingInterrupts.pop_front();
intState.save();
pend.handler->copyArgsToCPU(pend);
@ -294,6 +293,12 @@ void __KernelReturnFromInterrupt()
{
DEBUG_LOG(CPU, "Left interrupt handler at %08x", currentMIPS->pc);
inInterrupt = false;
// This is what we just ran.
PendingInterrupt pend = pendingInterrupts.front();
pendingInterrupts.pop_front();
pend.handler->handleResult(currentMIPS->r[MIPS_REG_V0]);
// Restore context after running the interrupt.
intState.restore();
// All should now be back to normal, including PC.

View file

@ -70,6 +70,7 @@ public:
virtual void copyArgsToCPU(const PendingInterrupt &pend) = 0;
virtual void queueUp() = 0;
virtual void queueUpWithArg(int arg) = 0;
virtual void handleResult(int result) = 0;
};
class SubIntrHandler : public AllegrexInterruptHandler
@ -79,6 +80,7 @@ public:
virtual void queueUp();
virtual void queueUpWithArg(int arg);
virtual void copyArgsToCPU(const PendingInterrupt &pend);
virtual void handleResult(int result) {}
bool enabled;
int number;