Hardware Emulation in a Virtual Machine

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Hardware Emulation in a Virtual Machine

Post by 01000101 »

First off, I have only used VirtualPC and real computers to test my OS. But, for the sake of convenience, is there a way to have a virtual machine that has emulated hardware modules?

As an example, is there a way for me to have a virtual 386+ machine with two NE2K complient network cards virtualized?

VPC doesnt give me control over the network cards in my real PC, at least not enough to access them through my OS.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

I dunno about two net cards...but VPC does let you access network and such...but I dunno if it is NE2k complient...
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

It's quite simple to do it under QEMU, I'll show a few examples...

QEMU 8.2, With 1 Realtek 8029(NE2000) and a Reltek 8139..

Code: Select all

qemu -net nic,model=ne2k_pci -net nic,model=rt8139 -fda floppy42.fs -boot a -m 16
This boots a OpenBSD ramdisk kernel.. with 16mb of RAM..

Here are the devices as shown in dmesg...

Code: Select all

ne3 at pci0 dev 3 function 0 "Realtek 8029" rev 0x00: irq 10, address 52:54:00:12:34:56
re0 at pci0 dev 4 function 0 "Realtek 8139" rev 0x20: RTL8139C+ (0x7480), irq 9, address 52:54:00:12:34:57
Also, QEMU emulates DHCP - gateway & DNS.. within the 10/8 subnet 8)

I'm not entirely sure how many cards you can emulate at a time.. but the supported "model=" options are: ne2k_pci, ne2k_isa, rtl8139, smc91c111 and lance.. you can even customize the MAC addresses using "macaddr=".

Have fun.. http://fabrice.bellard.free.fr/qemu/qemu-doc.html :lol:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

perfect.
I've never used that emulator before, but it seems to have way more functionality than VPC. Its even more perfect as right now I am used the rtl8139 chipset as test cards.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Can QEmu do RTL8169 support?
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

vmware lets you use an arbitrary number of network cards. They follow the AMD PCNet II spec.
The cake is a lie | rackbits.com
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Candy wrote:Can QEmu do RTL8169 support?
That adapter is for Gigabit networking, it's rather new.. probably quite complex?

For now, It only supports 10Mbit/100Mbit networking....
ucosty wrote:vmware lets you use an arbitrary number of network cards. They follow the AMD PCNet II spec.
QEMU supports "AMD PCNet" as of 8.2, via the lance option IIRC

You might have to explicitly enable it during ./configure.. probably not default yet.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Well, MS VPC 2007 emulates DEC 21140A 10/100 network card (aka Intel 21140). Win95, 98,... no problem, except for WfW 3.11.

Strangely enough, in QEMU, Win95 guest OS, I had to use the rtl8319 and the drivers from WfW... Win95 didn't recognize properly the NE2k card, also I failed at manual set-up.

Regards
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

Is there a way in BOCHS or QEMU to set up 2 NIC's?? I've figured it out to set ONE up but not two exact same cards.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Brynet-Inc wrote:
Candy wrote:Can QEmu do RTL8169 support?
That adapter is for Gigabit networking, it's rather new.. probably quite complex?
I have the docs, it's a tiny bit easier than the RTL8139. You can tell that they're related by the way - most registers are equal and the access methods (and the bug I have right now that I can't figure out - memory access doesn't work) are equal too.

RTL8139 has four explicit TX descriptors and iirc one or four RX descriptors. The RTL8169 has three queues of descriptors fully in memory accessed as busmaster PCI device - so if you want to send hundreds of packets, it's much easier.
Post Reply