Line 56... |
Line 56... |
|
|
/* Handles the reporting of an interrupt if it had to be delayed */
|
/* Handles the reporting of an interrupt if it had to be delayed */
|
void pic_clock(void *dat)
|
void pic_clock(void *dat)
|
{
|
{
|
/* Don't do anything if interrupts not currently enabled */
|
/* Don't do anything if interrupts not currently enabled */
|
if(testsprbits (SPR_SR, SPR_SR_IEE))
|
if(testsprbits (SPR_SR, SPR_SR_IEE)) {
|
|
TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
|
except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
|
except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
|
else
|
} else if(testsprbits (SPR_PICSR, (int)dat))
|
SCHED_ADD(pic_clock, NULL, 1);
|
/* Reschedule only if the interrupt hasn't been cleared */
|
|
SCHED_ADD(pic_clock, dat, 1);
|
}
|
}
|
|
|
/* WARNING: Don't eaven try and call this function *during* a simulated
|
/* WARNING: Don't eaven try and call this function *during* a simulated
|
* instruction!! (as in during a read_mem or write_mem callback). except_handle
|
* instruction!! (as in during a read_mem or write_mem callback). except_handle
|
* assumes that this is the case, it breaks otherwise. */
|
* assumes that this is the case, it breaks otherwise. */
|
Line 83... |
Line 85... |
if (testsprbits (SPR_SR, SPR_SR_IEE)) {
|
if (testsprbits (SPR_SR, SPR_SR_IEE)) {
|
TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
|
TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
|
except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
|
except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE));
|
} else
|
} else
|
/* Interrupts not currently enabled, retry next clock cycle */
|
/* Interrupts not currently enabled, retry next clock cycle */
|
SCHED_ADD(pic_clock, NULL, 1);
|
SCHED_ADD(pic_clock, (void *)line, 1);
|
}
|
}
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|