Page 1 of 1
Network card driver in real mode
Posted: Sat Apr 11, 2015 1:33 pm
by Hanz
I have now stable kernel running in real mode and providing lots of important services like working file system.
Now I want to create simple driver for some network card. It looks like it's possible to create network card driver in real mode, but I'm not really sure about that.
So, can anyone tell me is there any network cards that are supported by VirtualBox and are documented so well that it is possible to create driver for them? Maybe Intel 8254x is good place to start, it looks somewhat documented and well supported?
Is it possible to use some BIOS services to detect and/or interact with network cards? Something like PXE?
Can I write PCI driver and use it? Will PCI driver help me to create universal interface for all network cards?
Re: Network card driver in real mode
Posted: Sat Apr 11, 2015 9:05 pm
by KemyLand
Let's face it guys, Real-Mode was a stupid idea that appeared in such a moment that it's still (ab)usable today!
Anyway, I respect your decision, but I don't have (nor I want to have) any information about real-mode NIC interfaces.
Re: Network card driver in real mode
Posted: Sun Apr 12, 2015 12:43 am
by Candy
You can remap PCI devices to other IO spaces, so you should be able to use them. Heck, you can use nearly any PCI device as long as it works with <1M of memory. Try the e1000 or rtl8139, both can work with only 20k of caching or so.
Re: Network card driver in real mode
Posted: Sun Apr 12, 2015 1:38 am
by iansjack
I'd recommend the e1000. It's very well documented and it is fairly trivial to write a driver for it.
Re: Network card driver in real mode
Posted: Sun Apr 12, 2015 2:58 am
by Hanz
I have some problems finding specification sheet for e1000. Could somebody help me?
I have found this (
http://www.intel.com/content/dam/doc/ma ... manual.pdf), but I'm not really sure is this correct. There is also this (
http://lxr.free-electrons.com/source/dr ... 000_main.c) driver, which looks somewhat correct, but if this all is needed, I wouldn't call it
fairly trivial, because it uses more than 5000 lines of C code.
Re: Network card driver in real mode
Posted: Sun Apr 12, 2015 4:08 am
by iansjack
That is the correct manual, and tells you all that you need to know. A simple driver to transmit and receive packets should take a few hundred lines of C code in all (although that is for a protected mode driver - I've no idea what is involved in real mode as I wouldn't dream of using it beyond a boot sector).
DON'T try to reverse engineer the Linux driver. Just read the manual and follow the steps given in it. You may also find this page handy:
http://pdosnew.csail.mit.edu/6.828/2014/labs/lab6/ In fact, you might like to work through that whole project to get some insight into OS development. It's not perfect, but this is Real Life.
In answer to an earlier question, I don't believe there are any standard BIOS calls that can help you with networking.