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

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: 
                     11: #include "mpu.h"
                     12: #include "m68030.h"
                     13: 
                     14: class MPU680x0Device : public MPUDevice
                     15: {
1.1.1.2   root       16:        using inherited = MPUDevice;
1.1       root       17:  public:
                     18:        MPU680x0Device(uint32);
1.1.1.2   root       19:        ~MPU680x0Device() override;
1.1       root       20: 
1.1.1.2   root       21:        bool Init() override;
1.1.1.3   root       22:        void MonitorUpdate(TextScreen&) override;
1.1       root       23: 
1.1.1.2   root       24:        uint32 Run(uint64 request) override;
1.1       root       25: 
                     26:        // 現在の PPC を取得
1.1.1.2   root       27:        uint32 GetPPC() const override { return RegPPC; }
1.1       root       28: 
                     29:        // 現在アクセス中の論理アドレス、物理アドレスを取得。
1.1.1.2   root       30:        uint32 GetLaddr() const override { return cpu->bus.laddr; }
                     31:        uint32 GetPaddr() const override { return cpu->bus.paddr; }
1.1       root       32: 
1.1.1.4 ! root       33:        // アクセスウェイトを加算
        !            34:        void AddCycle(uint64 cycle) override { cpu->total_cycle += cycle; }
        !            35: 
1.1       root       36:        // 割り込み発生を MPU に通知 (オートベクタ)
1.1.1.2   root       37:        void Interrupt(Object *src, int level) override;
1.1       root       38: 
                     39:        // 割り込み発生を MPU に通知 (ベクタ)
1.1.1.2   root       40:        void Interrupt(Object *src, int level, int vector);
1.1       root       41: 
                     42:        // MPU の処理をこの命令で中断させる。
                     43:        // スケジューラのイベントリストに追加が発生した時に VM 側から
                     44:        // MPU へ処理の中断を指示する。
1.1.1.2   root       45:        void Release() override { cpu->atomic_reqflag |= CPU_REQ_RELEASE; }
1.1       root       46: 
                     47:        // 基準サイクル数を取得
1.1.1.2   root       48:        uint64 total_cycle() const override { return cpu->total_cycle; }
1.1       root       49: 
                     50:        // A-Line, F-Line 命令エミュレーションのコールバックを指定する。
                     51:        // (Human68k エミュレーションで使用)
                     52:        void SetALineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
                     53:        void SetFLineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
                     54: 
1.1.1.2   root       55:        // ダブルバスフォールトのコールバックを指定する。
                     56:        void SetHaltCallback(void (*callback)(void*), void *arg);
                     57: 
1.1       root       58:        // FPU を持っているか
                     59:        bool HaveFPU() const {
                     60:                return cpu->has_fpu;
                     61:        }
                     62: 
                     63:        // CPU コアを取得 (主にデバッグ用途)
                     64:        m68kcpu *GetCPU() const {
                     65:                return cpu;
                     66:        }
                     67: 
                     68:  private:
1.1.1.4 ! root       69:        // リセット例外イベントコールバック
        !            70:        void ResetCallback(Event& ev);
        !            71: 
        !            72:        m68kcpu *cpu {};
1.1       root       73: };
                     74: 
                     75: // ATC モニタ
                     76: class MPUATC : public Object
                     77: {
                     78:  public:
                     79:        MPUATC(m68kcpu *cpu);
1.1.1.2   root       80:        ~MPUATC() override { }
1.1       root       81: 
1.1.1.3   root       82:        void MonitorUpdate(TextScreen&) override;
1.1       root       83: 
                     84:  private:
1.1.1.4 ! root       85:        m68kcpu *cpu {};
1.1       root       86: };
                     87: 
                     88: extern std::unique_ptr<MPUATC> gMPUATC;
                     89: 
                     90: #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.