These are just a simple macros obtaining major, minor values as returned by xen_version hypercall.
Signed-off-by: Pawel Wieczorkiewicz <wipa...@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