From 5251cde04c3306e1439584c37caf3f0fd9a56e41 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sun, 21 Apr 2024 22:54:05 +0200 Subject: [PATCH] HALT and RESET only in kernel mode --- cpu.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 7827463..287951a 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -1627,7 +1627,10 @@ bool cpu::misc_operations(const uint16_t instr) { switch(instr) { case 0b0000000000000000: // HALT - *event = EVENT_HALT; + if (getPSW_runmode() == 0) // only in kernel mode + *event = EVENT_HALT; + else + trap(4); return true; case 0b0000000000000001: // WAIT @@ -1681,8 +1684,11 @@ bool cpu::misc_operations(const uint16_t instr) return true; case 0b0000000000000101: // RESET - b->init(); - init_interrupt_queue(); + if (getPSW_runmode() == 0) { // only in kernel mode + b->init(); + + init_interrupt_queue(); + } return true; }