In plex86 there used to be a basic ne2000 emulation. This was removed 
for clean testing. This patch adds this back in. I changed the code to 
use pluginTriggerIRQ because the pic is now in monito space.

Patch name: add_preliminar_ne2000_support.diff
Author: Martin Dudok van Heel grabbed this from bochs
Date: Wo June 15  2001

Detailed description:
Add preliminar support for ne2000 network card simulation.
For FreeBSD this adds a kind-of-working ne2000 card simulation. Big 
limitation. You can only access the client from other computers on the 
network, not from the host itsself.
For other oses it adds a eth_null device. This is an empty framework 
where the working code has to be built in.
For example. A eth_linux device could be made using the tun kernel module.

Apply patch to:
  current cvs sources
Instructions:
  To patch, go to main plex86 directory.
  Type "patch -p0 < THIS_PATCH_FILE".

----------------------------------------------------------------------
Patch name: add_preliminar_ne2000_support.diff
Author: Martin Dudok van Heel grabbed this from bochs
Date: Wo June 15  2001

Detailed description:
Add preliminar support for ne2000 network card simulation.
For FreeBSD this adds a kind-of-working ne2000 card simulation. Big limitation. You 
can only access the client from other computers on the network, not from the host 
itsself.
For other oses it adds a eth_null device. This is an empty framework where the working 
code has to be built in.
For example. A eth_linux device could be made using the tun kernel module. 

Apply patch to:
  current cvs sources
Instructions:
  To patch, go to main plex86 directory.
  Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
diff -urN ./config.h.in ../plex86_withnetwork/config.h.in
--- ./config.h.in       Mon Jun 11 01:01:31 2001
+++ ../plex86_withnetwork/config.h.in   Thu Jun 14 00:23:18 2001
@@ -107,6 +107,7 @@
 #define BX_USE_SB16_SMF 1  /* Sound (SB 16) */
 #define BX_USE_DEV_SMF  1  /* System Devices (port92) */
 #define BX_USE_PCI_SMF  1  /* PCI */
+#define BX_USE_NE2K_SMF 0  /* NE2K */
  
 #define BX_SUPPORT_SB16 0
  
@@ -141,6 +142,9 @@
    /* low-level CDROM. */
 #  define LOWLEVEL_CDROM cdrom_interface
 #endif
+
+// NE2K network emulation
+#define BX_NE2K_SUPPORT 0
 
 #define COSIMULATE 0
 #define BX_WITH_SDL 0
diff -urN ./configure.in ../plex86_withnetwork/configure.in
--- ./configure.in      Mon Jun 11 01:01:31 2001
+++ ../plex86_withnetwork/configure.in  Thu Jun 14 00:26:45 2001
@@ -57,6 +57,27 @@
 AC_SUBST(COSIM_O)
 AC_SUBST(COSIM_EXTERNAL_LIBS)
 
+AC_MSG_CHECKING(for NE2000 support)
+AC_ARG_ENABLE(ne2000,
+  [  --enable-ne2000                   enable limited ne2000 support],
+  [if test "$enableval" = yes; then
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(BX_NE2K_SUPPORT, 1)
+    NE2K_OBJS='ne2k.o eth.o eth_null.o'
+    AC_CHECK_HEADER(net/bpf.h, NE2K_OBJS="$NE2K_OBJS eth_fbsd.o")
+   else
+    AC_MSG_RESULT(no)
+    AC_DEFINE(BX_NE2K_SUPPORT, 0)
+    NE2K_OBJS=''
+   fi],
+  [
+    AC_MSG_RESULT(no)
+    AC_DEFINE(BX_NE2K_SUPPORT, 0)
+    NE2K_OBJS=''
+    ]
+  )
+AC_SUBST(NE2K_OBJS)
+
 
 
 AC_MSG_CHECKING(for CDROM support)
@@ -249,7 +270,7 @@
 INSTRUMENT_DIR='instrument/'
 VIDEO_OBJS='$(VIDEO_OBJS_VGA)'
 PCI_OBJ=''
-NE2K_OBJS=''
+dnl // NE2K_OBJS=''
 SB16_OBJS=''
 
 AC_SUBST(SUFFIX_LINE)
diff -urN ./user/plugins/bochs/iodev/Makefile.in 
../plex86_withnetwork/user/plugins/bochs/iodev/Makefile.in
--- ./user/plugins/bochs/iodev/Makefile.in      Mon Jun 11 01:01:34 2001
+++ ../plex86_withnetwork/user/plugins/bochs/iodev/Makefile.in  Wed Jun 13 02:59:14 
+2001
@@ -59,7 +59,8 @@
   parallel.o \
   serial.o \
   $(VIDEO_OBJS) \
