[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Hosting a VM on Mirage

On 11 Jan 2015, at 11:35, Thomas Leonard <talex5@xxxxxxxxx> wrote:
> On 10 January 2015 at 14:03, Joerg Beekmann, DeepCove Labs
> <joerg@xxxxxxxxxxxxxxxx> wrote:
>> Hi
>> I just discovered Mirage and am quite fascinated by it. Is anyone aware of
>> attempts to use Mirage OS as a host for a virtual machine supporting another
>> language? In my case I am wondering if Mirage could host the VM that runs
>> the Pharo Smalltalk virtual image. http://pharo.org/ .
>> A bit of back ground, most Smalltalk systems consist of two components, a
>> virtual image which contains the entire state of the system including
>> classes, method bytecodes, user data etc. and a virtual machine that runs
>> the image. The image is usually bit compatible from host OS to host OS.
>> Pharo Smalltalk is part of the Squeak family of Smalltalk where the VM is
>> written in a dialect of Smalltalk called Slang, from this C code is
>> generated with some variations depending on host. The C code is then
>> complied using the platform compiler. To ease portability the Squeak family
>> asks as little of the host as possible, typically just memory, storage,
>> network, a single windowed drawing surface and, user input events. In
>> particular no UI or graphics system calls, the Squeak windowing system is
>> rendered by Squeak itself. For servers Squeak can be made to run headless
>> without any UI.
>> There is a Squeak project underway to create an âembeddableâ version of
>> Squeak. If that existed as a C library would it be possible in principle to
>> host that library on Mirage OS? Any ideas on how to proceed? I looked at
>> http://openmirage.org/blog/modular-foreign-function-bindings and if I
>> understand correctly it looks like a c library could be linked to Mirage and
>> Mirage configured so as to call the entry point on boot. The Library could
>> then call back into Mirage to set sockets and other resources.
>> If this worked for the Squeak VM I image a similar approach could be to host
>> other languages, for example Scheme. Actually now that I think of it a small
>> embeddable Scheme system may be a simpler place to start.
>> Any comments welcome, apologies if any of this is hopelessly naÃve as
>> regards Mirage.
> Should work. You could look at the nocrypo library for an example of
> using ctypes to link to C code:
>  https://github.com/mirleft/ocaml-nocrypto
> This shows how to get the build system to compile the cstubs
> definitions to C and OCaml stubs, for Unix and Xen, and then use them
> in the rest of the code. It would be good to have a simpler example
> though, and scheme might be a good place to start.
> Either way, you'll want to expose the bindings as a separate OPAM
> package and then depend on that in your unikernel, so that Mirage can
> generate the Makefile automatically (it can't handle C stubs provided
> directly by the unikernel at present).

I've also been doing some work to continue the disentanglement of the
various pkg-config libraries installed by Mirage-Xen that Thomas started
off.  Pull request is here:


In theory, it should be easier for you to target just the mirage-xen-posix
pkg-config library and get an embedded, console-only Squeak running. Once
that's in place, it shouldn't be too hard to do callbacks into it from
the Mirage code, or even spin it up in a separate address space with some
MiniOS hacking.

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.