6 ms·
Selfie: tiny self-compiling C compiler, MIPS emulator and MIPS hypervisor
- eatonphil 10y agoThis is a really, really cool project. Some fun quotes: > In fact, selfie goes one step further by implementing microkernel functionality as part of the emulator and a hypervisor that can run as part of the emulator, on top of the emulator, and even on top of itself, all with the same code. > The design of the compiler is inspired by the Oberon compiler of Professor Niklaus Wirth from ETH Zurich. The design of the selfie microkernel is inspired by microkernels of Professor Jochen Liedtke from University of Karlsruhe. As someone who is vaguely trying to learn more about / get involved in kernel development, the easiest place to start figuring things out is in simpler kernels like this or Minix. (Then followed by OpenBSD. Then later on NetBSD / FreeBSD. Then much, much further, Linux. [Haven't spent time looking into Illumos yet but it's on the list.]) But I haven't actually been able to contribute much more than ports to any of these yet.
- nickpsecurity 10y agoHere's another one designed for that: https://pdos.csail.mit.edu/6.828/2012/xv6.html https://pdos.csail.mit.edu/6.828/2012/xv6.html
- david-given 10y ago...I have just installed Minix 2 on my new laptop; a 386 with 1MB RAM, running at 16MHz, with a 80MB (with an M) hard drive. In 16-bit mode, it runs beautifully (there's not quite enough RAM for the bigger 32-bit binaries). It's a pretty good Unix, with networking support, cut down versions of all the standard tools, it comes with full source and several toolchains making it almost completely self-hosted, and it'll rebuild its own kernel in 13 minutes. It is beautiful. If you're interested in operating systems, definitely take a look. (There is a Minix 3, but I find it doesn't have the same minimalist charm.) http://minix1.woodhull.com/ http://minix1.woodhull.com/
- nickpsecurity 10y ago"There is a Minix 3, but I find it doesn't have the same minimalist charm" They have same name but aren't really related. Minix 3 is a new OS designed to take place of a modern UNIX with higher reliability. They ported a NetBSD userland to get UNIX apps working. Main benefits are reincarnation server and more code being user-mode (i.e. limiting damage).
- Esau 10y agoI installed Minix 3 the other day in VMWare Fusion virtual machine. It felt a lot like running NetBSD due to the userland reason you mentioned. The one oddity I noticed in my brief testing was that the Minix DHCP client doesn't allow for setting your own hostname, even though NetBSD's does.
- 0xcde4c3db 10y ago> The design of the selfie microkernel is inspired by microkernels of Professor Jochen Liedtke from University of Karlsruhe. It might be worth noting that Liedtke is the architect of the reasonably well-known L4 microkernel. https://en.wikipedia.org/wiki/L4_microkernel_family https://en.wikipedia.org/wiki/L4_microkernel_family
- qznc 10y agoIs there video? A presentation probably sounds hilarious with all the "selfie selfie selfie mipster hypster mipster" talk.
- komali2 10y agoI feel like calling one thing MIPSter and another thing mipster was a poor choice
- throwme_1980 10y agocool project, really unfortunate name, reminiscent of 2012
- b0013args 10y agofirst, i thought why another MIPS emulator thing but they offer a RISCV port. That seems much more interesting. But naming is questionable.
- lisper 10y agoIn a similar vein: tcc, the Tiny C Compiler: http://www.bellard.org/tcc/ http://www.bellard.org/tcc/ 34 kLOC instead of 7, and no fancy VM/kernel stuff, but it does full C99.
- tptacek 10y agoEven more impressive (to my way of thinking) is c4: https://github.com/rswier/c4/blob/master/c4.c https://github.com/rswier/c4/blob/master/c4.c c4 is what you might call a microscopic C compiler; it's surprising how much it does for the code it has.
- dzdt 10y agoC4 handles a similar subset of C to what selfie does, but is a full order of magnitude smaller : about 600 lines. And it is very readable despite the terseness!
- pvg 10y agoThere's a bunch of other stuff in Selfie beyond the C compiler so you can't really compare them by line count.
- rswier 10y agoc4.c author here - selfie seems to fill a niche between c4 and my other more full featured compiler/os swieros. Very cool! https://github.com/rswier/swieros/blob/master/00README.txt https://github.com/rswier/swieros/blob/master/00README.txt
- pvg 10y agoYep, I just meant to point out they're different. Selfie is something educators wrote for their purposes. c4.c is more like a piece of code poetry.
- vidarh 10y ago
- hermitdev 10y agoThis is pretty interesting. Some of things I saw in the source (such as casting string literals to an int) made me cringe a bit, but remembering it is truly a very small subset of C, I'll give it a pass. Overall, the code quality seems pretty high and is very easy to read (I quickly read through maybe 20% of it). I think it'd be easier to follow if it broken up into separate files, but I noticed they didn't implement a preprocessor, so I assume part of the rationale for a single file was to avoid includes, macros and all the other baggage the preprocessor brings with it. I'll definitely have to come back to this project later when I've more time to look at it.
- int_19h 10y agoThe language is interesting. It is a subset of C, indeed - but one notable thing about it is that it only has two types: int, and pointer thereto. If they only made one more step and combined these two into a single machine word type, they'd get B...
- joe563323 10y agoThe product name should have been different. Searching any development related issues by product name on search engines will become very difficult.