Line 78... |
Line 78... |
except, except_name(except), pcprev, ea, cpu_state.pc, pcnext,
|
except, except_name(except), pcprev, ea, cpu_state.pc, pcnext,
|
cpu_state.pc_delay, runtime.sim.cycles, runtime.cpu.instructions);
|
cpu_state.pc_delay, runtime.sim.cycles, runtime.cpu.instructions);
|
|
|
pcnext = except + (testsprbits (SPR_SR, SPR_SR_EPH) ? 0xf0000000 : 0x00000000);
|
pcnext = except + (testsprbits (SPR_SR, SPR_SR_EPH) ? 0xf0000000 : 0x00000000);
|
|
|
|
cpu_state.sprs[SPR_EEAR_BASE] = ea;
|
|
cpu_state.sprs[SPR_ESR_BASE] = cpu_state.sprs[SPR_SR];
|
|
|
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_OVE; /* Disable overflow flag exception. */
|
|
|
|
cpu_state.sprs[SPR_SR] |= SPR_SR_SM; /* SUPV mode */
|
|
cpu_state.sprs[SPR_SR] &= ~(SPR_SR_IEE | SPR_SR_TEE); /* Disable interrupts. */
|
|
|
|
/* Address translation is always disabled when starting exception. */
|
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_DME;
|
|
cpu_state.sprs[SPR_SR] &= ~SPR_SR_IME;
|
|
|
switch(except) {
|
switch(except) {
|
/* EPCR is irrelevent */
|
/* EPCR is irrelevent */
|
case EXCEPT_RESET:
|
case EXCEPT_RESET:
|
break;
|
break;
|
/* EPCR is loaded with address of instruction that caused the exception */
|
/* EPCR is loaded with address of instruction that caused the exception */
|
Line 112... |
Line 124... |
cpu_state.pc = pcnext;
|
cpu_state.pc = pcnext;
|
pcnext += 4;
|
pcnext += 4;
|
break;
|
break;
|
}
|
}
|
|
|
mtspr(SPR_EEAR_BASE, ea);
|
|
mtspr(SPR_ESR_BASE, mfspr(SPR_SR));
|
|
|
|
/* Address translation is always disabled when starting exception. */
|
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~(SPR_SR_DME));
|
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~(SPR_SR_IME));
|
|
|
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~SPR_SR_OVE); /* Disable overflow flag exception. */
|
|
|
|
mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_SM); /* SUPV mode */
|
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~(SPR_SR_IEE | SPR_SR_TEE)); /* Disable interrupts. */
|
|
|
|
cpu_state.delay_insn = 0;
|
cpu_state.delay_insn = 0;
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|