--- nono/vm/mpu88xx0.h 2026/04/29 17:04:59 1.1.1.10 +++ nono/vm/mpu88xx0.h 2026/04/29 17:05:11 1.1.1.11 @@ -4,10 +4,13 @@ // Licensed under nono-license.txt // -// MPU (m88xx0) +// +// MPU (M88xx0) +// #pragma once +#include "event.h" #include "mpu.h" #include "m88100.h" @@ -19,21 +22,14 @@ class MPU88xx0Device : public MPUDevice virtual ~MPU88xx0Device() override; bool Init() override; - bool PowerOn() override; - void ResetHard() override; - - // MPU を vtime [nsec] 分実行する - uint32 Run(uint32 vtime) override { return cpu->Run(vtime); } - - // 現在の仮想時刻 [nsec] を取得する - uint64 GetVirtTime() const override { return cpu->GetVTime(); } - - // MPU の処理をこの命令で中断させる。 - void Release() override { cpu->Release(); } + void ResetHard(bool poweron) override; // 現在実行中の命令の PC を取得 uint32 GetPPC() const override { return cpu->GetXIP(); } + // 現在の VBR を取得 + uint32 GetVBR() const override { return cpu->GetVBR(); } + // 現在アクセス中の論理アドレス、物理アドレスを取得。 uint32 GetLaddr() const override; uint32 GetPaddr() const override; @@ -62,12 +58,30 @@ class MPU88xx0Device : public MPUDevice uint64 Write16(uint32 addr, uint32 data) override; uint64 Write32(uint32 addr, uint32 data) override; + // コアからスケジューラへの動作モード変更通知 + void NotifyCPUMode(uint32 new_mode); + private: + // リセット例外コールバック + void ResetCallback(Event& ev); + + // 命令実行系コールバック + void ExecNormal(Event& ev); + void ExecStop(Event& ev); + void ExecTrace(Event& ev); + + // トレース設定。デバッガから呼び出される。 + void SetTrace(bool trace_on) override; + // レジスタモニター DECLARE_MONITOR_CALLBACK(MonitorUpdate); Monitor monitor { this }; + // イベントコールバック + EventCallback_t exec_normal {}; + EventCallback_t exec_stop {}; + std::unique_ptr cpu {}; }; -#define gMPU88xx0 (dynamic_cast(gMPU.get())) +#define gMPU88xx0 (dynamic_cast(gMPU))