recover stack when a trap in a trap
This commit is contained in:
parent
77a12c0fa1
commit
8fb77ff4d4
1 changed files with 9 additions and 2 deletions
7
cpu.cpp
7
cpu.cpp
|
@ -1724,8 +1724,15 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
|
|||
if (processing_trap_depth >= 2 && kernel_mode)
|
||||
setRegister(6, 04);
|
||||
|
||||
uint16_t prev_sp = getRegister(6);
|
||||
try {
|
||||
pushStack(before_psw);
|
||||
pushStack(before_pc);
|
||||
}
|
||||
catch(const int exception) {
|
||||
// recover stack
|
||||
setRegister(6, prev_sp);
|
||||
}
|
||||
|
||||
processing_trap_depth = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue