Network card driver in real mode

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
Hanz
Member
Member
Posts: 29
Joined: Sun Mar 09, 2014 10:14 am

Network card driver in real mode

Post 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?
User avatar
KemyLand
Member
Member
Posts: 213
Joined: Mon Jun 16, 2014 5:33 pm
Location: Costa Rica

Re: Network card driver in real mode

Post 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.
Happy New Code!
Hello World in Brainfuck :D:

Code: Select all

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
[/size]
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Network card driver in real mode

Post 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.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Network card driver in real mode

Post by iansjack »

I'd recommend the e1000. It's very well documented and it is fairly trivial to write a driver for it.
Hanz
Member
Member
Posts: 29
Joined: Sun Mar 09, 2014 10:14 am

Re: Network card driver in real mode

Post 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.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Network card driver in real mode

Post 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.
Post Reply