diff --git a/bochs/configure.in b/bochs/configure.in index fa16499ef..63f6764e5 100644 --- a/bochs/configure.in +++ b/bochs/configure.in @@ -831,7 +831,7 @@ AC_ARG_ENABLE(pnic, NETLOW_OBJS='' if test "$networking" = yes; then - NETLOW_OBJS='eth.o eth_null.o eth_vnet.o' + NETLOW_OBJS='eth_null.o eth_vnet.o' if test "$MSVC_TARGET" != 1; then AC_CHECK_HEADER(net/bpf.h, [ NETLOW_OBJS="$NETLOW_OBJS eth_fbsd.o" diff --git a/bochs/iodev/Makefile.in b/bochs/iodev/Makefile.in index e084e9fbb..45fb73f49 100644 --- a/bochs/iodev/Makefile.in +++ b/bochs/iodev/Makefile.in @@ -89,6 +89,7 @@ OBJS_THAT_CAN_BE_PLUGINS = \ soundmod.o \ @SOUNDCARD_OBJS@ \ @GAME_OBJS@ \ + netmod.o \ @NE2K_OBJS@ \ @IODEBUG_OBJS@ @@ -149,8 +150,8 @@ libbx_pit_wrap.la: pit82c54.lo pit_wrap.lo libbx_soundmod.la: soundmod.lo $(SOUNDLOW_OBJS:.o=.lo) $(LIBTOOL) --mode=link $(CXX) -module soundmod.lo $(SOUNDLOW_OBJS:.o=.lo) -o libbx_soundmod.la -rpath $(PLUGIN_PATH) $(SOUND_LINK_OPTS) -libbx_ne2k.la: ne2k.lo $(NETLOW_OBJS:.o=.lo) - $(LIBTOOL) --mode=link $(CXX) -module ne2k.lo $(NETLOW_OBJS:.o=.lo) -o libbx_ne2k.la -rpath $(PLUGIN_PATH) +libbx_netmod.la: netmod.lo $(NETLOW_OBJS:.o=.lo) + $(LIBTOOL) --mode=link $(CXX) -module netmod.lo $(NETLOW_OBJS:.o=.lo) -o libbx_netmod.la -rpath $(PLUGIN_PATH) libbx_pcipnic.la: pcipnic.lo $(NETLOW_OBJS:.o=.lo) $(LIBTOOL) --mode=link $(CXX) -module pcipnic.lo $(NETLOW_OBJS:.o=.lo) -o libbx_pcipnic.la -rpath $(PLUGIN_PATH) @@ -181,8 +182,8 @@ bx_pit_wrap.dll: pit82c54.o pit_wrap.o bx_soundmod.dll: soundmod.o $(SOUNDLOW_OBJS) $(CXX) $(CXXFLAGS) -shared -o bx_soundmod.dll soundmod.o $(SOUNDLOW_OBJS) $(WIN32_DLL_IMPORT_LIBRARY) -lwinmm -bx_ne2k.dll: ne2k.o $(NETLOW_OBJS) - $(CXX) $(CXXFLAGS) -shared -o bx_ne2k.dll ne2k.o $(NETLOW_OBJS) $(WIN32_DLL_IMPORT_LIBRARY) +bx_netmod.dll: netmod.o $(NETLOW_OBJS) + $(CXX) $(CXXFLAGS) -shared -o bx_netmod.dll netmod.o $(NETLOW_OBJS) $(WIN32_DLL_IMPORT_LIBRARY) bx_pcipnic.dll: pcipnic.o $(NETLOW_OBJS) $(CXX) $(CXXFLAGS) -shared -o bx_pcipnic.dll pcipnic.o $(NETLOW_OBJS) $(WIN32_DLL_IMPORT_LIBRARY) @@ -264,56 +265,51 @@ es1370.o: es1370.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ ../instrument/stubs/instrument.h ../param_names.h pci.h es1370.h \ soundmod.h soundlnx.h soundwin.h soundosx.h -eth.o: eth.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ - ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ - ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ - ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h eth_fbsd.o: eth_fbsd.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_linux.o: eth_linux.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_null.o: eth_null.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_slirp.o: eth_slirp.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_tap.o: eth_tap.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_tuntap.o: eth_tuntap.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_vde.o: eth_vde.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_vnet.o: eth_vnet.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_win32.o: eth_win32.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h extfpuirq.o: extfpuirq.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -339,8 +335,8 @@ hdimage.o: hdimage.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h hdimage.h vmware3.h \ - vmware4.h vvfat.h + ../instrument/stubs/instrument.h ../param_names.h cdrom.h hdimage.h \ + vmware3.h vmware4.h vvfat.h ioapic.o: ioapic.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -361,7 +357,12 @@ ne2k.o: ne2k.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h pci.h ne2k.h eth.h + ../instrument/stubs/instrument.h ../param_names.h pci.h ne2k.h netmod.h +netmod.o: netmod.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ + ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ + ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ + ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ + ../instrument/stubs/instrument.h ../param_names.h netmod.h parallel.o: parallel.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -475,7 +476,8 @@ svga_cirrus.o: svga_cirrus.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep. ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h vga.h svga_cirrus.h + ../instrument/stubs/instrument.h ../param_names.h vga.h svga_cirrus.h \ + virt_timer.h unmapped.o: unmapped.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -533,7 +535,7 @@ vga.o: vga.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h vga.h + ../instrument/stubs/instrument.h ../param_names.h vga.h virt_timer.h virt_timer.o: virt_timer.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -601,56 +603,51 @@ es1370.lo: es1370.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ ../instrument/stubs/instrument.h ../param_names.h pci.h es1370.h \ soundmod.h soundlnx.h soundwin.h soundosx.h -eth.lo: eth.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ - ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ - ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ - ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h eth_fbsd.lo: eth_fbsd.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_linux.lo: eth_linux.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_null.lo: eth_null.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_slirp.lo: eth_slirp.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_tap.lo: eth_tap.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_tuntap.lo: eth_tuntap.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_vde.lo: eth_vde.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_vnet.lo: eth_vnet.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h eth.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h eth_win32.lo: eth_win32.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h + ../instrument/stubs/instrument.h ../param_names.h netmod.h extfpuirq.lo: extfpuirq.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -676,8 +673,8 @@ hdimage.lo: hdimage.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h hdimage.h vmware3.h \ - vmware4.h vvfat.h + ../instrument/stubs/instrument.h ../param_names.h cdrom.h hdimage.h \ + vmware3.h vmware4.h vvfat.h ioapic.lo: ioapic.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -698,7 +695,12 @@ ne2k.lo: ne2k.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h pci.h ne2k.h eth.h + ../instrument/stubs/instrument.h ../param_names.h pci.h ne2k.h netmod.h +netmod.lo: netmod.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ + ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ + ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ + ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ + ../instrument/stubs/instrument.h ../param_names.h netmod.h parallel.lo: parallel.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -812,7 +814,8 @@ svga_cirrus.lo: svga_cirrus.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h vga.h svga_cirrus.h + ../instrument/stubs/instrument.h ../param_names.h vga.h svga_cirrus.h \ + virt_timer.h unmapped.lo: unmapped.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ @@ -870,7 +873,7 @@ vga.lo: vga.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ ../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \ - ../instrument/stubs/instrument.h ../param_names.h vga.h + ../instrument/stubs/instrument.h ../param_names.h vga.h virt_timer.h virt_timer.lo: virt_timer.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \ ../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \ diff --git a/bochs/iodev/devices.cc b/bochs/iodev/devices.cc index f3cac16f5..30f3f011d 100644 --- a/bochs/iodev/devices.cc +++ b/bochs/iodev/devices.cc @@ -96,6 +96,9 @@ void bx_devices_c::init_stubs() #if BX_SUPPORT_SOUNDLOW pluginSoundModCtl = &stubSoundModCtl; #endif +#if BX_NETWORKING + pluginNetModCtl = &stubNetModCtl; +#endif } void bx_devices_c::init(BX_MEM_C *newmem) @@ -173,6 +176,9 @@ void bx_devices_c::init(BX_MEM_C *newmem) #if BX_SUPPORT_SOUNDLOW PLUG_load_plugin(soundmod, PLUGTYPE_CORE); #endif +#if BX_NETWORKING + PLUG_load_plugin(netmod, PLUGTYPE_CORE); +#endif // PCI logic (i440FX) if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) { diff --git a/bochs/iodev/devices.txt b/bochs/iodev/devices.txt index 86d665a51..f457548db 100644 --- a/bochs/iodev/devices.txt +++ b/bochs/iodev/devices.txt @@ -58,7 +58,7 @@ Attached devices | | +---- NE2000 (ISA/PCI) ne2k.cc, pcipnic.cc | | +---- PCI Pseudo NIC pcipnic.cc | | - | +---- Networking Modules eth.cc + | +---- Networking Modules netmod.cc | | | | | +-- Host specific Modules eth_fbsd.cc, eth_linux.cc, eth_win32.cc | | diff --git a/bochs/iodev/eth_fbsd.cc b/bochs/iodev/eth_fbsd.cc index 4d237d5c6..dcfbde04e 100644 --- a/bochs/iodev/eth_fbsd.cc +++ b/bochs/iodev/eth_fbsd.cc @@ -49,11 +49,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_FBSD -#include "eth.h" - #define LOG_THIS netdev-> #define BX_ETH_FBSD_LOGGING 0 diff --git a/bochs/iodev/eth_linux.cc b/bochs/iodev/eth_linux.cc index 9216fff06..a10118ab0 100644 --- a/bochs/iodev/eth_linux.cc +++ b/bochs/iodev/eth_linux.cc @@ -41,11 +41,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_LINUX -#include "eth.h" - #define LOG_THIS netdev-> extern "C" { diff --git a/bochs/iodev/eth_null.cc b/bochs/iodev/eth_null.cc index 254428991..c4cf57de7 100644 --- a/bochs/iodev/eth_null.cc +++ b/bochs/iodev/eth_null.cc @@ -32,11 +32,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING -#include "eth.h" - #define LOG_THIS netdev-> #define BX_ETH_NULL_LOGGING 1 diff --git a/bochs/iodev/eth_slirp.cc b/bochs/iodev/eth_slirp.cc index 6580af1c4..a9a56bd81 100644 --- a/bochs/iodev/eth_slirp.cc +++ b/bochs/iodev/eth_slirp.cc @@ -24,6 +24,7 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_SLIRP @@ -36,8 +37,6 @@ #include #include /* ntohs, htons */ -#include "eth.h" - #define LOG_THIS netdev-> #define BX_ETH_SLIRP_LOGGING 0 diff --git a/bochs/iodev/eth_tap.cc b/bochs/iodev/eth_tap.cc index 865f24740..f7fbe0f55 100644 --- a/bochs/iodev/eth_tap.cc +++ b/bochs/iodev/eth_tap.cc @@ -84,11 +84,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_TAP -#include "eth.h" - #define LOG_THIS netdev-> #include diff --git a/bochs/iodev/eth_tuntap.cc b/bochs/iodev/eth_tuntap.cc index c58913536..13a8b5e7f 100644 --- a/bochs/iodev/eth_tuntap.cc +++ b/bochs/iodev/eth_tuntap.cc @@ -28,11 +28,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_TUNTAP -#include "eth.h" - #define LOG_THIS netdev-> #include diff --git a/bochs/iodev/eth_vde.cc b/bochs/iodev/eth_vde.cc index d98e9474b..91e4e72e4 100644 --- a/bochs/iodev/eth_vde.cc +++ b/bochs/iodev/eth_vde.cc @@ -29,11 +29,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_VDE -#include "eth.h" - #define LOG_THIS netdev-> #include diff --git a/bochs/iodev/eth_vnet.cc b/bochs/iodev/eth_vnet.cc index 282856824..622bf42ee 100644 --- a/bochs/iodev/eth_vnet.cc +++ b/bochs/iodev/eth_vnet.cc @@ -34,11 +34,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING -#include "eth.h" - #define LOG_THIS netdev-> #define BX_ETH_VNET_LOGGING 1 diff --git a/bochs/iodev/eth_win32.cc b/bochs/iodev/eth_win32.cc index 9afa59d78..a8aa95dfb 100644 --- a/bochs/iodev/eth_win32.cc +++ b/bochs/iodev/eth_win32.cc @@ -38,11 +38,10 @@ #define BX_PLUGGABLE #include "iodev.h" +#include "netmod.h" #if BX_NETWORKING && BX_NETMOD_WIN32 -#include "eth.h" - // windows.h included by bochs.h #define LOG_THIS netdev-> diff --git a/bochs/iodev/iodev.h b/bochs/iodev/iodev.h index fe475781b..6b3edd0e2 100644 --- a/bochs/iodev/iodev.h +++ b/bochs/iodev/iodev.h @@ -396,6 +396,15 @@ public: }; #endif +#if BX_NETWORKING +class BOCHSAPI bx_netmod_ctl_stub_c : public bx_devmodel_c { +public: + virtual void* init_module(bx_list_c *base, void* rxh, bx_devmodel_c *dev) { + STUBFUNC(netmod_ctl, init_module); return NULL; + } +}; +#endif + class BOCHSAPI bx_devices_c : public logfunctions { public: bx_devices_c(); @@ -485,6 +494,9 @@ public: #if BX_SUPPORT_SOUNDLOW bx_soundmod_ctl_stub_c *pluginSoundModCtl; #endif +#if BX_NETWORKING + bx_netmod_ctl_stub_c *pluginNetModCtl; +#endif // stub classes that the pointers (above) can point to until a plugin is // loaded @@ -519,6 +531,9 @@ public: #if BX_SUPPORT_SOUNDLOW bx_soundmod_ctl_stub_c stubSoundModCtl; #endif +#if BX_NETWORKING + bx_netmod_ctl_stub_c stubNetModCtl; +#endif // Some info to pass to devices which can handled bulk IO. This allows // the interface to remain the same for IO devices which can't handle diff --git a/bochs/iodev/ne2k.cc b/bochs/iodev/ne2k.cc index 34512ae0e..6e1018a64 100644 --- a/bochs/iodev/ne2k.cc +++ b/bochs/iodev/ne2k.cc @@ -35,7 +35,7 @@ #include "pci.h" #endif #include "ne2k.h" -#include "eth.h" +#include "netmod.h" //Never completely fill the ne2k ring so that we never // hit the unclear completely full buffer condition. @@ -1509,27 +1509,8 @@ void bx_ne2k_c::init(void) for (int i = 12; i < 32; i++) BX_NE2K_THIS s.macaddr[i] = 0x57; - // Attach to the simulated ethernet dev - const char *ethmod = SIM->get_param_enum("ethmod", base)->get_selected(); - BX_NE2K_THIS ethdev = eth_locator_c::create(ethmod, - SIM->get_param_string("ethdev", base)->getptr(), - (const char *) SIM->get_param_string("macaddr", base)->getptr(), - rx_handler, - this, - SIM->get_param_string("script", base)->getptr()); - - if (BX_NE2K_THIS ethdev == NULL) { - BX_PANIC(("could not find eth module %s", ethmod)); - // if they continue, use null. - BX_INFO(("could not find eth module %s - using null instead", ethmod)); - - BX_NE2K_THIS ethdev = eth_locator_c::create("null", NULL, - (const char *) SIM->get_param_string("macaddr", base)->getptr(), - rx_handler, - this, ""); - if (BX_NE2K_THIS ethdev == NULL) - BX_PANIC(("could not locate null module")); - } + // Attach to the selected ethernet module + BX_NE2K_THIS ethdev = DEV_net_init_module(base, rx_handler, this); } void bx_ne2k_c::set_irq_level(bx_bool level) diff --git a/bochs/iodev/pcipnic.cc b/bochs/iodev/pcipnic.cc index ac845d62c..fb7edc39f 100644 --- a/bochs/iodev/pcipnic.cc +++ b/bochs/iodev/pcipnic.cc @@ -30,7 +30,7 @@ #if BX_SUPPORT_PCI && BX_SUPPORT_PCIPNIC #include "pci.h" -#include "eth.h" +#include "netmod.h" #include "pcipnic.h" #define LOG_THIS thePNICDevice-> @@ -77,28 +77,8 @@ void bx_pcipnic_c::init(void) BX_PNIC_THIS pci_conf[i] = 0x0; } - // This code ripped wholesale from ne2k.cc: - // Attach to the simulated ethernet dev - const char *ethmod = SIM->get_param_enum("ethmod", base)->get_selected(); - BX_PNIC_THIS ethdev = eth_locator_c::create(ethmod, - SIM->get_param_string("ethdev", base)->getptr(), - (const char *) SIM->get_param_string("macaddr", base)->getptr(), - rx_handler, - this, - SIM->get_param_string("script", base)->getptr()); - - if (BX_PNIC_THIS ethdev == NULL) { - BX_PANIC(("could not find eth module %s", ethmod)); - // if they continue, use null. - BX_INFO(("could not find eth module %s - using null instead", ethmod)); - - BX_PNIC_THIS ethdev = eth_locator_c::create("null", NULL, - (const char *) SIM->get_param_string("macaddr", base)->getptr(), - rx_handler, - this, ""); - if (BX_PNIC_THIS ethdev == NULL) - BX_PANIC(("could not locate null module")); - } + // Attach to the selected ethernet module + BX_PNIC_THIS ethdev = DEV_net_init_module(base, rx_handler, this); BX_PNIC_THIS pci_base_address[4] = 0; diff --git a/bochs/plugin.h b/bochs/plugin.h index 74484114a..a33c0a9e8 100644 --- a/bochs/plugin.h +++ b/bochs/plugin.h @@ -59,6 +59,7 @@ extern "C" { #define BX_PLUGIN_SOUNDMOD "soundmod" #define BX_PLUGIN_SB16 "sb16" #define BX_PLUGIN_ES1370 "es1370" +#define BX_PLUGIN_NETMOD "netmod" #define BX_PLUGIN_NE2K "ne2k" #define BX_PLUGIN_EXTFPUIRQ "extfpuirq" #define BX_PLUGIN_PCIVGA "pcivga" @@ -253,9 +254,13 @@ extern "C" { #define DEV_usb_init_device(a,b,c,d) (usbdev_type)bx_devices.pluginUsbDevCtl->init_device(a,b,(void**)c,d) #define DEV_usb_send_msg(a,b) bx_devices.pluginUsbDevCtl->usb_send_msg((void*)a,b) -///////// Sound macro +///////// Sound module macro #define DEV_sound_init_module(a,b,c) bx_devices.pluginSoundModCtl->init_module(a,(void**)b,c) +///////// Networking module macro +#define DEV_net_init_module(a,b,c) \ + ((eth_pktmover_c*)bx_devices.pluginNetModCtl->init_module(a,(void*)b,c)) + ///////// Gameport macro #define DEV_gameport_set_enabled(a) bx_devices.pluginGameport->set_enabled(a) @@ -410,11 +415,12 @@ DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_common) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_uhci) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_ohci) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_xhci) -DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcipnic) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(soundmod) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(es1370) +DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(netmod) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ne2k) +DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcipnic) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(extfpuirq) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(gameport) DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(speaker)