-  @CDROM_OBJS@
+  @NE2K_OBJS@ \
+  @CDROM_OBJS@ 
 
 
 BX_IODEV_OBJS = $(BX_HW_IODEV_OBJS)
diff -urN ./user/plugins/bochs/iodev/devices.cc 
../plex86_withnetwork/user/plugins/bochs/iodev/devices.cc
--- ./user/plugins/bochs/iodev/devices.cc       Mon Jun 11 01:01:34 2001
+++ ../plex86_withnetwork/user/plugins/bochs/iodev/devices.cc   Wed Jun 13 02:59:14 
+2001
@@ -195,7 +195,7 @@
   ne2k = new bx_ne2k_c();
 #endif
   ne2k->init(this);
-#endif  // #if BX_NE2K_SUPPORT
+#endif  // if BX_NE2K_SUPPORT
 
 #if 0
   // Guest to Host interface.  Used with special guest drivers
diff -urN ./user/plugins/bochs/iodev/eth.cc 
../plex86_withnetwork/user/plugins/bochs/iodev/eth.cc
--- ./user/plugins/bochs/iodev/eth.cc   Mon Jun 11 00:58:32 2001
+++ ../plex86_withnetwork/user/plugins/bochs/iodev/eth.cc       Wed Jun 13 03:58:07 
+2001
@@ -59,14 +59,14 @@
 
 #ifdef ETH_NULL
   {
-    extern bx_null_match;
+    extern class bx_null_locator_c bx_null_match;
     if (!strcmp(type, "null"))
       ptr = (eth_locator_c *) &bx_null_match; 
   }
 #endif
 #ifdef ETH_FBSD
   {
-    extern bx_fbsd_match;
+    extern  class bx_fbsd_locator_c  bx_fbsd_match;
     if (!strcmp(type, "fbsd"))    
       ptr = (eth_locator_c *) &bx_fbsd_match;
   }
diff -urN ./user/plugins/bochs/iodev/ne2k.cc 
../plex86_withnetwork/user/plugins/bochs/iodev/ne2k.cc
--- ./user/plugins/bochs/iodev/ne2k.cc  Mon Jun 11 00:58:32 2001
+++ ../plex86_withnetwork/user/plugins/bochs/iodev/ne2k.cc      Wed Jun 13 03:50:24 
+2001
@@ -177,7 +177,7 @@
       BX_NE2K_THIS s.remote_bytes == 0) {
     BX_NE2K_THIS s.ISR.rdma_done = 1;
     if (BX_NE2K_THIS s.IMR.rdma_inte) {
-      BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
+      raise_interrupt();
     }
   }
 }
@@ -859,7 +859,7 @@
   // Generate an interrupt if not masked and not one in progress
   if (BX_NE2K_THIS s.IMR.tx_inte && !BX_NE2K_THIS s.ISR.pkt_tx) {
     BX_NE2K_THIS s.ISR.pkt_tx = 1;
-    BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
+    raise_interrupt();
   }
   BX_NE2K_THIS s.tx_timer_active = 0;
 }
@@ -1116,7 +1116,7 @@
   BX_NE2K_THIS s.ISR.pkt_rx = 1;
 
   if (BX_NE2K_THIS s.IMR.rx_inte) {
-    BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
+    raise_interrupt();
   }
 
 }
@@ -1194,3 +1194,13 @@
     }
   }
 }
+
+void
+bx_ne2k_c::raise_interrupt()
+{
+//    if (bx_dbg.ne2k )
+//       bx_printf("ne2k: Raising interrupt {%s}\n", DEVICE_TYPE_STRING);
+//  BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
+    pluginTriggerIRQ(BX_NE2K_THIS s.base_irq);
+}
+
diff -urN ./user/plugins/bochs/iodev/ne2k.h 
../plex86_withnetwork/user/plugins/bochs/iodev/ne2k.h
--- ./user/plugins/bochs/iodev/ne2k.h   Mon Jun 11 00:58:32 2001
+++ ../plex86_withnetwork/user/plugins/bochs/iodev/ne2k.h       Wed Jun 13 03:54:33 
+2001
@@ -202,6 +202,8 @@
 
   eth_pktmover_c *ethdev;
 
+  BX_NE2K_SMF void raise_interrupt();
+
   BX_NE2K_SMF void   reset_device(void);
   BX_NE2K_SMF Bit32u read_cr(void);
   BX_NE2K_SMF void   write_cr(Bit32u value);

Reply via email to