1 #ifndef _X86_FAULT_TEST_H_ 2 #define _X86_FAULT_TEST_H_ 3 4 #include "x86/msr.h" 5 #include "x86/processor.h" 6 #include "x86/apic-defs.h" 7 #include "x86/apic.h" 8 #include "x86/desc.h" 9 #include "x86/isr.h" 10 #include "alloc.h" 11 #include "setjmp.h" 12 #include "usermode.h" 13 14 #include "libcflat.h" 15 #include <stdint.h> 16 17 #define FAULT_TEST(nm, a) { .name = nm, .arg = a} 18 19 struct fault_test_arg; 20 21 typedef uint64_t (*test_fault_func)(uint64_t arg1, uint64_t arg2, 22 uint64_t arg3, uint64_t arg4); 23 typedef bool (*test_fault_callback)(struct fault_test_arg *arg); 24 25 struct fault_test_arg { 26 bool usermode; 27 unsigned int fault_vector; 28 bool should_fault; 29 uint64_t arg[4]; 30 uint64_t retval; 31 test_fault_func func; 32 test_fault_callback callback; 33 }; 34 35 struct fault_test { 36 const char *name; 37 struct fault_test_arg arg; 38 }; 39 40 void test_run(struct fault_test *test); 41 42 #endif 43