
Selfie: tiny self-compiling C compiler, MIPS emulator and MIPS hypervisor - ingve
http://selfie.cs.uni-salzburg.at/
======
eatonphil
This 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.

~~~
david-given
...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
"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
I 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.

------
lisper
In 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.

~~~
nickpsecurity
Yeah, but wasn't TCC designed to be the opposite of easy to understand? It was
entered into the obfuscated, C contest. I'll leave it to a C coder to tell me
if TCC and Selfie are in same ballpark on amateur comprehension.

~~~
masklinn
It was originally an obfuscated C effort, then grew into a full-blown small
and fast compiler for stuff like compiling the linux kernel on the fly during
boot. It's not especially designed for easy source comprehension (so I'd
answer no to your last question) but it's been a long time since it was
specifically designed against it.

~~~
nickpsecurity
@ you and vidar: Appreciate it. That's what I was expecting. It was cool and
small but in a different category given readability didn't matter.

------
int_19h
The 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...

------
hermitdev
This 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.

------
joe563323
The product name should have been different. Searching any development related
issues by product name on search engines will become very difficult.

------
b0013args
first, i thought why another MIPS emulator thing but they offer a RISCV port.
That seems much more interesting. But naming is questionable.

------
qznc
Is there video? A presentation probably sounds hilarious with all the "selfie
selfie selfie mipster hypster mipster" talk.

~~~
komali2
I feel like calling one thing MIPSter and another thing mipster was a poor
choice

------
throwme_1980
cool project, really unfortunate name, reminiscent of 2012

