ia64/xen-unstable
changeset 19173:5c1308e2ece3
xenctx support for 64-bit HVM guests
Now that we can easily find EFER.LMA, xenctx can detect 64-bit HVM
VCPUs
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Now that we can easily find EFER.LMA, xenctx can detect 64-bit HVM
VCPUs
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Thu Feb 05 12:17:24 2009 +0000 (2009-02-05) |
parents | 2358b9fcd51b |
children | a2a755b7927e |
files | tools/xentrace/xenctx.c |
line diff
1.1 --- a/tools/xentrace/xenctx.c Thu Feb 05 12:17:08 2009 +0000 1.2 +++ b/tools/xentrace/xenctx.c Thu Feb 05 12:17:24 2009 +0000 1.3 @@ -26,6 +26,7 @@ 1.4 #include "xenctrl.h" 1.5 #include <xen/foreign/x86_32.h> 1.6 #include <xen/foreign/x86_64.h> 1.7 +#include <xen/hvm/save.h> 1.8 1.9 int xc_handle = 0; 1.10 int domid = 0; 1.11 @@ -788,23 +789,29 @@ static void dump_ctx(int vcpu) 1.12 1.13 #if defined(__i386__) || defined(__x86_64__) 1.14 { 1.15 - struct xen_domctl domctl; 1.16 - memset(&domctl, 0, sizeof domctl); 1.17 - domctl.domain = domid; 1.18 - domctl.cmd = XEN_DOMCTL_get_address_size; 1.19 - if (xc_domctl(xc_handle, &domctl) == 0) 1.20 - ctxt_word_size = guest_word_size = domctl.u.address_size.size / 8; 1.21 if (dominfo.hvm) { 1.22 + struct hvm_hw_cpu cpuctx; 1.23 xen_capabilities_info_t xen_caps = ""; 1.24 + if (xc_domain_hvm_getcontext_partial( 1.25 + xc_handle, domid, HVM_SAVE_CODE(CPU), 1.26 + vcpu, &cpuctx, sizeof cpuctx) != 0) { 1.27 + perror("xc_domain_hvm_getcontext_partial"); 1.28 + exit(-1); 1.29 + } 1.30 + guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 : 4; 1.31 + /* HVM guest context records are always host-sized */ 1.32 if (xc_version(xc_handle, XENVER_capabilities, &xen_caps) != 0) { 1.33 perror("xc_version"); 1.34 exit(-1); 1.35 } 1.36 - /* HVM guest context records are always host-sized */ 1.37 ctxt_word_size = (strstr(xen_caps, "xen-3.0-x86_64")) ? 8 : 4; 1.38 - /* XXX For now we can't tell whether a HVM guest is in long 1.39 - * XXX mode; eventually fix this here and in xc_pagetab.c */ 1.40 - guest_word_size = 4; 1.41 + } else { 1.42 + struct xen_domctl domctl; 1.43 + memset(&domctl, 0, sizeof domctl); 1.44 + domctl.domain = domid; 1.45 + domctl.cmd = XEN_DOMCTL_get_address_size; 1.46 + if (xc_domctl(xc_handle, &domctl) == 0) 1.47 + ctxt_word_size = guest_word_size = domctl.u.address_size.size / 8; 1.48 } 1.49 } 1.50 #endif