41    asm volatile (
"1: rdfsbase %[val]; 2:" 
   43                  : 
"+a" (fault), [val] 
"=r" (tmp)
 
   54    asm volatile (
"1: rdgsbase %[val]; 2:" 
   56                  : 
"+a" (fault), [val] 
"=r" (tmp)
 
   66    asm volatile (
"1: wrfsbase %[val]; 2:" 
   78    asm volatile (
"1: wrgsbase %[val]; 2:" 
   88    static const struct test {
 
  107                        "  expected %pe, got %pe\n",
 
  114    static const struct test {
 
  118        { 0x0000000000000000ul, 0 },
 
  119        { 0x00007ffffffffffful, 0 },
 
  124        { 0xffff800000000000ul, 0 },
 
  125        { 0xfffffffffffffffful, 0 },
 
  134        if ( res != t->fault )
 
  136                        "  expected %pe, got %pe\n",
 
  137                        t->val , 
_p(t->fault), 
_p(res));
 
  151    unsigned long old = 
read_cr4(), changed = old ^ val;
 
  158        fault = (old ^ 
new) != changed;
 
  169        xtf_skip(
"FSGSBASE support not detected\n");
 
  175        xtf_failure(
"Fail: Initial CR4.FSGSBASE state should be clear\n");
 
  178        cr4 &= ~X86_CR4_FSGSBASE;
 
  180            return xtf_failure(
"Fail: Fault while trying to clear CR4.FSGSBASE\n");
 
  193            xtf_failure(
"Fail: Able to set CR4.FSGSBASE without the feature\n");
 
  200        xtf_failure(
"Fail: Unable to enable CR4.FSGSBASE\n");
 
  210        xtf_failure(
"Fail: Unable to enable CR4.FSGSBASE\n");
 
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
static unsigned long read_cr4(void)
static bool write_cr4_safe(unsigned long cr4)
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
#define EXINFO_SYM(exc, ec)
unsigned int exinfo_t
Packed exception and error code information.
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
static const struct test tests[]
#define _p(v)
Express an abitrary integer v as void *.
static bool pv_write_cr4_safe(unsigned long val)
static exinfo_t stub_wrfsbase(unsigned long val)
static void test_wrfsbase_values(void)
static exinfo_t stub_rdgsbase(unsigned long unused)
static exinfo_t stub_rdfsbase(unsigned long unused)
static void test_fsgsbase_insns(bool should_ud)
static exinfo_t stub_wrgsbase(unsigned long val)
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_skip(const char *fmt,...)
Report a test skip.
void xtf_success(const char *fmt,...)
Report test success.
unsigned long(* fn)(unsigned long)