Page 1 of 1

Anyone have any experience with virtualization techniques?

Posted: Thu Oct 26, 2006 12:48 pm
by proxy
Anyone have any experience with virtualization techniques? Basically I am thinking of implementing some creative ideas with my OS involving running a guest OS and seamlessly sharing files and stuff like that.

I believe I have the basics down, the trapping of privileged ops is very similar to V8086 mode in that you get a GPF, you need to analyze the instruction that caused it and emulate as necessary to get the correct apparent result.

My main questions lie in the memory model area. How in the world do things like vmware which run most code natively give the child OS a virtual 4GB address space to play with and properly simulate paging and all that. I have some ideas, but they mostly fall under the "crazy but might work" category.

So I was wondering if anyone had any experience in this category they'd like to share (or at least some technical data that I can use to learn from).

thanks,
proxy

Posted: Thu Oct 26, 2006 2:04 pm
by Colonel Kernel
I'm guessing that VMWare uses segmentation to fake out the Guest OS. I haven't thought it through much more than that. I heard that the 64-bit version of VMWare requires a certain revision of x64 processor in order to run because it depends on segmentation to a limited degree.

Posted: Thu Oct 26, 2006 2:13 pm
by proxy
well that's fine for faking physical memory, you just set a ldt entry to have a base matching your fake ram, and a limit matching your ram total, this will give you a nice trap if they try to access hardware devices and non-existant ram...the tricky part is when they want to use paging on top of this fake physical ram :-/ that's the part i can't quite figure out.

proxy

Posted: Fri Oct 27, 2006 9:08 am
by JAAman
I've thought a lot about this, and im not sure

depending on what the host OS allows, its possible that it actually uses hardware paging to handle this

another possibility is to map virtual not physical memory:

setup a region of memory (as Colonel Kernel stated), and use that for your virtual memory (not physical), then whenever paging changes, remap the memory so that it matches the new page tables ('physical memory' is handled internally, and not actually simulated) -- for performance you can take advantage of the fact that changes are rarely minor, and usually indicate a new thread/process (processes are always mapped the same)
basically this method will have a thread-switch performance penalty, but you already have that anyway