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

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