--- nono/vm/mpscc.cpp 2026/04/29 17:05:29 1.1.1.6 +++ nono/vm/mpscc.cpp 2026/04/29 17:05:42 1.1.1.9 @@ -22,6 +22,7 @@ #include "bitops.h" #include "hostcom.h" #include "interrupt.h" +#include "monitor.h" #include "scheduler.h" #include "syncer.h" #include @@ -82,8 +83,11 @@ bool MPSCCDevice::Create() { // 対応するホストドライバを作成 - hostcom.reset(new HostCOMDevice(this, "HostCOM")); + try { + hostcom.reset(new HostCOMDevice(this, "HostCOM")); + } catch (...) { } if ((bool)hostcom == false) { + warnx("Failed to initialize HostCOMDevice at %s", __method__); return false; } hostcom->SetRxCallback(ToDeviceCallback(&MPSCCDevice::HostRxCallback)); @@ -96,18 +100,15 @@ MPSCCDevice::SetLogLevel(int loglevel_) { inherited::SetLogLevel(loglevel_); - assert((bool)hostcom); - hostcom->SetLogLevel(loglevel_); + if ((bool)hostcom) { + hostcom->SetLogLevel(loglevel_); + } } // 初期化 bool MPSCCDevice::Init() { - if (inherited::Init() == false) { - return false; - } - interrupt = GetInterruptDevice(); scheduler->ConnectMessage(MessageID::HOSTCOM_RX, this, @@ -404,7 +405,7 @@ MPSCCDevice::GetSR2B() const stat = 3; // VIS_321 とはビット順が逆 data &= ~0x70; - data |= bitrev(stat << 1); + data |= bitrev8(stat << 1); break; default: VMPANIC("corrupted mpscc.vis=%u", (uint)mpscc.vis);