--- nono/vm/interrupt.h 2026/04/29 17:05:06 1.1.1.3 +++ nono/vm/interrupt.h 2026/04/29 17:05:10 1.1.1.4 @@ -4,16 +4,18 @@ // Licensed under nono-license.txt // +// +// 割り込みコントローラ +// + #pragma once #include "device.h" #include "monitor.h" -// -// 割り込みを受け付けるデバイス +// 割り込みを受け付けるデバイス。 // これ自体は IODevice である必要はないが、PEDEC や SysCtlr がこれを // 継承するため。 -// class InterruptDevice : public IODevice { using inherited = IODevice; @@ -22,12 +24,11 @@ class InterruptDevice : public IODevice InterruptDevice(const std::string& objname_); virtual ~InterruptDevice() override; - void ResetHard() override; - // 継承クラスの ResetHard() は保持している割り込み情報を全てキャンセルする。 // 各子デバイスはその ResetHard() で NegateINT() を明示的に呼び出して // 割り込みをキャンセルする必要はなく、もし自身で独自に割り込み信号線の // 状態に関する変数を持っていればそれをクリアするだけでよい。 + void ResetHard(bool poweron) override; // AssertINT()、NegateINT()、ChangeINT() の呼び出し側は、 // (アサート中に AssertINT() を呼ぶというような) 現在の状態が @@ -101,9 +102,7 @@ class InterruptDevice : public IODevice uint64 counter[28] {}; }; -// // m680x0 仮想割り込みコントローラ (共通部) -// class M680x0Interrupt : public InterruptDevice { using inherited = InterruptDevice; @@ -114,7 +113,7 @@ class M680x0Interrupt : public Interrupt M680x0Interrupt(); virtual ~M680x0Interrupt() override; - void ResetHard() override; + void ResetHard(bool poweron) override; protected: void ChangeInterrupt() override; @@ -123,7 +122,6 @@ class M680x0Interrupt : public Interrupt int ipl {}; }; -// // X68k 仮想割り込みコントローラ // // Level @@ -164,7 +162,6 @@ class X68030Interrupt : public M680x0Int Monitor monitor { this }; }; -// // LUNA-I 仮想割り込みコントローラ // // Level @@ -181,6 +178,7 @@ class LunaInterrupt : public M680x0Inter using inherited = M680x0Interrupt; // 割り込みマップ 76543210 + static const uint32 IntmapNMI = 0x80000000; static const uint32 IntmapSIO = 0x08000000; static const uint32 IntmapSysClk = 0x00800000; static const uint32 IntmapLance = 0x00008000; @@ -202,4 +200,4 @@ class LunaInterrupt : public M680x0Inter // LUNA88K は sysctlr.cpp 参照。 -extern std::unique_ptr gInterrupt; +extern InterruptDevice *gInterrupt;