ionescu007 / SimpleVisor

SimpleVisor is a simple, portable, Intel VT-x hypervisor with two specific goals: using the least amount of assembly code (10 lines), and having the smallest amount of VMX-related code to support dynamic hyperjacking and unhyperjacking (that is, virtualizing the host state from within the host). It works on Windows and UEFI.
http://ionescu007.github.io/SimpleVisor/
1.69k stars 259 forks source link

Overview? #16

Closed user-001 closed 7 years ago

user-001 commented 7 years ago

I really like the idea of this project, but I'm new to this and was wondering if there is some overview of the project.

rianquinn commented 7 years ago

Have you read the following: https://github.com/ionescu007/SimpleVisor/blob/master/README.md

If you have, could you provide more detail as to what information your looking for that the README doesn't address?

user-001 commented 7 years ago

Thanks for the prompt response. I have read that, but what I don't understand is how can the code enter VT-x but still have access to the OS. Isn't that sort of a contradiction? Doesn't entering VT-x mean that now it's a standalone process - an "OS" on its own containing only its own code? I'm looking for the concept behind your solution to this. (I'm trying to read through the code to get it, but as I said, I'm a beginner. Though an interested one.)

ionescu007 commented 7 years ago

Hi,

We actually define the 'standalone process' as having the exact same set of registers and state as the host. In other words, the hypervisor runs in the same address space as the main OS.

Best regards, Alex Ionescu

On Mon, Oct 31, 2016 at 1:14 PM, user-001 notifications@github.com wrote:

Thanks for the prompt response. What I don't understand is how can the code enter VT-x but still have access to the OS. Isn't that sort of a contradiction? Doesn't entering VT-x mean that now it's a standalone process - an "OS" on its own containing only its own code? I'm looking for the concept behind your solution to this. (I'm trying to read through the code to get it, but as I said, I'm a beginner. Though an interested one.)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ionescu007/SimpleVisor/issues/16#issuecomment-257407187, or mute the thread https://github.com/notifications/unsubscribe-auth/AFxIeBFMUItRJCtogYSzrEeG3tzOKv43ks5q5kwJgaJpZM4KlGMo .

rianquinn commented 7 years ago

So this repo belongs to @ionescu007 and it's main purpose is to show how to setup a VMM with as minimal code as possible, and with as little assembly as possible (and does a great job at it too). Think of it as a well documented hello world for VT-x. The hypervisor I work on is here, but Alex has helped us out a ton so I like to help were I can.

If you look here (which is the actual hypervisor): https://github.com/ionescu007/SimpleVisor/blob/master/shvvmxhv.c

You will notice that there really aren't any calls into Windows as it is it's own standalone entity. Like @ionescu007 said, it just so happens to be in the same address space, and uses a lot of the Window's existing resources like the page tables, GDT, IDT, etc...

But to get to the general point, the hypervisor itself (ring -1) should not call Windows APIs.

user-001 commented 7 years ago

@ionescu007 Thanks. That answers my question! @rianquinn "the hypervisor itself (ring -1) should not call Windows APIs" - Now I'm confused. Why not? (I'd like to use Windows' graphics drivers to communicate with the user while running my OS-less code.)

rianquinn commented 7 years ago

This should answer your question, but the short story is... that will not work. You can certainly talk to the graphics card manually (I've done this in previous projects from ring -1, and it's quiet entertaining), but you will not be able to use existing Windows APIs to do it for you.

https://github.com/Bareflank/hypervisor/issues/260

user-001 commented 7 years ago

@rianquinn Thanks. There goes my idea of solving the driver problem this way...

I'm closing this issue assuming that's the proper etiquette. My original question has been answered. Now off to the drawing board for more creative ideas on how to use the screen...