On Mon, Feb 19, 2024 at 5:43 AM Benjamin Lamowski benjamin.lamowski@genode-labs.com wrote:
Hi Nathan,
Thanks for your interest in Genode and Rust!
On the last rust update, it seemed like the Genode team determined one of the next steps would be to explore rust on top of native Genode framework. Would there be a project that would be able to help achieve this goal?
We don't have a clear path towards native Genode components in Rust, because a native Rust Genode API would depend on a Genode ABI (Application Binary Interface), for which we don't have a clear vision yet. Right now, the Genode interfaces are defined by their C++ implementation (supplemented with a Genode C API for the narrow scope of porting device drivers). Therefore adding native Rust bindings would entail defining a Genode ABI so that the Rust API can be implemented independently from the C++ implementation.
I thought of working with the Gnode api to create a transition layer
so that components written in rust can directly work with the api. Would this be a project be helpful or would something else be more appropriate?
Our road map[1] goal of Rust-based components for an email scenario is meant as an opportunity to venture from components that run purely on the libc / POSIX ABI towards incorporating native interfaces. In that, your suggestion goes in the right direction. However, instead of attempting to create a whole transition layer, I would suggest that you approach this from building a specific Genode component. Get the examples from the Genode Foundations book[2] to work if you haven't already, then build a libc-based Rust package with Goa (see [3] for an example) and explore creating the necessary bindings for a native Rust component from there.
Maybe others from the Genode team can share their perspective on this, but from previous discussions within Genode Labs (cf. this mailing list post: [4]), my hunch is that if we build an official Genode Rust API, it will be implemented from scratch on a future Genode ABI. Rust bindings based on Rust's FFI will likely play a role on the path towards this goal, so we welcome you experimenting with this. Just be advised that a sort of "genode-rs" translation layer that is based on a FFI to the C++ API is unlikely to be the long term solution that we at Genode Labs will endorse.
I hope this clarifies our vision for Rust on Genode a bit. Enjoy experimenting!
Best wishes, Ben
[1] https://genode.org/about/road-map [2] https://genode.org/documentation/genode-foundations/23.05/getting_started/He... [3] https://genodians.org/atopia/2023-10-26-a-first-complex-rust-package [4] https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/mes...
I must say I was rather pleased and impressed by my initial impressions of the work that Nick Spinale (CC'd) has done on rust-native interfaces within the seL4 ecosystem. In particular, he has illustrated one possible manifestation of what ergonomic APIs might look like in rust for event-driven, capability-oriented, component-based systems, and also proven a viable path with incremental milestones towards an increasingly capable rust-native runtime environment, with sensible layering of dependencies, etc. within a system in somewhat similar spirit to Genode. I highly recommend taking a look for inspiration.
Reasonable entry-points might be: - https://github.com/seL4/rust-sel4 - https://sel4.github.io/rust-sel4/ - https://www.youtube.com/watch?v=jR2i4Y2Aq3o ("Rust Support in seL4 Userspace: Update and Roadmap" -- seL4 summit 2023)
I have wanted to take a deeper look myself, but alas have yet to prioritize doing so.
Regards, Jean-Philippe