All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Wieczorkiewicz <wipawel@amazon.de>
To: <xen-devel@lists.xen.org>
Cc: julien@xen.org, wipawel@xen.org, paul@xen.org,
	semelpaul@gmail.com, andrew.cooper3@citrix.com,
	wipawel@amazon.de, nmanthey@amazon.de
Subject: [XTF v2 v2 1/4] lib: Add XEN_MAJOR() and XEN_MINOR() macros
Date: Thu, 23 Apr 2020 10:19:52 +0000	[thread overview]
Message-ID: <20200423101955.13761-2-wipawel@amazon.de> (raw)
In-Reply-To: <20200423101955.13761-1-wipawel@amazon.de>

These are just a simple macros obtaining major, minor values as
returned by xen_version hypercall.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
---
 include/xtf/lib.h    | 3 +++
 tests/xsa-213/main.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/xtf/lib.h b/include/xtf/lib.h
index 3348464..40e5731 100644
--- a/include/xtf/lib.h
+++ b/include/xtf/lib.h
@@ -20,6 +20,9 @@
 
 #define ACCESS_ONCE(x)   (*(volatile typeof(x) *)&(x))
 
+#define XEN_MAJOR(v) (((v) >> 16) & 0xFFFF)
+#define XEN_MINOR(v) ((v) & 0xFFFF)
+
 void __noreturn panic(const char *fmt, ...) __printf(1, 2);
 
 #define ASSERT(cond)                                    \
diff --git a/tests/xsa-213/main.c b/tests/xsa-213/main.c
index 64e7065..0353168 100644
--- a/tests/xsa-213/main.c
+++ b/tests/xsa-213/main.c
@@ -121,8 +121,8 @@ void test_main(void)
 {
     long rc, xen_version = hypercall_xen_version(XENVER_version, NULL);
 
-    printk("Found Xen %ld.%ld\n",
-           (xen_version >> 16) & 0xffff, xen_version & 0xffff);
+    printk("Found Xen %ld.%ld\n", XEN_MAJOR(xen_version),
+           XEN_MINOR(xen_version));
 
     xtf_set_idte(X86_VEC_AVAIL, &idte);
 
-- 
2.16.6




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879





  reply	other threads:[~2020-04-23 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 10:19 [XTF v2 v2 0/4] Small fixes and improvements Pawel Wieczorkiewicz
2020-04-23 10:19 ` Pawel Wieczorkiewicz [this message]
2020-04-23 10:19 ` [XTF v2 v2 2/4] lib: always append CR after LF in vsnprintf() Pawel Wieczorkiewicz
2020-04-23 10:19 ` [XTF v2 v2 3/4] Enabled serial writing for hvm guests Pawel Wieczorkiewicz
2020-04-23 10:19 ` [XTF v2 v2 4/4] setup: Detect and display Xen version on test startup Pawel Wieczorkiewicz

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=20200423101955.13761-2-wipawel@amazon.de \
    --to=wipawel@amazon.de \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien@xen.org \
    --cc=nmanthey@amazon.de \
    --cc=paul@xen.org \
    --cc=semelpaul@gmail.com \
    --cc=wipawel@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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.