--- nono/m680x0/m68030mmu.h 2026/04/29 17:04:40 1.1.1.3 +++ nono/m680x0/m68030mmu.h 2026/04/29 17:05:15 1.1.1.6 @@ -6,6 +6,8 @@ #pragma once +class MPU680x0Device; + // ATC_SINGLE は過去との比較のために残してある、双方向リストによる // FC 混合 22 エントリ実装。 // 定義しない場合(デフォルト)は、FC 別の世代付き配列みたいなもの。 @@ -26,12 +28,13 @@ class m68030RP // | TABLE ADDRESS (PA31-PA4) |unused | // +-------------------------------------------------------+-------+ public: + static const uint32 DT_MASK = 0x00000003; static const uint32 H_MASK = 0xffff0003; static const uint32 L_MASK = 0xfffffff0; }; // TT レジスタの各フィールドを束ねた構造体のようなもの。 -// m68kcpu::SetTT(), GetTT() で読み書きする。 +// MPU680x0Device::SetTT(), GetTT() で読み書きする。 class m68030TT { // 3 2 1 0 @@ -58,7 +61,7 @@ class m68030TT uint64 mask {}; // マスク // アクセスがこの TT と一致するか調べる。 - bool Match(uint64 ssw_laddr); + bool Match(uint64 ssw_laddr) const; }; // TC レジスタの各フィールドを束ねた構造体のようなもの。 @@ -167,7 +170,7 @@ struct m68030ATCLine #endif // デバッグ表示 - void fill_print(uint fc); + std::string fill_print(uint fc); }; // ATC のテーブル @@ -177,7 +180,7 @@ class m68030ATCTable final static const int LINES = 22; m68030ATCTable(); - ~m68030ATCTable() { } + ~m68030ATCTable(); #if !defined(ATC_SINGLE) // 空きエントリを取得。 @@ -235,17 +238,17 @@ class m68030ATCTable final // ATC (Address Translation Cache) class m68030ATC final { - friend class MPUATC; + friend class MPU680x0Device; public: - m68030ATC(m68kcpu *); - ~m68030ATC() { } + m68030ATC(MPU680x0Device *); + ~m68030ATC(); // エントリをサーチ&更新 const m68030ATCLine& fill_fetch(); const m68030ATCLine& fill_read(); const m68030ATCLine& fill_write(); // デバッグ用にエントリを検索 - uint64 fill_peek(uint32 laddr, uint fc); + const m68030ATCLine *fill_peek(uint32 laddr, uint fc); // フラッシュ (pflush* 命令から呼ばれる) void flush(); @@ -262,15 +265,5 @@ class m68030ATC final m68030ATCTable tables[1] {}; #endif - m68kcpu *cpu {}; + MPU680x0Device *cpu {}; }; - -extern bool m68030_mmu_translate_fetch(m68kcpu *cpu); -extern bool m68030_mmu_translate_read(m68kcpu *cpu); -extern bool m68030_mmu_translate_write(m68kcpu *cpu); -extern uint64 m68030_mmu_translate_peek(m68kcpu *cpu, uint32 laddr, uint fc, - bool do_search); -extern void mmu_op_pflush(m68kcpu *cpu); -extern void mmu_op_pflush_ea(m68kcpu *cpu); -extern void mmu_op_pload(m68kcpu *cpu); -extern void mmu_op_ptest(m68kcpu *cpu);