39 return xtf_error(
"Error: Update va failed\n");
41 unsigned long map_slot = 0, test_slot = 0;
45 for ( i = 0; i < L4_PT_ENTRIES; ++i )
47 if ( !(l4[i] &
PF_SYM(P)) )
53 for ( ; i < L4_PT_ENTRIES; ++i )
55 if ( !(l4[i] &
PF_SYM(P)) )
62 if ( !map_slot || !test_slot )
63 return xtf_error(
"Insufficient free l4 slots\n");
67 .val = cr3 |
PF_SYM(AD, U, P),
70 printk(
" Creating recursive l4 mapping\n");
78 return xtf_skip(
"Skip: Linear pagetables disallowed\n");
81 return xtf_error(
"Error: Recursive mapping failed: %d\n", rc);
84 printk(
" Remapping l4 RW\n");
88 printk(
" Attempt to create writeable linear map was blocked\n");
98 intpte_t *writeable =
_p(map_slot << L4_PT_SHIFT |
99 map_slot << L3_PT_SHIFT |
103 writeable[test_slot] = 0xdeadf00d;
107 if ( l4[test_slot] == 0xdeadf00d )
109 printk(
" Successfully constructed writeable pagetables\n");
117 writeable[test_slot] = 0;
static unsigned long read_cr3(void)
void printk(const char *fmt,...)
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
static long hypercall_mmu_update(const mmu_update_t reqs[], unsigned int count, unsigned int *done, unsigned int foreigndom)
static long hypercall_update_va_mapping(unsigned long linear, uint64_t npte, enum XEN_UVMF flags)
#define _p(v)
Express an abitrary integer v as void *.
#define _u(v)
Express an arbitrary value v as unsigned long.
#define KB(num)
Express num in Kilobytes.
intpte_t pte_from_paddr(paddr_t paddr, uint64_t flags)
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_error(const char *fmt,...)
Report a test error.
void xtf_skip(const char *fmt,...)
Report a test skip.
void xtf_success(const char *fmt,...)
Report test success.
#define PF_SYM(...)
Create pagetable entry flags based on mnemonics.