Linked by Thom Holwerda on Sun 26th May 2013 18:48 UTC
OSNews, Generic OSes "A tiny 32 bit kernel written in Rust. I was inspired to download Rust and try to do this after seeing - a stub that lets Rust programs run almost freestanding. It paints the screen bright red and then hangs. That's it."
Permalink for comment 562992
To read all comments associated with this story, please click here.
RE[5]: I clicked it, I liked it
by Brendan on Tue 28th May 2013 04:53 UTC in reply to "RE[4]: I clicked it, I liked it"
Member since:


That can be considered as part of the boot loading process, just clearing the screen before calling the real OS, like any other boot loader.

Do you understand Assembly?!

Yes. See those labels (abort, memcmp, memcpy, etc)? They're unimplemented run-time support that Rust probably needs to compile. If the Rust code wasn't trivial I'd expect that these would need to be implemented.

While we're on the subject of "if the Rust code wasn't trivial" and "real OS"..

For a real OS you'd want to setup the video mode properly, which would require assembly. You'd also need to get a memory map from the BIOS, which would require assembly. You'd need to remap the PIC chips, which would require assembly. You'd need to enable A20, which would require assembly. You'd need to scan physical memory for things (e.g. ACPI tables, etc), which would require assembly.

Then; you'd start the other CPUs, which would require assembly. Next comes memory management and scheduling, which typically involves atomic operations and/or lock-free/block-free algorithms, which would require assembly. Then there's the task switching code, which would require assembly. Of course there's also exception handling, IRQ handling, etc; which would require assembly.

Can you see a pattern here? If the "kernel" wasn't a trivial joke, you'd find Rust being used for glue and not being used for anything that's actually important; especially once you start micro-benchmarking and trying to get performance/scalability close to other OSs.

So; what does this trivial example, with its ~20 lines of Rust and its ~100 lines of assembly, actually show? It shows that assembly is so awesome that it can make Rust "sort of usable". ;)

- Brendan

Reply Parent Score: 3