[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2 of 3] [xen-detect] Return 0 if no Xen detected; 1 if running in PV context; and 2 if in HVM context
# HG changeset patch # User konrad@xxxxxxxxxxxxxxxxxxx # Date 1261438342 18000 # Node ID fc27db3a2ddb3f0843841748684547f6e2ed1f02 # Parent 402aa73665eddb3f7b3ede0a8894acd24397218d [xen-detect] Return 0 if no Xen detected; 1 if running in PV context; and 2 if in HVM context. On top of printing whether we are in HVM or PV context (or none at all), also return a value. diff -r 402aa73665ed -r fc27db3a2ddb tools/misc/xen-detect.c --- a/tools/misc/xen-detect.c Mon Dec 21 17:50:08 2009 -0500 +++ b/tools/misc/xen-detect.c Mon Dec 21 18:32:22 2009 -0500 @@ -68,7 +68,8 @@ cpuid(base + 1, &eax, &ebx, &ecx, &edx, pv_context); printf("Running in %s context on Xen v%d.%d.\n", pv_context ? "PV" : "HVM", (uint16_t)(eax >> 16), (uint16_t)eax); - return 1; + + return pv_context ? 1 : 2; } static jmp_buf sigill_jmp; @@ -79,9 +80,12 @@ int main(void) { + /* 0 - no Xen, 1 - PV Xen, 2 - HVM Xen */ + int rc = 0; + /* Check for execution in HVM context. */ - if ( check_for_xen(0) ) - return 0; + if ( (rc = check_for_xen(0)) ) + return rc; /* * Set up a signal handler to test the paravirtualised CPUID instruction. @@ -90,8 +94,8 @@ */ if ( !setjmp(sigill_jmp) && (signal(SIGILL, sigill_handler) != SIG_ERR) - && check_for_xen(1) ) - return 0; + && (rc = check_for_xen(1)) ) + return rc; printf("Not running on Xen.\n"); return 0; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |