Annotation of nono/vm/mpu680x0.h, revision 1.1.1.7

1.1       root        1: //
                      2: // nono
1.1.1.2   root        3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
                      7: // MPU (m680x0)
                      8: 
                      9: #pragma once
                     10: 
1.1.1.7 ! root       11: #include "event.h"
1.1       root       12: #include "mpu.h"
                     13: #include "m68030.h"
                     14: 
                     15: class MPU680x0Device : public MPUDevice
                     16: {
1.1.1.2   root       17:        using inherited = MPUDevice;
1.1       root       18:  public:
1.1.1.7 ! root       19:        MPU680x0Device();
1.1.1.5   root       20:        virtual ~MPU680x0Device() override;
1.1       root       21: 
1.1.1.2   root       22:        bool Init() override;
1.1.1.7 ! root       23:        bool PowerOn() override;
        !            24:        void ResetHard() override;
1.1.1.3   root       25:        void MonitorUpdate(TextScreen&) override;
1.1       root       26: 
1.1.1.5   root       27:        // MPU を vtime [nsec] 分実行する
                     28:        uint32 Run(uint32 vtime) override;
                     29: 
                     30:        // 現在の仮想時刻 [nsec] を取得する
1.1.1.6   root       31:        uint64 GetVirtTime() const override;
1.1       root       32: 
                     33:        // 現在の PPC を取得
1.1.1.2   root       34:        uint32 GetPPC() const override { return RegPPC; }
1.1       root       35: 
                     36:        // 現在アクセス中の論理アドレス、物理アドレスを取得。
1.1.1.2   root       37:        uint32 GetLaddr() const override { return cpu->bus.laddr; }
                     38:        uint32 GetPaddr() const override { return cpu->bus.paddr; }
1.1       root       39: 
1.1.1.4   root       40:        // アクセスウェイトを加算
1.1.1.5   root       41:        void AddCycle(int32 cycle) override { cpu->used_cycle += cycle; }
1.1       root       42: 
1.1.1.5   root       43:        // 割り込みレベルが変わったことを MPU に通知
                     44:        void Interrupt(int level) override;
1.1       root       45: 
                     46:        // MPU の処理をこの命令で中断させる。
                     47:        // スケジューラのイベントリストに追加が発生した時に VM 側から
                     48:        // MPU へ処理の中断を指示する。
1.1.1.2   root       49:        void Release() override { cpu->atomic_reqflag |= CPU_REQ_RELEASE; }
1.1       root       50: 
                     51:        // A-Line, F-Line 命令エミュレーションのコールバックを指定する。
                     52:        // (Human68k エミュレーションで使用)
                     53:        void SetALineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
                     54:        void SetFLineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
                     55: 
1.1.1.2   root       56:        // ダブルバスフォールトのコールバックを指定する。
                     57:        void SetHaltCallback(void (*callback)(void*), void *arg);
                     58: 
1.1       root       59:        // FPU を持っているか
                     60:        bool HaveFPU() const {
                     61:                return cpu->has_fpu;
                     62:        }
                     63: 
                     64:        // CPU コアを取得 (主にデバッグ用途)
                     65:        m68kcpu *GetCPU() const {
                     66:                return cpu;
                     67:        }
                     68: 
                     69:  private:
1.1.1.5   root       70:        // イベントコールバック
                     71:        void Callback(Event& ev);
                     72: 
1.1.1.7 ! root       73:        // 割り込み用イベント
        !            74:        Event event {};
        !            75: 
1.1.1.5   root       76:        // 割り込み確定のためのディレイ [nsec]
                     77:        uint64 intdelay {};
1.1.1.4   root       78: 
                     79:        m68kcpu *cpu {};
1.1       root       80: };
                     81: 
                     82: // ATC モニタ
                     83: class MPUATC : public Object
                     84: {
                     85:  public:
                     86:        MPUATC(m68kcpu *cpu);
1.1.1.2   root       87:        ~MPUATC() override { }
1.1       root       88: 
1.1.1.3   root       89:        void MonitorUpdate(TextScreen&) override;
1.1       root       90: 
                     91:  private:
1.1.1.4   root       92:        m68kcpu *cpu {};
1.1       root       93: };
                     94: 
                     95: extern std::unique_ptr<MPUATC> gMPUATC;
                     96: 
                     97: #define gMPU680x0      (dynamic_cast<MPU680x0Device *>(gMPU.get()))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.