Hello, I was playing with adding Rust embedded in GRUB. I’ve pushed results
to 2 repos:
Module goes to https://github.com/phcoder/grub-rust-hello/tree/master
Changes in GRUB are found at https://github.com/phcoder/GRUB/tree/rust
Notes on implementation:
Only i386-pc is implemented right now but it’s not a technical limit, just
others are not implemented yet.
I changed GRUB to use ET_DYN (.so) binaries as modules instead of ET_REL
(.o).
I disabled mregparm=3. -Z regparm=3 in Rust generally works but the calls
to memcpy() still uses regparm=0 calling convention. Perhaps it’s a bug on
Rust side, perhaps we need an adapter on our side.
It’s compiled with panic=abort. Unwinding panics require
rust_eh_personality that isn’t implemented yet.
src/lib.rs is an example of hello world and grub_lib.rs is a grub-rust
adapter. Ideally they should be in separate crates
Every module now pulls in rust runtime. Idk how to switch to a shared
runtime
Consider it more an experiment and request for comments than a working
product. I would be interested to hear any comments. Especially it’s
interesting to hear from Rust folks as to how to make it more idiomatic
Rust.
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to