Page 1 of 1
A TCP/IP stack for an OS written in Assembly
Posted: Mon Apr 01, 2013 8:43 am
by IanSeyler
So BareMetal OS still lacks a TCP/IP stack and it is becoming tiresome of answering requests with "Not yet...".
The $500 bounty didn't pan out so it will most likely be upped. As Assembly is difficult for a lot of people would it be possible to write it in (or port something from) C?
Example: have the Assembly kernel make calls to a C-compiled "blob" attached to it? Not an ideal solution but it would make for a good proof of concept. There were some successes with getting
uIP working as an application but the IP calls should really be part of the kernel.
Thoughts?
Takers?
Re: A TCP/IP stack for an OS written in Assembly
Posted: Mon Apr 01, 2013 10:12 am
by dozniak
What's the exact technical specification?
- IPv4 and/or IPv6?
- TCP congestion control mechanisms supported?
- UDP support included?
- socket interface compatible with BSD or?
- any other important stuff?
Re: A TCP/IP stack for an OS written in Assembly
Posted: Mon Apr 01, 2013 11:12 am
by IanSeyler
Looking to get something functional.. as in a simple web server or telnet client.
IPv4 only
Congestion control not required
UDP is not required (DNS can go via TCP)
Would be nice to have BSD compatibility but not required.
Re: A TCP/IP stack for an OS written in Assembly
Posted: Wed Apr 03, 2013 6:45 am
by Ready4Dis
Do you have a network card driver, or is that required also? What kind of "binary blob" are you looking for, or is there a way to link properly so you can use "normal" function calls/symbols?
Re: A TCP/IP stack for an OS written in Assembly
Posted: Wed Apr 03, 2013 8:20 am
by IanSeyler
I'll be posting a more official request. Currently BareMetal OS supports two Gigabit network chips (Intel and Realtek). Ethernet communication works well. ARP and ICMP are working (or at least were a few builds ago).
The OS can run under VirtualBox and QEMU so no separate physical hardware is required for getting it up and running.
Version 0.6.0 will be released soon. After that it will be time to fully investigate TCP/IP.
Re: A TCP/IP stack for an OS written in Assembly
Posted: Wed Apr 03, 2013 5:56 pm
by pcmattman
Have you considered something like lwIP, if you are now willing to accept C instead of pure assembly?
Re: A TCP/IP stack for an OS written in Assembly
Posted: Thu Apr 04, 2013 12:17 am
by dozniak
pcmattman wrote:Have you considered something like lwIP, if you are now willing to accept C instead of pure assembly?
I think above he stated it's possible to provide a C "blob" with an API to assembly level.
Since ARP and ICMP are already working, would it make sense to make a community effort in making a very basic TCP stack beginnings and then improve it iteratively?
ReturnInfinity, can you post a github repository that we could fork to make iterative improvements? I'm fairly limited in time, given my other commitments, to provide a full implementation. I'd be happy to provide a basic framework that is able to establish a connection though, and leave final polishing to more interested parties.
Re: A TCP/IP stack for an OS written in Assembly
Posted: Thu Apr 04, 2013 12:22 am
by pcmattman
Is lwIP not something you consider to be a community effort?
ARP and ICMP is an hour's work, tops. If there was 90% of TCP already implemented, it might make more sense to not scrap it all and start over. But with just ARP and ICMP, it's not worth reinventing the wheel.
Re: A TCP/IP stack for an OS written in Assembly
Posted: Thu Apr 04, 2013 12:27 am
by dozniak
pcmattman wrote:Is lwIP not something you consider to be a community effort?
ARP and ICMP is an hour's work, tops. If there was 90% of TCP already implemented, it might make more sense to not scrap it all and start over. But with just ARP and ICMP, it's not worth reinventing the wheel.
Depends on how well lwIP integrates into the kernel.
I.e. uIP seems to use a lot of nasty tricks to fit into 8-bit and 16-bit microcontrollers, making it less suitable for a general-purpose TCP/IP stack.
Re: A TCP/IP stack for an OS written in Assembly
Posted: Thu Apr 04, 2013 2:06 am
by bubach
Have you checked MenuetOS networking code by Mike Hibett? Dex used it in his dex-os, so can't be that hard to adapt, and KolibriOS/MenuetOS (32-bit version) is GPL. There must be other Assembly OS's out there with TCP/IP done to learn and study? Or perhaps you do not have the time or energy to put on it, even with source examples. I'll post some links here anyway - in case it helps:
http://code.google.com/p/ostin/source/b ... /stack.asm
http://superdos.rubbermallet.org/tcp_stack_asm/