[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] tools: fix xen-detect to correctly identify domU type
xen-detect always thinks a domU is running as HVM guest as the cpuid instruction used to identify a Xen guest will always work. In order to identify a pv guest first try the pv special case of cpuid (prefixed with an ud2a instruction and "xen" in ASCII). This will fail on HVM and thus can be used to distinguish the guest types. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- tools/misc/xen-detect.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c index 787b5da..342856c 100644 --- a/tools/misc/xen-detect.c +++ b/tools/misc/xen-detect.c @@ -133,15 +133,10 @@ int main(int argc, char **argv) } } - /* Check for execution in HVM context. */ - detected = XEN_HVM; - if ( (version = check_for_xen(0)) != 0 ) - goto out; - /* * Set up a signal handler to test the paravirtualised CPUID instruction. * If executed outside Xen PV context, the extended opcode will fault, we - * will longjmp via the signal handler, and print "Not running on Xen". + * will longjmp via the signal handler, and test for HVM. */ detected = XEN_PV; if ( !setjmp(sigill_jmp) @@ -149,6 +144,11 @@ int main(int argc, char **argv) && ((version = check_for_xen(1)) != 0) ) goto out; + /* Check for execution in HVM context. */ + detected = XEN_HVM; + if ( !setjmp(sigill_jmp) && (version = check_for_xen(0)) != 0 ) + goto out; + detected = XEN_NONE; out: -- 2.6.2 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |