From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com, keir.fraser@eu.citrix.com
Cc: konrad.wilk@oracle.com
Subject: [PATCH 2 of 3] [xen-detect] Return 0 if no Xen detected; 1 if running in PV context; and 2 if in HVM context
Date: Tue, 22 Dec 2009 16:48:57 -0000 [thread overview]
Message-ID: <fc27db3a2ddb3f084384.1261500537@phenom.dumpdata.com> (raw)
In-Reply-To: <patchbomb.1261500535@phenom.dumpdata.com>
# HG changeset patch
# User konrad@phenom.dumpdata.com
# 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;
next prev parent reply other threads:[~2009-12-22 16:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 16:48 [PATCH 0 of 3] Patches when Linux Xen drivers are modules Konrad Rzeszutek Wilk
2009-12-22 16:48 ` [PATCH 1 of 3] If Xen backend modules are not loaded, load them before starting Xend Konrad Rzeszutek Wilk
2009-12-22 19:41 ` Ian Campbell
2009-12-22 19:57 ` Konrad Rzeszutek Wilk
2009-12-22 21:59 ` Ian Campbell
2009-12-22 16:48 ` Konrad Rzeszutek Wilk [this message]
2009-12-22 20:16 ` [PATCH 2 of 3] [xen-detect] Return 0 if no Xen detected; 1 if running in PV context; and 2 if in HVM context Keir Fraser
2009-12-22 16:48 ` [PATCH 3 of 3] [xen-detect] Add arguments to print out only outputs we are interested in Konrad Rzeszutek Wilk
2009-12-22 20:21 ` Keir Fraser
2009-12-22 20:26 ` Konrad Rzeszutek Wilk
2009-12-22 20:38 ` Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc27db3a2ddb3f084384.1261500537@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.