machyve / xhyve

xhyve, a lightweight OS X virtualization solution
Other
6.44k stars 354 forks source link

High-level API passthrough? Possible? #160

Closed cesss closed 5 years ago

cesss commented 5 years ago

Hi! (I just discovered xhyve tonight and I'm really excited!! Why haven't I heard about it before???)

I've read the issue about "Device passthrough" but I tend to believe that it would need a lot of work to be implemented.

But... would it be possible to passthrough a whole API instead with less effort? I mean, If I could put a "dummy" SDL2 library inside a Linux VM that just calls a MacOS SDL2 outside of the hypervisor, it could be wonderful.

Is that already possible? Do you have some example of some function running inside a VM that generates some kind of trap and calls a function with the same prototype running outside of the hypervisor?

One possible difficulty that might arise is when communication goes from MacOS to the VM (for example, when you move the mouse and the SDL2 inside of the hypervisor needs to be notified).

Anyway, if "API passthrough" is possible, I'm going to have a lot of fun with this project! (just point me in the direction of how to passthrough a function, and I'll extend it to some libraries).

jeremyhu commented 5 years ago

The short answer is that this is not really the responsibility of something at this layer of the stack, but you could certainly do this. What you're describing is a classic paravirtual solution to a common class of problems.

jeremyhu commented 5 years ago

(things like this are why I really think it would be great to have a mailing list or slack channel for this project because bug reports aren't really the right venue for these types of discussions =/)