WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Calculate correct instruction length for data-fa

To: Khoa Huynh <khoa@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Thu, 27 Apr 2006 21:41:01 -0500
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 27 Apr 2006 19:41:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <OF6D39649D.9B84AE2D-ON8525715E.00058331-8625715E.000A4873@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <OF6D39649D.9B84AE2D-ON8525715E.00058331-8625715E.000A4873@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mail/News 1.5 (X11/20060309)
Please don't submit patches with mailers that attach as binary attachments.

You'll have to resubmit anyway as your copyright line is wrong (unless you really did write this code a thousand years ago ;-))

Regards,

Anthony Liguori

Khoa Huynh wrote:
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
------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel