Hi Geoffroy and Thomas,

On Tue, Jul 28, 2015 at 4:29 AM, Thomas Leonard <[email protected]> wrote:

> On 27 July 2015 at 15:54, Thomas Leonard <[email protected]> wrote:
> > On 27 July 2015 at 09:36, Geoffroy Couprie <[email protected]>
> 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]
* compile libhello.a from [2]
* 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?

To understand the interactions between Xen, Mini-OS, and MirageOS, I found
[3] and [4] useful starting points.

The zinc.rs [5] project, a Rust RTOS for ARM, could provide some
inspiration for modeling low-level operations in a type-safe way.

[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

--
Len


>
>
> --
> Dr Thomas Leonard        http://roscidus.com/blog/
> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
>
> _______________________________________________
> MirageOS-devel mailing list
> [email protected]
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
>
_______________________________________________
MirageOS-devel mailing list
[email protected]
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

Reply via email to