[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems
On VT-x systems, according to Intel VMX specifications, the instruction-length information in VMCS on VM exits is not always valid. The instruction-length field in VMCS is ONLY valid in the follwing cases: when the VM exit is caused by the execution of instructions that cause the VM exit unconditionally or based on the execution-control bitmap, a software exception (INT3 or INT0), or a task switch. For VM exits caused by data faults (hardware exceptions), the instruction-length field in VMCS is actually undefined. In these cases, the hypervisor can derive the correct instruction length by fetching bytes based on the guest instruction pointer and decoding those bytes. There is already a function to do this in the SVM sub-directory. This function should be moved up one level to HVM sub-directory, so both VMX and SVM can use it. It should be noted that VMX only uses this instrlen function when the hypervisor needs the instruction-length info and that info is undefined in VMCS, e.g., for MMIO instructions. In other cases where the instruction-length field is valid in VMCS, the hypervisor continues to get that info from VMCS (via vmread operation). I came across this problem in my effort to get Windows NT booting on Xen. There are TWO patches attached below: * instrlen1.patch effectively moves the instrlen.c file from xen/arch/x86/hvm/svm sub-directory up one level to xen/arch/x86/hvm sub-directory and makes minor changes to instrlen.c so that it will work at its new location. * instrlen2.patch makes additional changes to VMX code so the hypervisor can use the instrlen function correctly in all modes in cases where the instruction-length field is undefined and read from VMCS in cases where it is defined. I must acknowledge that most of the code in the first patch (instrlen1.patch) does not come from me since the primary prupose of this patch is to move the instrlen.c file from one location to another in the tree (it also makes some minor changes). The second patch (instrlen2.patch) is more meaty :-) These two patches should apply cleanly to the latest xen-unstable tree (hg tip = 9866). I have tested these patches successfully on two systems using a variety of guest OSes (e.g. WinXP, Win2003 Server). Signed-off-by: Khoa Huynh <khoa@xxxxxxxxxx> (See attached file: instrlen1.patch)(See attached file: instrlen2.patch) Regards, Khoa _________________________________________ Khoa Huynh, Ph.D. IBM Linux Technology Center (512) 838-4903; T/L 678-4903; khoa@xxxxxxxxxx Attachment:
instrlen1.patch Attachment:
instrlen2.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |