Software Archive
Read-only legacy content

VMCS Pointer

hypervista
Beginner
626 Views

I've been building a hypervisor using Intel's VMX technology. I've gotten to the point where I need to define the VMCS region. I'm pretty sure I know how to create the VMCS region, but having some difficulty understanding how to define the VMCS pointer. The Intel Developer's Manual, Volume 3B states,

"Software references a specific VMCS by using the 64-bit physical address of the region; such an address is called a VMCS pointer. VMCS pointers must be aligned on a 4-KByte boundary (bits 11:0 must be zero)."

Can someone please explain to me how a 4-Kbyte alligned pointer would be implemented in software? Thanks.

0 Kudos
2 Replies
Intel_Software_Netw1
626 Views

Our engineering team recommends that you start by reviewing Chapter 3 ofthe Intel 64 and IA-32 Architectures Optimization Reference Manual. The SDM has general alignment information.With regard to your specific question, they responded:

A 4K aligned (or page aligned) pointer is one that points to a region of space and has 12 low order zeros (just like the PRM says).You should call an API that givesyou an aligned 4K page. Ifyou have no such API, thenyou need to ask for more space thanyou need, and then align within that larger space. For instance,

P = malloc( 8K bytes ) // very wasteful, but needed if you do not know where your returned memory will be

Q = (P + 4095) AND (0xFFFFF000) // for a 32 bit machinemask needs to be changed for a 64 bit machine

The pointer Q is now aligned. Note that this pseudo-code does not have the right casts to make it work correctly. However, ifyou arewriting a hypervisor from scratch that shouldnt be any barrier foryou to make it work.

You mightalso look at Xen (http://en.wikipedia.org/wiki/Xen), which is an open-source VMM.

==

Lexi S.

IntelSoftware NetworkSupport

http://www.intel.com/software

Contact us

0 Kudos
hypervista
Beginner
626 Views
Thank you Lexi. This is quite helpful!
0 Kudos
Reply