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 zero.rs - a stub that lets Rust programs run almost freestanding. It paints the screen bright red and then hangs. That's it."
Thread beginning with comment 562915
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: I clicked it, I liked it
by Brendan on Mon 27th May 2013 06:21 UTC in reply to "RE[2]: I clicked it, I liked it"
Brendan
Member since:
2005-11-16

Hi,

Only the boot loader is written in Assembly, like in any OS.


Except for https://github.com/charliesome/rustboot/blob/master/runtime.asm . Have you read the code at all?!


- Brendan

Reply Parent Score: 1

moondevil Member since:
2005-07-08

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?!

Reply Parent Score: 2

M.Onty Member since:
2009-10-23

You two enjoying yourselves?!

Reply Parent Score: 9

Brendan Member since:
2005-11-16

Hi,

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