From 744df7adf33ace0115f1e8f3b53cb80bfed0b77e Mon Sep 17 00:00:00 2001 From: Andrew Tonner Date: Tue, 11 Feb 2020 03:14:23 -0800 Subject: [PATCH] Don't try to receive frames when eth is unloaded on the MacOS side as it will call uninitialized vectors --- BasiliskII/src/Windows/ether_windows.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/Windows/ether_windows.cpp b/BasiliskII/src/Windows/ether_windows.cpp index 8f38d2f0..60a5e67b 100755 --- a/BasiliskII/src/Windows/ether_windows.cpp +++ b/BasiliskII/src/Windows/ether_windows.cpp @@ -101,6 +101,14 @@ static int net_if_type = -1; // Ethernet device type #ifdef SHEEPSHAVER static bool net_open = false; // Flag: initialization succeeded, network device open uint8 ether_addr[6]; // Our Ethernet address + +#else +const bool ether_driver_opened = true; // Flag: Driver is open on MacOS side + // so ether.h layer is ready for + // calls. + // B2 doesn't provide this + // but also calls don't need it + #endif // These are protected by queue_csection @@ -1571,10 +1579,16 @@ unsigned int WINAPI ether_thread_feed_int(void *arg) D(bug("Triggering\n")); looping = true; while(thread_active && looping) { - trigger_queue(); - // Wait for interrupt acknowledge by EtherInterrupt() - WaitForSingleObject(int_ack,INFINITE); - if(thread_active) looping = set_wait_request(); + if (ether_driver_opened) { + trigger_queue(); + // Wait for interrupt acknowledge by EtherInterrupt() + WaitForSingleObject(int_ack,INFINITE); + if(thread_active) looping = set_wait_request(); + } else { + // Ether driver is closed on the MacOS side + // ether.h calls in this case are undefined + Delay_usec(20000); + } } D(bug("Queue empty.\n")); }