printk("--- Xen Test Framework ---\n");
printk("Environment: %s\n", environment_description);
+ printk("%s\n", test_title);
test_setup();
@skipline <xtf.h>
+Choose a suitable title:
+
+@skipline const char test_title
+
Implement test_main():
@skipline main(
*/
void test_main(void);
+/**
+ * The title of the test.
+ */
+extern const char test_title[];
+
/**
* Boolean indicating whether generic Force Emulation Prefix support is
* available for the test to use.
*/
#include <xtf.h>
-void test_main(void)
-{
EOF
[ $CATEGORY != "xsa" ] && \
- echo ' printk("Test '$NAME'\\n");' || \
- echo ' printk("'$NAME_UC' PoC\\n");'
+ echo 'const char test_title[] = "Test '$NAME'";' || \
+ echo 'const char test_title[] = "'$NAME_UC' PoC";'
cat <<EOF
+void test_main(void)
+{
xtf_success(NULL);
}
#include <arch/x86/msr-index.h>
#include <arch/x86/processor.h>
+const char test_title[] = "Guest CPUID Faulting support";
+
bool test_wants_user_mappings = true;
unsigned long stub_cpuid(void)
{
uint64_t platform_info, features_enable;
- printk("Guest CPUID Faulting support\n");
-
if ( IS_DEFINED(CONFIG_HVM) && !xtf_has_fep )
xtf_skip("FEP support not detected - some tests will be skipped\n");
*/
#include <xtf.h>
+const char test_title[] = "Guest cpuid information";
+
static void dump_leaves(cpuid_count_fn_t cpuid_fn)
{
uint32_t leaf = 0, subleaf = ~0U;
void test_main(void)
{
- printk("Guest cpuid information\n");
-
printk("Native cpuid:\n");
dump_leaves(cpuid_count);
*/
#include <xtf.h>
+const char test_title[] = "Hello World";
+
void test_main(void)
{
- xtf_success("Hello World\n");
+ xtf_success(NULL);
}
/*
*/
#include <xtf.h>
+const char test_title[] = "Test availability of HVM forced emulation prefix";
+
void test_main(void)
{
- printk("Test availability of HVM forced emulation prefix\n");
-
if ( xtf_has_fep )
xtf_success(NULL);
else
#include <arch/x86/processor.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "FPU Exception Emulation";
+
#define CR0_SYM(...) TOK_OR(X86_CR0_, ##__VA_ARGS__)
#define CR0_MASK CR0_SYM(EM, MP, TS)
void test_main(void)
{
- printk("FPU Exception Emulation:\n");
-
default_cr0 = read_cr0();
run_tests(false);
#include <arch/x86/msr-index.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "Invlpg tests";
+
/* Swizzle to easily change all invlpg instructions to being emulated. */
#if 0
#define _ASM_MAYBE_XEN_FEP _ASM_XEN_FEP
*/
#include <xtf.h>
+const char test_title[] = "Guest MSR information";
+
void test_main(void)
{
unsigned int idx = 0;
uint64_t val;
- printk("Guest MSR information\n");
-
do {
if ( !rdmsr_safe(idx, &val) )
printk(" %08x -> %016"PRIx64"\n", idx, val);
#include <arch/x86/processor.h>
+const char test_title[] = "PV IOPL emulation";
+
bool test_wants_user_mappings = true;
/**
{
const struct test *test;
- printk("PV IOPL emulation\n");
-
/**
* @todo Implement better command line infrastructure, but this will do
* for now.
#include <arch/x86/processor.h>
#include <arch/x86/segment.h>
+const char test_title[] = "XTF Selftests";
+
bool test_wants_user_mappings = true;
static void test_int3_breakpoint(void)
void test_main(void)
{
- printk("XTF Selftests\n");
-
test_int3_breakpoint();
test_extable();
test_exlog();
#include "lowlevel.h"
+const char test_title[] = "Software interrupt emulation";
+
bool test_wants_user_mappings = true;
/** Single stub's worth of information. */
void test_main(void)
{
- printk("Trap emulation\n");
-
/*
* Even if FEP is unavailable, run the tests against real hardware to
* check the algorithm, but don't claim overall success.
*/
#include <xtf.h>
+const char test_title[] = "XSA-122 PoC";
+
/*
* Check a buffer of a specified size for non-NUL bytes following the string
* NUL terminator.
{
long rc;
- printk("XSA-122 PoC\n");
-
printk("XENVER_extraversion:\n");
{
xen_extraversion_t extra;
*/
#include <xtf.h>
+const char test_title[] = "XSA-123 PoC";
+
bool test_needs_fep = true;
void test_main(void)
{
unsigned long src = 0x1234, dest = 0;
- printk("XSA-123 PoC\n");
-
asm volatile(_ASM_XEN_FEP
/* Explicit %cs segment override. */
".byte 0x2e;"
*/
#include <xtf.h>
+const char test_title[] = "XSA-167 PoC";
+
void test_main(void)
{
- printk("XSA-167 PoC\n");
-
mmuext_op_t op =
{
.cmd = MMUEXT_MARK_SUPER,
*/
#include <xtf.h>
+const char test_title[] = "XSA-168 PoC";
+
void test_main(void)
{
- printk("XSA-168 PoC\n");
-
/**
* At the time of writing, Xen doesn't correctly handle `invlpg` while
* running in shadow mode on AMD Gen1 hardware lacking decode assistance.
#include <arch/x86/processor.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "XSA-173 PoC";
+
/* New L2 pagetable for the test to manipulate. */
uint64_t nl2[PAE_L2_PT_ENTRIES] __aligned(PAGE_SIZE);
{
uint64_t *ptr, val;
- printk("XSA-173 PoC\n");
-
/* Hook nl2 into the existing l3, just above the 4GB boundary. */
pae_l3_identmap[4] = pte_from_virt(nl2, PF_SYM(U, RW, P));
#include <arch/x86/pagetable.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "XSA-182 PoC";
+
void test_main(void)
{
- printk("XSA-182 PoC\n");
-
unsigned long cr3 = read_cr3();
intpte_t nl1e = pte_from_paddr(cr3, PF_SYM(AD, U, P));
intpte_t *l4 = _p(KB(4));
#include <arch/x86/pagetable.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "XSA-183 PoC";
+
uint8_t user_stack[PAGE_SIZE] __aligned(PAGE_SIZE);
void test_main(void)
unsigned long curr_stk, discard;
intpte_t nl1e = pte_from_virt(user_stack, PF_SYM(AD, U, RW, P));
- printk("XSA-183 PoC\n");
-
/* Remap user_stack with _PAGE_USER. */
if ( hypercall_update_va_mapping(user_stack, nl1e, UVMF_INVLPG) )
panic("Unable to remap user_stack with _PAGE_USER\n");
#include <arch/x86/pagetable.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "XSA-185 PoC";
+
void test_main(void)
{
- printk("XSA-185 PoC\n");
-
paddr_t cr3_paddr = (paddr_t)xen_cr3_to_pfn(read_cr3()) << PAGE_SHIFT;
/*
#include <arch/x86/pagetable.h>
#include <arch/x86/symbolic-const.h>
+const char test_title[] = "XSA-186 PoC";
+
bool test_needs_fep = true;
/* Test-local `int` handler. */
void test_main(void)
{
- printk("XSA-186 PoC\n");
-
struct xtf_idte idte =
{
.addr = (unsigned long)test_int_handler,
#include <xtf.h>
#include <arch/x86/mm.h>
+const char test_title[] = "XSA-188 PoC";
+
static uint8_t array_page[PAGE_SIZE] __aligned(PAGE_SIZE);
void test_main(void)
struct evtchn_expand_array expand_array;
int ret;
- printk("XSA-188 PoC\n");
-
/* 1. EVTCHNOP_init_control with bad GFN. */
init_control.control_gfn = (uint64_t)-2;
init_control.offset = 0;