--- nono/m88xx0/m88200.cpp 2026/04/29 17:05:22 1.1.1.12 +++ nono/m88xx0/m88200.cpp 2026/04/29 17:05:30 1.1.1.14 @@ -8,6 +8,7 @@ #include "m88200.h" #include "mainbus.h" +#include "monitor.h" #include "mpu88xx0.h" // static 変数 @@ -31,21 +32,21 @@ m88200::m88200(MPU88xx0Device *parent_, ClearAlias(); AddAlias(string_format("CMMU%u", id)); - reg_monitor.func = ToMonitorCallback(&m88200::MonitorUpdateReg); - reg_monitor.SetSize(52, 8); - reg_monitor.Regist(ID_MONITOR_CMMU(id)); + reg_monitor = gMonitorManager->Regist(ID_MONITOR_CMMU(id), this); + reg_monitor->func = ToMonitorCallback(&m88200::MonitorUpdateReg); + reg_monitor->SetSize(52, 8); - atc_monitor.func = ToMonitorCallback(&m88200::MonitorUpdateATC); + atc_monitor = gMonitorManager->Regist(ID_MONITOR_ATC(id), this); + atc_monitor->func = ToMonitorCallback(&m88200::MonitorUpdateATC); #if defined(M88200_STAT) - atc_monitor.SetSize(77, 44 + 5); + atc_monitor->SetSize(77, 44 + 5); #else - atc_monitor.SetSize(77, 44); + atc_monitor->SetSize(77, 44); #endif - atc_monitor.Regist(ID_MONITOR_ATC(id)); - cache_monitor.func = ToMonitorCallback(&m88200::MonitorUpdateCache); - cache_monitor.SetSize(82, 23); - cache_monitor.Regist(ID_SUBWIN_CACHE(id)); + cache_monitor = gMonitorManager->Regist(ID_SUBWIN_CACHE(id), this); + cache_monitor->func = ToMonitorCallback(&m88200::MonitorUpdateCache); + cache_monitor->SetSize(82, 23); // ログ表示用の名前 sapr.name = "SAPR"; @@ -192,14 +193,14 @@ m88200::MonitorUpdateATC(Monitor *, Text screen.Clear(); - screen.Print(0, 0, "SAPR %05x'000 TE=%d %c%c%c", + screen.Print(0, 0, "SAPR %05x'000 TE=%u %c%c%c", (sapr.addr >> 12) & 0xfffff, sapr.enable ? 1 : 0, (sapr.stat & APR_WT) ? 'T' : '-', (sapr.stat & APR_G) ? 'G' : '-', (sapr.stat & APR_CI) ? 'C' : '-'); - screen.Print(40, 0, "UAPR %05x'000 TE=%d %c%c%c", + screen.Print(40, 0, "UAPR %05x'000 TE=%u %c%c%c", (uapr.addr >> 12) & 0xfffff, uapr.enable ? 1 : 0, (uapr.stat & APR_WT) ? 'T' : '-', @@ -218,9 +219,9 @@ m88200::MonitorUpdateATC(Monitor *, Text y = 3; } if (i < 8) { - screen.Print(x, y, " %d:", i); + screen.Print(x, y, " %u:", i); } else { - screen.Print(x, y, "(%d)", i); + screen.Print(x, y, "(%u)", i); } const m88200BATC& b = batc[i]; @@ -254,7 +255,7 @@ m88200::MonitorUpdateATC(Monitor *, Text x = 40; y = 10; } - screen.Print(x, y, "%2d:", i); + screen.Print(x, y, "%2u:", i); const m88200PATC& p = patc[i]; if (p.IsValid()) { @@ -321,7 +322,7 @@ m88200::MonitorUpdateATC(Monitor *, Text void m88200::MonitorUpdateCache(Monitor *, TextScreen& screen) { - int setidx = screen.userdata; + uint setidx = screen.userdata; // 上半分(概要) MonitorCacheOverview(screen, 0, setidx, true); @@ -333,9 +334,9 @@ m88200::MonitorUpdateCache(Monitor *, Te // y は開始オフセット。 // TextScreen は (70, 5) 必要。 void -m88200::MonitorCacheSet(TextScreen& s, int y, int setidx) +m88200::MonitorCacheSet(TextScreen& s, int y, uint setidx) { - assertmsg(0 <= setidx && setidx < setarray.size(), "setidx=%d", setidx); + assertmsg(setidx < setarray.size(), "setidx=%u", setidx); const m88200CacheSet& set = setarray[setidx]; /* @@ -371,7 +372,7 @@ m88200::MonitorCacheSet(TextScreen& s, i attr = TA::Em; break; } - s.Print(0, y, attr, "%d", line); + s.Print(0, y, attr, "%u", line); static const char statusstr[][4] = { "EU", "EM", "SU", "IV" }; s.Print(2, y, attr, "$%05x'%03x %s", (set.tag[line] >> 12), @@ -380,14 +381,14 @@ m88200::MonitorCacheSet(TextScreen& s, i if (set.vv[line] == m88200CacheSet::Status::EM) { // メモリに対してダーティならボールドにする - for (int w = 0; w < 4; w++) { + for (uint w = 0; w < 4; w++) { uint32 addr; uint32 m; addr = (set.tag[line] & 0xfffff000) | (setidx << 4) | (w << 2); - m = (mainbus->Peek8(addr) << 24) - | (mainbus->Peek8(addr + 1) << 16) - | (mainbus->Peek8(addr + 2) << 8) - | (mainbus->Peek8(addr + 3)); + m = (mainbus->Peek1(addr) << 24) + | (mainbus->Peek1(addr + 1) << 16) + | (mainbus->Peek1(addr + 2) << 8) + | (mainbus->Peek1(addr + 3)); if (set.word[line * 4 + w] != m) { attr = TA::Em; } else { @@ -403,7 +404,7 @@ m88200::MonitorCacheSet(TextScreen& s, i } // 順序 - s.Print(58, y, "%d", Lorder[line]); + s.Print(58, y, "%u", Lorder[line]); } } @@ -417,11 +418,11 @@ m88200::MonitorCacheSet(TextScreen& s, i // あるので 1セットごとに間を空けて等間隔にしたい、という違いから。 // TextScreen は CLI なら (70, 17)、GUI なら (82, 17) 必要。 void -m88200::MonitorCacheOverview(TextScreen& s, int y, int cursor, bool is_gui) +m88200::MonitorCacheOverview(TextScreen& s, int y, uint cursor, bool is_gui) { // X ガイド - for (int i = 0; i < 16; i++) { - int x; + for (uint i = 0; i < 16; i++) { + uint x; if (is_gui) { x = 3 + i * 5; } else { @@ -432,16 +433,16 @@ m88200::MonitorCacheOverview(TextScreen& y++; // Y ガイド - for (int i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { s.Print(0, y + i, "%02x", i * 16); } - for (int i = 0; i < setarray.size(); i++) { + for (uint i = 0; i < setarray.size(); i++) { const auto& set = setarray[i]; const char str[] = "EMS-"; - int col = i % 16; - int row = i / 16; - int x; + uint col = i % 16; + uint row = i / 16; + uint x; if (is_gui) { x = 3 + col * 5; } else { @@ -729,7 +730,7 @@ m88200::InvalidatePATC() if (__predict_true((int8)n > 0)) { // PATC#(n-1) n--; - putlog(4, "Invalidate PATCEntry from GG_PAGE n=%d", n); + putlog(4, "Invalidate PATCEntry from GG_PAGE n=%u", n); InvalidatePATCEntry(patc[n]); // 1本ヒットすればこれ以上一致することはないはず } @@ -766,7 +767,7 @@ m88200::InvalidatePATC() if ((p.lpa & mask) == addr) { // 無効化 // XXX 削除した結果穴が空いても詰める処理は未実装 - putlog(4, "Invalidate PATCEntry from GG_* n=%d", i); + putlog(4, "Invalidate PATCEntry from GG_* n=%u", i); InvalidatePATCEntry(p); } } @@ -782,7 +783,7 @@ m88200::SetSCTR(uint32 data) // 全 CMMU について、それぞれスヌープ相手になる CMMU リストを更新。 // どの CMMU の SCTR への書き込みでも毎回全ての CMMU を書き換える。 std::array cmmu {}; - int n = cmmu.size(); + uint n = cmmu.size(); for (int i = 0; i < n; i++) { cmmu[i] = gMainApp.FindObject(OBJ_M88200(i)); } @@ -950,7 +951,7 @@ m88200::SetBATC(uint n, uint32 laddr, ui uint8 pn = atc_hash_all[i]; if ((int8)pn > 0) { pn--; - putlog(4, "Invalidate PATCEntry from SetBATC(%d) n=%d", n, pn); + putlog(4, "Invalidate PATCEntry from SetBATC(%u) n=%u", n, pn); InvalidatePATCEntry(patc[pn]); } } @@ -1008,11 +1009,11 @@ m88200::SetSuper(bool super) { // acc_super は S/U ビットだけだと知っているので OR ではなく代入。 if (super) { - acc_super = busaddr::S; + acc_super = BusAddr::S; acc_apr = &sapr; atc_hash = &atc_hash_all[0x10'0000]; } else { - acc_super = busaddr::U; + acc_super = BusAddr::U; acc_apr = &uapr; atc_hash = &atc_hash_all[0]; } @@ -1029,16 +1030,25 @@ m88200::SetSuper(bool super) busdata m88200::MBusRead(uint32 paddr, int size) { - busaddr baddr(paddr, acc_super); + busaddr baddr = busaddr(paddr) | acc_super | busaddr::Size(size); busdata bd; + // m88k システムに接続しているデバイスはすべて、m68030 システムでいう + // ところのロングワードポートデバイスなので応答は常に 4 バイト分ある。 + bd = mainbus->Read(baddr); + if (size == 4) { - bd = mainbus->Read32(baddr); } else if (size == 2) { - bd = mainbus->Read16(baddr); + if ((paddr & 2) == 0) { + bd >>= 16; + } else { + bd &= 0xffff; + } } else { - bd = mainbus->Read8(baddr); + bd >>= (3 - (paddr & 3)) * 8; + bd &= 0xff; } + parent->AddWait(bd.GetWait()); return bd; } @@ -1049,16 +1059,10 @@ m88200::MBusRead(uint32 paddr, int size) busdata m88200::MBusWrite(uint32 paddr, uint32 data, int size) { - busaddr baddr(paddr, acc_super); + busaddr baddr = busaddr(paddr) | acc_super | busaddr::Size(size); busdata bd; - if (size == 4) { - bd = mainbus->Write32(baddr, data); - } else if (size == 2) { - bd = mainbus->Write16(baddr, data); - } else { - bd = mainbus->Write8(baddr, data); - } + bd = mainbus->Write(baddr, data); parent->AddWait(bd.GetWait()); return bd; } @@ -1103,7 +1107,7 @@ m88200::MBusXmem(uint32 paddr, uint32 da // アクセス関数 // -template uint64 +template uint64 m88200::load(uint32 addr) { uint64 data; @@ -1120,7 +1124,7 @@ m88200::load(uint32 addr) MBusAcquire(); MBusMakeSnoop(acc_paddrH, 0); uint32 paddr = acc_paddrH + acc_paddrL; - busdata bd = MBusRead(paddr, bits / 8); + busdata bd = MBusRead(paddr, size); MBusRelease(); if (__predict_false(bd.IsBusErr())) { putlog(2, "MBus BusError %c:$%08x", @@ -1137,7 +1141,7 @@ m88200::load(uint32 addr) return data; } - if (bits == 8) { + if (size == 1) { switch (acc_paddrL) { case 0: return (data >> 24); @@ -1148,15 +1152,15 @@ m88200::load(uint32 addr) case 3: return data & 0xff; default: - PANIC("corrupted acc_paddrL=%d", acc_paddrL); + PANIC("corrupted acc_paddrL=%u", acc_paddrL); } - } else if (bits == 16) { + } else if (size == 2) { if (acc_paddrL == 0) { return data >> 16; } else { return data & 0xffff; } - } else if (bits == 32) { + } else if (size == 4) { return data; } else { PANIC("bits must be 8, 16, 32"); @@ -1165,24 +1169,24 @@ m88200::load(uint32 addr) } uint64 -m88200::load_8(uint32 addr) +m88200::load_1(uint32 addr) { - return load<8>(addr); + return load<1>(addr); } uint64 -m88200::load_16(uint32 addr) +m88200::load_2(uint32 addr) { - return load<16>(addr); + return load<2>(addr); } uint64 -m88200::load_32(uint32 addr) +m88200::load_4(uint32 addr) { - return load<32>(addr); + return load<4>(addr); } -template uint64 +template uint64 m88200::store(uint32 addr, uint32 data) { acc_laddr = addr; @@ -1195,7 +1199,7 @@ m88200::store(uint32 addr, uint32 data) parent->AddCycle(7); // Table.6-2 MBusAcquire(); MBusMakeSnoop(acc_paddrH, 1); - busdata bd = MBusWrite(paddr, data, bits / 8); + busdata bd = MBusWrite(paddr, data, size); MBusRelease(); if (__predict_false(bd.IsBusErr())) { SetFault(FAULT_CODE_BUSERR, paddr); @@ -1203,29 +1207,29 @@ m88200::store(uint32 addr, uint32 data) } return 0; } else { - return CacheWrite(paddr, data, bits / 8); + return CacheWrite(paddr, data, size); } } uint64 -m88200::store_8(uint32 addr, uint32 data) +m88200::store_1(uint32 addr, uint32 data) { - return store<8>(addr, data); + return store<1>(addr, data); } uint64 -m88200::store_16(uint32 addr, uint32 data) +m88200::store_2(uint32 addr, uint32 data) { - return store<16>(addr, data); + return store<2>(addr, data); } uint64 -m88200::store_32(uint32 addr, uint32 data) +m88200::store_4(uint32 addr, uint32 data) { - return store<32>(addr, data); + return store<4>(addr, data); } -template uint64 +template uint64 m88200::xmem(uint32 addr, uint32 data) { acc_laddr = addr; @@ -1238,7 +1242,7 @@ m88200::xmem(uint32 addr, uint32 data) // XXX キャッシュ禁止領域だとどうなる? MBusAcquire(); MBusMakeSnoop(acc_paddrH, 1); - busdata bd = MBusXmem(paddr, data, bits / 8); + busdata bd = MBusXmem(paddr, data, size); MBusRelease(); if (__predict_false(bd.IsBusErr())) { SetFault(FAULT_CODE_BUSERR, paddr); @@ -1246,20 +1250,20 @@ m88200::xmem(uint32 addr, uint32 data) } return bd.Data(); } else { - return CacheXmem(paddr, data, bits / 8); + return CacheXmem(paddr, data, size); } } uint64 -m88200::xmem_8(uint32 addr, uint32 data) +m88200::xmem_1(uint32 addr, uint32 data) { - return xmem<8>(addr, data); + return xmem<1>(addr, data); } uint64 -m88200::xmem_32(uint32 addr, uint32 data) +m88200::xmem_4(uint32 addr, uint32 data) { - return xmem<32>(addr, data); + return xmem<4>(addr, data); } // @@ -1295,24 +1299,22 @@ m88200::stat2str(uint32 stat) void m88200::DumpATC() { - std::string str; uint8 zero[16] {}; - printf("DumpATC(#%d)\n", id); - for (int i = 0; i < atc_hash_all.size(); i += 16) { + printf("DumpATC(#%u)\n", id); + for (uint i = 0; i < atc_hash_all.size(); i += 16) { const uint8 *a = &atc_hash_all[i]; if (memcmp(a, zero, 16) != 0) { - printf("#%d %c.%08x:", id, - ((i >> 20) ? 'S' : 'U'), (uint32)i << 12); + printf("#%u %c.%08x:", id, ((i >> 20) ? 'S' : 'U'), i << 12); for (int j = 0; j < 16; j++) { uint8 n = a[j]; if (__predict_true(n == 0)) { printf(" "); } else if (__predict_false((int8)n < 0)) { - printf("~%d ", (uint)(uint8)~n); + printf("~%u ", (uint)(uint8)~n); } else { - printf("%-2d ", n - 1); + printf("%-2u ", n - 1); } } printf("\n"); @@ -1383,7 +1385,7 @@ m88200::Translate() batc: m88200BATC& b = batc[n]; assert(b.IsValid()); - putlog(4, " BATC[%d] hit", n); + putlog(4, " BATC[%u] hit", n); batc_hit[n]++; if (b.wp && acc_IsWrite()) { goto write_violation; @@ -1406,7 +1408,7 @@ m88200::Translate() patc_hit++; if (acc_IsWrite() && p.wp) { - putlog(4, " PATC[%d] hit; stat=%s m=%d wp=%d", n, + putlog(4, " PATC[%u] hit; stat=%s m=%u wp=%u", n, stat2str(p.stat).c_str(), p.m, p.wp); goto write_violation; } @@ -1421,7 +1423,7 @@ m88200::Translate() // が立っていないので再びここに来てしまい無限ループになる。 // 誰が間違ってるのか分からないけど、とりあえずここで // PATC[M] を立てれば問題は起きない。 - putlog(4, " PATC[%d] hit; Need to update M bit", n); + putlog(4, " PATC[%u] hit; Need to update M bit", n); p.m = true; // この下の PATC miss に合流する @@ -1432,7 +1434,7 @@ m88200::Translate() // Physical Address <= PFA :: LA[11-2] :: 00 acc_paddrH = p.pfa | (acc_laddr & 0x00000ffc); acc_stat |= p.stat; - putlog(4, " PATC[%d] hit acc=%s paddr=$%08x", n, + putlog(4, " PATC[%u] hit acc=%s paddr=$%08x", n, stat2str(acc_stat).c_str(), acc_paddrH); parent->AddCycle(1); @@ -1770,7 +1772,7 @@ m88200::TranslatePeek(busaddr addr_) con xapr = &uapr; } if (xapr->enable == 0) { - return laddr; + return busaddr(laddr); } la = addr2hash(issuper, laddr); @@ -1782,12 +1784,12 @@ m88200::TranslatePeek(busaddr addr_) con // BATC #(~n) hit n = ~n; const m88200BATC& b = batc[n]; - return b.pba | (laddr & 0x0007ffff); + return busaddr(b.pba | (laddr & 0x0007ffff)); } else { // BATC #(n-1) hit n--; const m88200PATC& p = patc[n]; - return p.pfa | (laddr & 0x00000fff); + return busaddr(p.pfa | (laddr & 0x00000fff)); } // ここからテーブルサーチ @@ -1797,34 +1799,34 @@ m88200::TranslatePeek(busaddr addr_) con // Peek Segment Descriptor desc_addr = xapr->addr | ((laddr >> 20) & ~3U); - data = mainbus->Peek32(desc_addr); + data = mainbus->Peek4(desc_addr); if ((int64)data < 0) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } desc = (uint32)data; if ((desc & DESC_V) == 0) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } if ((desc & DESC_SP) && issuper == false) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } // Peek Page Descriptor desc_addr = (desc & 0xfffff000) | ((laddr >> 10) & 0xffc); - data = mainbus->Peek32(desc_addr); + data = mainbus->Peek4(desc_addr); if ((int64)data < 0) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } desc = (uint32)data; if ((desc & DESC_V) == 0) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } if ((desc & DESC_SP) && issuper == false) { - return busaddr::BusErr | busaddr::TableSearched; + return BusAddr::BusErr | BusAddr::TableSearched; } - busaddr r = (desc & 0xfffff000) | (laddr & 0x00000fff); - r |= busaddr::TableSearched; + busaddr r((desc & 0xfffff000) | (laddr & 0x00000fff)); + r |= BusAddr::TableSearched; return r; } @@ -1835,7 +1837,7 @@ m88200::TranslatePeek(busaddr addr_) con // このラインの状態を更新 void -m88200CacheSet::Update(int line, m88200CacheSet::Status status) +m88200CacheSet::Update(uint line, m88200CacheSet::Status status) { vv[line] = status; if (__predict_false(status == IV)) { @@ -1923,7 +1925,7 @@ m88200CacheSet::SelectOldestLine() const // キャッシュの指定の line, word に data を書き込む。 // size は 1, 2, 4 バイト。 void -m88200CacheSet::Write(int line, uint32 paddr, uint32 data, int size) +m88200CacheSet::Write(uint line, uint32 paddr, uint32 data, uint size) { uint32 wordidx = (paddr >> 2) & 0x03; uint32 data32; @@ -1979,60 +1981,33 @@ m88200CacheSet::Lookup(uint32 tagaddr) c // 成功すれば 0 を返す。 // バスエラーなら fault_code, fault_addr をセットし (uint64)-1 を返す。 uint64 -m88200::ReadLine(m88200CacheSet& set, int line, uint32 tagaddr) +m88200::ReadLine(m88200CacheSet& set, uint line, uint32 tagaddr) { - // キャッシュラインの充填は実機では Burst Read されているらしいが - // nono では Burst Read 用のメソッドは用意しておらず通常の 32bit - // アクセスをしているため、このままでは所要ウェイト数が正しくない。 - // そこでここで差を調整することにする。 - // mainbus->Read32() 4回なのでこれによって 12 wait が加算される。一方 - // 実機の Burst Read は取扱説明書によると 320ns (8 サイクル) で完了 - // するようなので、その差 4 をあらかじめ引いておく。 - // 途中でバスエラーが起きたらとかそこまでは考慮しない。 - // XXX busdata のウェイトどうするか - parent->AddCycle(-4); - // タグを更新 set.tag[line] = tagaddr; - busaddr addr(set.tag[line] | (set.setidx << 4), acc_super); - for (int i = 0; i < 4; i++) { - busdata bd = mainbus->Read32(addr); - if (__predict_false(bd.IsBusErr())) { - SetFault(FAULT_CODE_BUSERR, addr.Addr()); - return (uint64)-1; - } - set.word[line * 4 + i] = bd.Data(); - addr += 4; + busaddr addr = busaddr(set.tag[line] | (set.setidx << 4)) | acc_super; + busdata r = mainbus->ReadBurst16(addr, &set.word[line * 4]); + parent->AddWait(r.GetWait()); + if (__predict_false(r.IsBusErr())) { + SetFault(FAULT_CODE_BUSERR, addr.Addr()); + return (uint64)-1; } return 0; } -// キャッシュの指定の set, line を1ライン、メモリに書き出す(コピーバック)。 +// キャッシュの指定の set, line の1ライン(4word) を書き出す (コピーバック)。 // 成功すれば 0 を返す。 // バスエラーなら fault_code, fault_addr をセットし (uint64)-1 を返す。 uint64 -m88200::CopyBackLine(m88200CacheSet& set, int line) +m88200::CopyBackLine(m88200CacheSet& set, uint line) { - // キャッシュラインの書き出しは実機では Burst Write されているらしいが - // nono では Burst Write 用のメソッドは用意しておらず通常の 32bit - // アクセスをしているため、このままでは所要ウェイト数が正しくない。 - // そこでここで差を調整することにする。 - // mainbus->Write32() 4回なのでこれによって 8 wait が加算される。一方 - // 実機の Burst Write は取扱説明書によると 280ns (7サイクル) で完了する - // ようなので、その差 1 をあらかじめて引いておく。 - // 途中でバスエラーが起きたらとかそこまでは考慮しない。 - // XXX busdata のウェイトどうするか - parent->AddCycle(-1); - - busaddr addr(set.tag[line] | (set.setidx << 4), acc_super); - for (int i = 0; i < 4; i++) { - busdata bd = mainbus->Write32(addr, set.word[line * 4 + i]); - if (__predict_false(bd.IsBusErr())) { - SetFault(FAULT_CODE_BUSERR, addr.Addr()); - return (uint64)-1; - } - addr += 4; + busaddr addr = busaddr(set.tag[line] | (set.setidx << 4)) | acc_super; + busdata r = mainbus->WriteBurst16(addr, &set.word[line * 4]); + parent->AddWait(r.GetWait()); + if (__predict_false(r.IsBusErr())) { + SetFault(FAULT_CODE_BUSERR, addr.Addr()); + return (uint64)-1; } return 0; } @@ -2061,7 +2036,7 @@ m88200::CacheRead(uint32 paddr) line = set.Lookup(tagaddr); if (__predict_true(line >= 0)) { // Cache Hit - putlog(4, " CacheRead hit (line=%d,word=%d)", line, wordidx); + putlog(4, " CacheRead hit (line=%u,word=%u)", line, wordidx); parent->AddCycle(1); goto success; } @@ -2075,7 +2050,7 @@ m88200::CacheRead(uint32 paddr) // Select cache line for replacement line = set.SelectOldestLine(); - putlog(4, " CacheRead miss (replace line=%d)", line); + putlog(4, " CacheRead miss (replace line=%u)", line); if (set.vv[line] == m88200CacheSet::EM) { parent->AddCycle(7); // Table.6-2 @@ -2100,7 +2075,7 @@ m88200::CacheRead(uint32 paddr) // Update cache line set.Update(line, m88200CacheSet::SU); - putlog(4, " CacheRead updated (line=%d,word=%d)", line, wordidx); + putlog(4, " CacheRead updated (line=%u,word=%u)", line, wordidx); success: set.Use(line); return set.word[line * 4 + wordidx]; @@ -2116,7 +2091,7 @@ m88200::CacheRead(uint32 paddr) // エラー要因は fault_code とか参照。 // p.3-10 Figure 3-5 uint64 -m88200::CacheWrite(uint32 paddr, uint32 data, int size) +m88200::CacheWrite(uint32 paddr, uint32 data, uint size) { int line; busdata bd; @@ -2147,7 +2122,7 @@ m88200::CacheWrite(uint32 paddr, uint32 // Select cache line for replacement line = set.SelectOldestLine(); - putlog(4, " CacheWrite miss (replace line=%d)", line); + putlog(4, " CacheWrite miss (replace line=%u)", line); if (set.vv[line] == m88200CacheSet::EM) { parent->AddCycle(7); // Table.6-2 @@ -2201,13 +2176,13 @@ m88200::CacheWrite(uint32 paddr, uint32 // 書き込めれば 0、エラーが起きれば (uint64)-1 を返す。 // p3-11 Figure 3-6 uint64 -m88200::CacheWriteHit(m88200CacheSet& set, int line, - uint32 paddr, uint32 data, int size) +m88200::CacheWriteHit(m88200CacheSet& set, uint line, + uint32 paddr, uint32 data, uint size) { if (__predict_false(set.vv[line] == m88200CacheSet::SU)) { // Line Shared Unmodified の場合 - putlog(4, " CacheWrite hit shared unmodified (line=%d)", line); + putlog(4, " CacheWrite hit shared unmodified (line=%u)", line); // WriteThrough と Global は最後の状態変化だけが違う if ((acc_stat & (DESC_WT | DESC_G))) { @@ -2242,11 +2217,11 @@ m88200::CacheWriteHit(m88200CacheSet& se // どちらでもない場合は Line Exclusive と同じ処理に落ちる } else { // Line Exclusive の場合 - putlog(4, " CacheWrite hit exclusive (line=%d)", line); + putlog(4, " CacheWrite hit exclusive (line=%u)", line); } // Write data into cache - putlog(4, " CacheWrite line=%d $%08x sz=%d", line, paddr, size); + putlog(4, " CacheWrite line=%u $%08x sz=%u", line, paddr, size); set.Write(line, paddr, data, size); // Mark line exclusive modified @@ -2259,7 +2234,7 @@ m88200::CacheWriteHit(m88200CacheSet& se // 成功すれば読み出した値、エラーが起きれば (uint64)-1 を返す。 // p3-13, Figure3-7 uint64 -m88200::CacheXmem(uint32 paddr, uint32 data, int size) +m88200::CacheXmem(uint32 paddr, uint32 data, uint size) { int line; busdata bd; @@ -2277,7 +2252,7 @@ m88200::CacheXmem(uint32 paddr, uint32 d line = set.Lookup(tagaddr); if (__predict_false(line >= 0 && set.vv[line] == m88200CacheSet::EM)) { // Cache Hit (and Line exclusive modified) - putlog(4, " CacheXmem hit and EM (line=%d)", line); + putlog(4, " CacheXmem hit and EM (line=%u)", line); MBusAcquire(); @@ -2294,7 +2269,7 @@ m88200::CacheXmem(uint32 paddr, uint32 d if (line >= 0) { // Cache Hit and Otherwise (= !EM) - putlog(4, " CacheXmem hit but !EM (line=%d)", line); + putlog(4, " CacheXmem hit but !EM (line=%u)", line); set.Update(line, m88200CacheSet::IV); } else { putlog(4, " CacheXmem miss"); @@ -2335,7 +2310,7 @@ m88200::MBusAcquire() // いる他 CMMU が必要に応じて反応するのだが、ここでは全部マスタ主導で行う。 // Figure 3-8, 3-9 void -m88200::MBusMakeSnoop(uint32 paddr, int im) +m88200::MBusMakeSnoop(uint32 paddr, uint im) { if ((acc_stat & DESC_G) == 0) { return; @@ -2365,7 +2340,7 @@ m88200::MBusMakeSnoop(uint32 paddr, int // こっちはそのマスタから呼ばれるスレーブ側。 // Figure 3-8, 3-9 void -m88200::Snoop(uint32 paddr, int im) +m88200::Snoop(uint32 paddr, uint im) { assert((sctr & SCTR_SE));