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