[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] Rust unikernels
Hi Len, On Wed, Jul 29, 2015 at 9:12 PM, Len Maxwell <len@xxxxxxxx> wrote: > > Hi Geoffroy and Thomas, > > On Tue, Jul 28, 2015 at 4:29 AM, Thomas Leonard <talex5@xxxxxxxxx> wrote: >> >> On 27 July 2015 at 15:54, Thomas Leonard <talex5@xxxxxxxxx> wrote: >> > On 27 July 2015 at 09:36, Geoffroy Couprie <contact@xxxxxxxxxxxxxxxxxxx> >> > wrote: >> >> [...] >> >> One other thing I should mention: Mini-OS runs in kernel mode and can >> be interrupted at any time. On x86, the interrupt handler uses the >> same stack as the rest of the code. Therefore, you must compile with >> the Rust equivalent of -mno-red-zone so Rust doesn't assume it can >> store things below the current stack pointer. > > > I'm just starting to learn Rust, but I managed to create a simple static lib > and link it into a standalone Mini-OS build: > > * build Rust from git with static musl libc support [1] This is nice, I did not know about musl usage. This may be a bit big for a unikernel, though. Do we need a full POSIX interface, with threads and everything? Thomas, what's mirage take on this? > * compile libhello.a from [2] Those should be the correct compilation flags > * declare the Rust function as an extern in mini-os/kernel.c, call it from > start_kernel() > * add -L... -lhello to the Mini-OS linker flags > * make and run > > Geoffroy, how does this compare to your approach? See my code here: https://github.com/Geal/mini-os/compare/master...rust Basically, I'm trying to replace some parts of Mini-OS with Rust code, as Thomas suggested. That way, we keep an architecture and a bootloader that work well with Xen, and it can be tested right away with Mirage. > > To understand the interactions between Xen, Mini-OS, and MirageOS, I found > [3] and [4] useful starting points. We will need a Rust implementation of clients for Xenbus and Xen events. Once code is running from start_kernel, the next step is interacting with Xen's devices. > > The zinc.rs [5] project, a Rust RTOS for ARM, could provide some inspiration > for modeling low-level operations in a type-safe way. Zinc looks great, and they do something that I was planning to: downloading the libcore part of Rust and linking to it directly. This is the easiest way to get Rust features as needed, without having too many dependencies. And once there's a libcore, making a libstd gets easier. > > [1]: https://doc.rust-lang.org/nightly/book/advanced-linking.html#linux > [2]: https://gist.github.com/lnmx/e7a74bacafb7e38b8355 > [3]: http://roscidus.com/blog/blog/2014/07/28/my-first-unikernel/ > [4]: https://mirage.io/wiki/xen-events > [5]: http://zinc.rs > Geoffroy Couprie _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |