4 ms·
Combine this with one of those tiny self-compiling C compilers that were the subject of a few HN articles recently (e.g. https://news.ycombinator.com/item?id=85
by userbinator 12y ago
Combine this with one of those tiny self-compiling C compilers that were the subject of a few HN articles recently (e.g. https://news.ycombinator.com/item?id=8576068 https://news.ycombinator.com/item?id=8576068, https://news.ycombinator.com/item?id=8558822 https://news.ycombinator.com/item?id=8558822) and this could be one of the more interesting minimal self-hosting OSs someone could understand the entirety of in a relatively short amount of time. I like how it supports multiprocessing too, and the entire kernel is <100 pages in the source code PDF.
However, I wish they'd use something other than GAS for the Asm parts... a minimal self-assembling assembler (and a C-subset compiler written in it, to bootstrap the whole thing) would be nice.
- webkike 12y agoNone of the tiny self-compiling C compilers could possibly used to compile xv6, as none of them implement structures (arguably the hardest part of compiling C code).
- lamacase 12y agoThe guy who did the C4 compiler also has a more fully featured one that does support structures: https://github.com/rswier/swieros/blob/master/root/bin/c.c https://github.com/rswier/swieros/blob/master/root/bin/c.c It's part of an OS he's building based on xv6
- webkike 12y agoVery cool, although this implementation is significantly less trivial than C4. The difference is over a thousand lines!
- deleted 12y ago[deleted]
- deleted 12y ago[deleted]
- arto 12y agoLICE is a public-domain C99 compiler in about 10 KLOC: http://gmqcc.qc.to/cgit/cgit.cgi/LICE.git/tree/README.md http://gmqcc.qc.to/cgit/cgit.cgi/LICE.git/tree/README.md
- e12e 12y agoThere's also TCC which at one point was able to compile (a somewhat patched version of) the Linux kernel. Also c99, but I thibk it might be closer to 20kloc these days?
- agumonkey 12y agoAlso F.Bellard mentioned that even if the kernel can boot userspace, he never investigated if they were bugs but was pretty sure they exist.
- 101914 12y agoPerhaps Bruce Evans' C compiler, linker and assembler? It worked well enough to compile early Linux kernels.