--- nono/vm/interrupt.cpp 2026/04/29 17:05:24 1.1.1.9 +++ nono/vm/interrupt.cpp 2026/04/29 17:05:37 1.1.1.12 @@ -30,20 +30,21 @@ // | | +---------------+ // | | // | | +------------------+ -// | +--| Virt68kInterrupt | (virt68k の割り込みコントローラ) +// | +--| Virt68kInterrupt | (virt-m68k の割り込みコントローラ) // | +------------------+ // | // +-- PEDECDevice (X68030 の Lv1 担当コントローラ) // +-- SysCtlrDevice (LUNA-88K の割り込みコントローラ) -// +-- GFPICDevice (virt68k の各レベル担当コントローラ) +// +-- GFPICDevice (virt-m68k の各レベル担当コントローラ) #include "interrupt.h" #include "dmac.h" #include "goldfish_pic.h" #include "lance.h" #include "pedec.h" -#include "m68030.h" +#include "m680x0.h" #include "mfp.h" +#include "monitor.h" #include "mpu680x0.h" #include "newsctlr.h" #include "nmi.h" @@ -64,7 +65,7 @@ InterruptDevice::InterruptDevice() } // コンストラクタ(オブジェクト名指定あり) -InterruptDevice::InterruptDevice(int objid_) +InterruptDevice::InterruptDevice(uint objid_) : inherited(objid_) { } @@ -193,26 +194,15 @@ M680x0Interrupt::~M680x0Interrupt() bool M680x0Interrupt::Init() { - if (inherited::Init() == false) { - return false; - } - mpu680x0 = GetMPU680x0Device(mpu); return true; } -// リセット -void -M680x0Interrupt::ResetHard(bool poweron) -{ - inherited::ResetHard(poweron); -} - void M680x0Interrupt::ChangeInterrupt() { - int newipl; + uint newipl; // intmap_status は最下位ビットを常に立ててあるので 0 にならない newipl = (uint)(31 - __builtin_clz(intmap_status)) / 4; @@ -232,8 +222,8 @@ M680x0Interrupt::ChangeInterrupt() // コンストラクタ X68030Interrupt::X68030Interrupt() { - monitor.func = ToMonitorCallback(&X68030Interrupt::MonitorUpdate); - monitor.Regist(ID_MONITOR_INTERRUPT); + monitor = gMonitorManager->Regist(ID_MONITOR_INTERRUPT, this); + monitor->func = ToMonitorCallback(&X68030Interrupt::MonitorUpdate); } // デストラクタ @@ -287,7 +277,7 @@ X68030Interrupt::Init() disp_list.push_back((uint32)IntmapPEDEC); // 行数が確定したのでサイズ設定 - monitor.SetSize(41, 1 + disp_list.size() + 5/*PEDEC*/); + monitor->SetSize(41, 1 + disp_list.size() + 5/*PEDEC*/); return true; } @@ -325,7 +315,7 @@ X68030Interrupt::InterruptAcknowledge(in break; } - return busdata::BusErr; + return BusData::BusErr; } void @@ -345,13 +335,13 @@ X68030Interrupt::MonitorUpdate(Monitor * // SPC Mask y = 0; - screen.Print(0, y, "Lv Device IM=%d", intr_mask); + screen.Print(0, y, "Lv Device IM=%u", intr_mask); screen.Puts(36, y, "Count"); y++; for (uint32 map : disp_list) { int clz = __builtin_clz(map); int lv = (31 - clz) / 4; - screen.Print(0, y, "%d", lv); + screen.Print(0, y, "%u", lv); screen.Puts(3, y, TA::OnOff(intmap_status & map), GetIntName(map)); if (lv <= intr_mask) { screen.Puts(11, y, "Mask"); @@ -372,8 +362,8 @@ X68030Interrupt::MonitorUpdate(Monitor * // コンストラクタ LunaInterrupt::LunaInterrupt() { - monitor.func = ToMonitorCallback(&LunaInterrupt::MonitorUpdate); - monitor.Regist(ID_MONITOR_INTERRUPT); + monitor = gMonitorManager->Regist(ID_MONITOR_INTERRUPT, this); + monitor->func = ToMonitorCallback(&LunaInterrupt::MonitorUpdate); } // デストラクタ @@ -410,7 +400,7 @@ LunaInterrupt::Init() }; // 行数が確定したのでサイズ設定 - monitor.SetSize(40, 1 + disp_list.size()); + monitor->SetSize(40, 1 + disp_list.size()); return true; } @@ -439,13 +429,13 @@ LunaInterrupt::MonitorUpdate(Monitor *, // 1 XP(Hi) Mask01234567890123456789012345 y = 0; - screen.Print(0, y, "Lv Device IM=%d", intr_mask); + screen.Print(0, y, "Lv Device IM=%u", intr_mask); screen.Puts(35, y, "Count"); y++; for (uint32 map : disp_list) { int clz = __builtin_clz(map); int lv = (31 - clz) / 4; - screen.Print(0, y, "%d", lv); + screen.Print(0, y, "%u", lv); screen.Puts(3, y, TA::OnOff(intmap_status & map), GetIntName(map)); if (lv <= intr_mask) { screen.Puts(10, y, "Mask"); @@ -463,8 +453,8 @@ LunaInterrupt::MonitorUpdate(Monitor *, // コンストラクタ NewsInterrupt::NewsInterrupt() { - monitor.func = ToMonitorCallback(&NewsInterrupt::MonitorUpdate); - monitor.Regist(ID_MONITOR_INTERRUPT); + monitor = gMonitorManager->Regist(ID_MONITOR_INTERRUPT, this); + monitor->func = ToMonitorCallback(&NewsInterrupt::MonitorUpdate); } // デストラクタ @@ -496,7 +486,7 @@ NewsInterrupt::Init() }; // 行数が確定したのでサイズ設定 - monitor.SetSize(40, 1 + disp_list.size()); + monitor->SetSize(40, 1 + disp_list.size()); return true; } @@ -547,13 +537,13 @@ NewsInterrupt::MonitorUpdate(Monitor *, // 1 XP(Hi) Mask01234567890123456789012345 y = 0; - screen.Print(0, y, "Lv Device IM=%d", intr_mask); + screen.Print(0, y, "Lv Device IM=%u", intr_mask); screen.Puts(35, y, "Count"); y++; for (uint32 map : disp_list) { int clz = __builtin_clz(map); int lv = (31 - clz) / 4; - screen.Print(0, y, "%d", lv); + screen.Print(0, y, "%u", lv); screen.Puts(3, y, TA::OnOff(intmap_status & map), GetIntName(map)); if (lv <= intr_mask) { screen.Puts(10, y, "Mask"); @@ -565,14 +555,14 @@ NewsInterrupt::MonitorUpdate(Monitor *, // -// virt68k 仮想割り込みコントローラ +// virt-m68k 仮想割り込みコントローラ // // コンストラクタ Virt68kInterrupt::Virt68kInterrupt() { - monitor.func = ToMonitorCallback(&Virt68kInterrupt::MonitorUpdate); - monitor.Regist(ID_MONITOR_INTERRUPT); + monitor = gMonitorManager->Regist(ID_MONITOR_INTERRUPT, this); + monitor->func = ToMonitorCallback(&Virt68kInterrupt::MonitorUpdate); } // デストラクタ @@ -617,7 +607,7 @@ Virt68kInterrupt::Init() // ここまでの行数でサイズ設定。 // この後各割り込みソースの Init() から GFPIC への RegistIRQ() する // たびに増やされていく。 - monitor.SetSize(77, 2 + disp_list.size() + 1); + monitor->SetSize(77, 2 + disp_list.size() + 1); return true; } @@ -625,8 +615,8 @@ Virt68kInterrupt::Init() void Virt68kInterrupt::IncMonitorHeight() { - auto size = monitor.GetSize(); - monitor.SetSize(size.width, size.height + 1); + auto size = monitor->GetSize(); + monitor->SetSize(size.width, size.height + 1); } // 割り込みアクノリッジに応答する @@ -659,14 +649,14 @@ Virt68kInterrupt::MonitorUpdate(Monitor // E:Enable D:Disable .:NotConnected y = 0; - screen.Print(0, y, "Lv Device IM=%d IRQ 20 10 1", + screen.Print(0, y, "Lv Device IM=%u IRQ 20 10 1", intr_mask); screen.Puts(72, y, "Count"); y++; for (uint32 map : disp_list) { - int clz = __builtin_clz(map); - int lv = (31 - clz) / 4; - screen.Print(0, y, "%d", lv); + uint clz = __builtin_clz(map); + uint lv = (uint)(31 - clz) / 4; + screen.Print(0, y, "%u", lv); screen.Puts(3, y, TA::OnOff(intmap_status & map), GetIntName(map)); if (lv <= intr_mask) { screen.Puts(10, y, "Mask");