const char test_title[] = "Guest CPUID Faulting support";
-bool test_wants_user_mappings = true;
+static unsigned long stub_cpuid(void)
+{
+ unsigned long fault = 0, tmp;
+
+ asm volatile("1: cpuid; 2:"
+ _ASM_EXTABLE_HANDLER(1b, 2b, %P[rec])
+ : "=a" (tmp), "+D" (fault)
+ : "a" (0), [rec] "p" (ex_record_fault_edi)
+ : "ebx", "ecx", "edx");
+
+ return fault;
+}
+
+static unsigned long stub_force_cpuid(void)
+{
+ unsigned long fault = 0, tmp;
+
+ asm volatile(_ASM_XEN_FEP
+ "1: cpuid; 2:"
+ _ASM_EXTABLE_HANDLER(1b, 2b, %P[rec])
+ : "=a" (tmp), "+D" (fault)
+ : "a" (0), [rec] "p" (ex_record_fault_edi)
+ : "ebx", "ecx", "edx");
+
+ return fault;
+}
-unsigned long stub_cpuid(void)
+static unsigned long __user_text stub_user_cpuid(void)
{
- unsigned int fault = 0, tmp;
+ unsigned long fault = 0, tmp;
asm volatile("1: cpuid; 2:"
_ASM_EXTABLE_HANDLER(1b, 2b, %P[rec])
return fault;
}
-unsigned long stub_fep_cpuid(void)
+static unsigned long __user_text stub_user_force_cpuid(void)
{
- unsigned int fault = 0, tmp;
+ unsigned long fault = 0, tmp;
asm volatile(_ASM_XEN_FEP
"1: cpuid; 2:"
if ( stub_cpuid() )
xtf_failure("Fail: kernel cpuid faulted\n");
- if ( IS_DEFINED(CONFIG_PV) && stub_fep_cpuid() )
+ if ( IS_DEFINED(CONFIG_PV) && stub_force_cpuid() )
xtf_failure("Fail: kernel pv cpuid faulted\n");
- if ( xtf_has_fep && stub_fep_cpuid() )
+ if ( xtf_has_fep && stub_force_cpuid() )
xtf_failure("Fail: kernel emulated cpuid faulted\n");
/*
unsigned long exp = exp_faulting ? EXINFO_SYM(GP, 0) : 0;
const char *exp_fail_str = exp_faulting ? "didn't fault" : "faulted";
- if ( exec_user(stub_cpuid) != exp )
+ if ( exec_user(stub_user_cpuid) != exp )
xtf_failure("Fail: user cpuid %s\n", exp_fail_str);
- if ( IS_DEFINED(CONFIG_PV) && exec_user(stub_fep_cpuid) != exp )
+ if ( IS_DEFINED(CONFIG_PV) && exec_user(stub_user_force_cpuid) != exp )
xtf_failure("Fail: user pv cpuid %s\n", exp_fail_str);
- if ( xtf_has_fep && exec_user(stub_fep_cpuid) != exp )
+ if ( xtf_has_fep && exec_user(stub_user_force_cpuid) != exp )
xtf_failure("Fail: user emulated cpuid %s\n", exp_fail_str);
}