--- nono/m88xx0/m88200.cpp 2026/04/29 17:05:26 1.1.1.13 +++ nono/m88xx0/m88200.cpp 2026/04/29 17:05:39 1.1.1.15 @@ -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"; @@ -1987,10 +1988,21 @@ m88200::ReadLine(m88200CacheSet& set, ui 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; + if (__predict_true(r.IsBusErr() == false)) { + parent->AddWait(r.GetWait()); + return 0; + } else { + addr |= BusAddr::Size4; + for (int i = 0; i < 4; i++) { + busdata bd = mainbus->Read(addr); + parent->AddWait(r.GetWait()); + if (__predict_false(bd.IsBusErr())) { + SetFault(FAULT_CODE_BUSERR, addr.Addr()); + return (uint64)-1; + } + set.word[line * 4 + i] = bd.Data(); + addr += 4; + } } return 0; } @@ -2003,10 +2015,19 @@ m88200::CopyBackLine(m88200CacheSet& set { 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; + if (__predict_true(r.IsBusErr() == false)) { + parent->AddWait(r.GetWait()); + return 0; + } else { + addr |= BusAddr::Size4; + for (int i = 0; i < 4; i++) { + busdata bd = mainbus->Write(addr, set.word[line * 4 + i]); + if (__predict_false(bd.IsBusErr())) { + SetFault(FAULT_CODE_BUSERR, addr.Addr()); + return (uint64)-1; + } + addr += 4; + } } return 0; }