Added UDP to Qemu0.90

Yes, I know it’s kinda pointless as it’s horribly out of date, but I’m still having fun. Anyways now it’ll integrate with dynamips!

So yeah, in this example, instead of the usual “-net user” and the built in SLiRP stack, this uses UDP to talk to a stand-alone SLiRP stack. This will let you plug your Qemu into virtual Ethernet switches/hubs and interfaces of virtual routers. Even mixing and matching connections to different emulators that use UDP to exchange packets.

In this case I have a VMDK loaded with a NE2K-PCI driver, and QuakeWorld for MS-DOS. I also made the MPU401 external although it’s hanging on a secondary flag…

qemu.exe -L pc-bios -m 64 -soundhw sb16,adlib -mpu401 xx -net nic,model=ne2k_pci -net socket,udp=127.0.0.1:4000,remote=127.0.0.1:4001 -hda qworld.vmdk

This has the Qemu instance listen on UDP port 4000, and connect to the same physical host on port 4001.

The recipical for the SLiRP stack from my bashed Dynamips is:

slirp_rdr.exe 4001 127.0.0.1 4000

Which in this case listens on port 4001, and connects back on port 4000.

Hopefully it makes some sense to someone.

Download it, if you want!

Download Qemu090b

16 thoughts on “Added UDP to Qemu0.90

  1. Should fit nicely with the original Dynamips/Dynagen combo! I can’t remember at what point udp made it into Qemu (0.11?) but I recall there were some patches for earlier versions and the command syntax for the udp tunnels changed too. Have you ever looked at Pemu, the PIX emulator which is basically a hacked Qemu? I could never get this to build on anything later than GCC 3.4 which is why I keep an old Slackware 11 VM around for tinkering with it.

    • Yes that is my intention of being able to mix simh, dynampis and qemu. Might do previous too!

      The pix is just a PC with a bios set to output to the serial port.. Is there a diff set for pemu?

      It’s probably also reliant on the old IO model like NetWare and NeXTSTEP of 0.90 and so on. The source diff wasn’t too involved but I think I messed something up on git as it’s convinced there was entire file changes…

      • The pemu source is in the gns-3 archive on Sourceforge. URL follows if it doesn’t get spam-filtered…
        sourceforge.net/projects/gns-3/files/Pemu/2008-03-03/
        According to the README it is based on 0.9.0 and it has udp tunnels, due to the nature of the PIX OS it also pegs your CPU core at 100% unless you use cpulimit or something similar. Hope you find it interesting!

        • Interesting support of compressed roms, flash & yes the UDP.

          Also the IDLE is disabled… I guess there is a reason why. Although it does do this:

          SetPriorityClass(GetCurrentProcess(),BELOW_NORMAL_PRIORITY_CLASS);

          I don’t have any old PIX images anymore, so I have to assume there is a reason they do things the way they do.

    • Yes, look for ‘net_socket_udp_init’ in vl.c and you can find it there. Although I’m pretty sure I’ve probably broken the ability to build on Linux along the way with all kinds of changes I’ve done.

      I’m not sure what I screwed up but when I put it in, this diff thinks it’s a wholesale file replacement. :'(

      But once you find what I changed, it’s really small. The UDP stuff didn’t come in until version 1.something, much much later. I hacked in the CLI reading bit, but the network section of net_socket_udp_init is pretty much intact with a bit of massaging to fit into 0.90.

      • Well it’s close – I can build the original 090. I grabbed your snapshot and the only file that fails to build with multiple errors is hw/mpu401.c – maybe I’m missing a header file somewhere. I eventually got it to built by removing references to mpu401 in Makefile.target and hw/pc.c. Target is i386-softmmu, compiler is gcc 3.4.6 on a Centos 6 i686 VM.

        Now I’ll go find something to test it with.

        • not surprising on the mpu401 it includes windows specific stuff with no #ifdef’s….

          I pushed an update that may isolate the Win32 code, let me know if that does the trick.

          • Ok, I installed Debian 4, which is easy to install GCC-3.4 and I made some minor changes and now it’ll build on Linux. I just did the doom test, and quakeworld for MS-DOS although I’m using the normal built in SLiRP.

  2. I have another variation of 0.9.0 I downloaded from somewhere a few years back, the zip is qemu-0.9.1-windows.zip and it contains source, binaries and some patches referred to as Mr.Kazu’s qemu-0.9.0-patches that link back to a defunct .jp website.

  3. Looks like it’s available from here: lassauge.free.fr/qemu/release/

    I’ll try another build later and let you know!

    • After applying my previous fixes (removing references to mpu401 in Makefile.target and hw/pc.c) it now fails with this.

      vl.o: In function `select_mpu401hw':
      /home/nick/qemu090b-010419/vl.c:6671: undefined reference to `MPU401List'
      /home/nick/qemu090b-010419/vl.c:6667: undefined reference to `MPU401List'
      
      • So after I commented out those two lines it builds and runs. Tested with:

        $ qemu -vnc 0.0.0.0:1 -hda dos622.img
        added SLIRP
        adding a [GenuineIntelC] family 5 model 4 stepping 3 CPU
        Could not open '/dev/kqemu' - QEMU acceleration layer not activated
        added 128 megabytes of RAM
        trying to load video rom /home/nick/qrmu090b/share/qemu/vgabios-cirrus.bin
        added parallel port 0x378 7
        added pci_ne2k irq 16
        pci_piix3_ide_init PIIX3 IDE
        ide_init2 [0] s->cylinders 507 s->heads 16 s->sectors 63
        ide_init2 [1] s->cylinders 0 s->heads 0 s->sectors 0
        added PS/2 keyboard
        ps2.c added PS/2 mouse handler
        kbd_init adding PS/2 mouse
        added Floppy Controller 0x3f0 irq 6 dma 2
        installing PS/2 mouse in CMOS
          Bus  0, device   0, function 0:
            Host bridge: PCI device 8086:1237
          Bus  0, device   1, function 0:
            ISA bridge: PCI device 8086:7000
          Bus  0, device   1, function 1:
            IDE controller: PCI device 8086:7010
              BAR4: I/O at 0xffffffff [0x000e].
          Bus  0, device   1, function 3:
            Class 0680: PCI device 8086:7113
              IRQ 0.
          Bus  0, device   2, function 0:
            VGA controller: PCI device 1013:00b8
              BAR0: 32 bit memory at 0xffffffff [0x01fffffe].
              BAR1: 32 bit memory at 0xffffffff [0x00000ffe].
          Bus  0, device   3, function 0:
            Ethernet controller: PCI device 10ec:8029
              IRQ 0.
              BAR0: I/O at 0xffffffff [0x00fe].
        

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.