1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-16 19:08:08 +00:00

Correctly capture mode upon exception.

This commit is contained in:
Thomas Harte 2024-03-15 18:39:56 -04:00
parent 3a899ea4be
commit c25d0e8843

View File

@ -153,18 +153,21 @@ struct Registers {
}
switch(type) {
case Exception::IRQ:
case Exception::IRQ: {
const auto r14 = pc_status(8);
set_mode(Mode::IRQ);
active_[14] = pc_status(8);
break;
case Exception::FIQ:
active_[14] = r14;
} break;
case Exception::FIQ: {
const auto r14 = pc_status(8);
set_mode(Mode::FIQ);
active_[14] = pc_status(8);
break;
default:
active_[14] = r14;
} break;
default: {
const auto r14 = pc_status(4);
set_mode(Mode::Supervisor);
active_[14] = pc_status(4);
break;
active_[14] = r14;
} break;
}
set_pc(uint32_t(type));