--- nono/vm/ethernet.cpp 2026/04/29 17:05:43 1.1.1.11 +++ nono/vm/ethernet.cpp 2026/04/29 17:05:46 1.1.1.12 @@ -24,7 +24,7 @@ EthernetDevice::EthernetDevice(uint obji EthernetDevice::~EthernetDevice() { if ((bool)hostnet) { - hostnet->SetRxCallback(NULL); + hostnet->ResetRxCallback(); } } @@ -32,24 +32,26 @@ EthernetDevice::~EthernetDevice() bool EthernetDevice::Create() { - // ホストドライバを作成してこのデバイスと紐付ける + // ホストドライバを作成してこのデバイスと紐付ける。 + // ポート名は継承先ごとに Init() で設定している。 int n = GetId() - OBJ_ETHERNET0; try { - hostnet.reset(new HostNetDevice(this, n)); + hostnet.reset(new HostNetDevice(this, n, "")); } catch (...) { } if ((bool)hostnet == false) { warnx("Failed to initialize HostNetDevice(%u) at %s", n, __method__); return false; } - hostnet->SetRxCallback(ToDeviceCallback(&EthernetDevice::HostRxCallback)); + auto func = ToDeviceCallback(&EthernetDevice::HostRxCallback); + hostnet->SetRxCallback(func, 0); return true; } // これは Host スレッドから呼ばれる void -EthernetDevice::HostRxCallback() +EthernetDevice::HostRxCallback(uint32 dummy) { // スレッドを超えるためにメッセージを投げる int n = GetId() - OBJ_ETHERNET0;