--- nono/m680x0/m68030mmu.h 2026/04/29 17:05:15 1.1.1.6 +++ nono/m680x0/m68030mmu.h 2026/04/29 17:05:22 1.1.1.7 @@ -55,19 +55,27 @@ class m68030TT static const uint32 FCBASE_MASK = 0x00000070; static const uint32 FCMASK_MASK = 0x00000007; - uint32 e {}; // 00008000 イネーブル - uint32 ci {}; // 00000400 キャッシュ禁止 + bool e {}; // イネーブル + bool ci {}; // キャッシュ禁止 uint64 base {}; // ベース uint64 mask {}; // マスク // アクセスがこの TT と一致するか調べる。 - bool Match(uint64 ssw_laddr) const; + bool Match(busaddr addr) const; }; // TC レジスタの各フィールドを束ねた構造体のようなもの。 // m68kcpu::SetTC(), GetTC() で読み書きする。 class m68030TC { + // 3 2 1 0 + // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + // +-+---------+-+-+-------+-------+-------+-------+-------+-------+ + // |E| 0 |S|F| PS | IS | TIA | TIB | TIC | TID | + // +-+---------+-+-+-------+-------+-------+-------+-------+-------+ + // | | +-- FCL (Function Code Lookup Enable) + // | +---- SRE (Supervisor Root Pointer Enable) + // +-- Enable public: static const uint32 MASK = 0x83ffffff; static const uint32 TC_E = 0x80000000; @@ -118,16 +126,17 @@ class m68030MMUSR // ATC の1エントリ struct m68030ATCLine { - // 1エントリはタグとデータの計64ビット。 - // - // タグ + // tag // LLLLLLLL_LLLLLLLL_LLLLLLLL_0000000I : L は論理アドレス // +-- invalid (%1で無効) // // FC はテーブル選択の時点で確定しているのでタグには不要。 // - // データ - // PPPPPPPP_PPPPPPPP_PPPPPPPP_0000BCPM : P は物理アドレス + // paddr + // PPPPPPPP_PPPPPPPP_PPPPPPPP_00000000 : P は物理アドレス + // + // data + // 00000000_00000000_00000000_0000BCPM // |||+-- Modified // ||+--- Write Protect // |+---- Cache Inhibit @@ -229,10 +238,14 @@ class m68030ATCTable final #if !defined(ATC_SINGLE) // LRU 用の更新カウンタ - uint32 counter = 0; + uint32 counter {}; // head のヒット回数。 - uint64 hit_head = 0; + uint64 hit_head {}; #endif + + int loglevel {}; + + MPU680x0Device *cpu {}; }; // ATC (Address Translation Cache) @@ -243,10 +256,13 @@ class m68030ATC final m68030ATC(MPU680x0Device *); ~m68030ATC(); + // ログレベルを設定する。Object のとは同じ使い方だけど別物。 + void SetLogLevel(int loglevel_); + // エントリをサーチ&更新 - const m68030ATCLine& fill_fetch(); - const m68030ATCLine& fill_read(); - const m68030ATCLine& fill_write(); + const m68030ATCLine& fill_fetch(busaddr addr); + const m68030ATCLine& fill_read(busaddr addr); + const m68030ATCLine& fill_write(busaddr addr); // デバッグ用にエントリを検索 const m68030ATCLine *fill_peek(uint32 laddr, uint fc); @@ -265,5 +281,7 @@ class m68030ATC final m68030ATCTable tables[1] {}; #endif + int loglevel {}; + MPU680x0Device *cpu {}; };