|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2017 [email protected]
4: //
5:
6: // MPU (m680x0)
7:
8: #pragma once
9:
10: #include "mpu.h"
11: #include "m68030.h"
12:
13: class MPU680x0Device : public MPUDevice
14: {
15: typedef MPUDevice inherited;
16: public:
17: MPU680x0Device(uint32);
18: virtual ~MPU680x0Device();
19:
20: virtual bool Init();
21: virtual void ResetHard();
22:
23: virtual uint32 Run(uint64 request);
24:
25: virtual bool MonitorUpdate();
26:
27:
28: // 現在の PPC を取得
29: virtual uint32 GetPPC() const { return RegPPC; }
30:
31: // 現在アクセス中の論理アドレス、物理アドレスを取得。
32: virtual uint32 GetLaddr() const { return cpu->bus.laddr; }
33: virtual uint32 GetPaddr() const { return cpu->bus.paddr; }
34:
35: // 割り込み発生を MPU に通知 (オートベクタ)
36: virtual void Interrupt(int level);
37:
38: // 割り込み発生を MPU に通知 (ベクタ)
39: void Interrupt(int level, int vector);
40:
41: // MPU の処理をこの命令で中断させる。
42: // スケジューラのイベントリストに追加が発生した時に VM 側から
43: // MPU へ処理の中断を指示する。
44: virtual void Release() { cpu->atomic_reqflag |= CPU_REQ_RELEASE; }
45:
46: // 基準サイクル数を取得
47: virtual uint64 total_cycle() const { return cpu->total_cycle; }
48:
49: // A-Line, F-Line 命令エミュレーションのコールバックを指定する。
50: // (Human68k エミュレーションで使用)
51: void SetALineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
52: void SetFLineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
53:
54: // FPU を持っているか
55: bool HaveFPU() const {
56: return cpu->has_fpu;
57: }
58:
59: // CPU コアを取得 (主にデバッグ用途)
60: m68kcpu *GetCPU() const {
61: return cpu;
62: }
63:
64: private:
65: m68kcpu *cpu = NULL;
66: };
67:
68: // ATC モニタ
69: class MPUATC : public Object
70: {
71: public:
72: MPUATC(m68kcpu *cpu);
73: virtual ~MPUATC() { }
74:
75: virtual bool MonitorUpdate();
76:
77: private:
78: m68kcpu *cpu = NULL;
79: };
80:
81: // ブランチ履歴モニタ
82: class MPUBrHist : public Object
83: {
84: public:
85: MPUBrHist(m68kcpu *cpu);
86: virtual ~MPUBrHist() { }
87:
88: virtual bool MonitorUpdate();
89:
90: private:
91: m68kcpu *cpu = NULL;
92: };
93:
94: extern std::unique_ptr<MPUATC> gMPUATC;
95: extern std::unique_ptr<MPUBrHist> gMPUBrHist;
96:
97: #define gMPU680x0 (dynamic_cast<MPU680x0Device *>(gMPU.get()))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.