Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What if someone wants to write a kernel with Rust? This might be a very naive question taking into account my ignorance of language and kernel design.


I've done some very preliminary (and bumbling) work with that at https://github.com/ldunn/kern/

It's rudimentary, but it does compile and it does run, and I'm not aware of any particular obstacles to a more featureful kernel.


Look at https://github.com/pcwalton/zero.rs . It's not very far yet, but it proves that it is viable to run Rust without a runtime.


I actually don't think we even need zero.rs anymore. Its purpose was to provide noop implementations for all the "lang items" that the compiler expects to find in the stdlib. However, post-0.7 the compiler no longer requires a lang item to be provided unless you actually use a feature that requires it.

For an example, see the code at https://github.com/doublec/rust-from-c-example , which is fully runtimeless.


zero.rs (or something like it) is still required, because there's certain lang items that are required/useful (e.g. #[start], destructors, failure, vector bounds checks).

(e.g. https://github.com/huonw/rust-malloc/blob/master/zero.rs)


Someone posted https://news.ycombinator.com/item?id=5771276 a few months ago. I'm not sure we could call that a kernel, but it's a first step.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: