From: Andrew Cooper Date: Tue, 11 Apr 2017 10:37:32 +0000 (+0100) Subject: Reorganise the extable helpers to export their declarations X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0a33ff2565a0df342b9efbfb23eec133ae52a747;p=people%2Fandrewcoop%2Fxen-test-framework.git Reorganise the extable helpers to export their declarations Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/extable.c b/arch/x86/extable.c index 02e0734..e77da40 100644 --- a/arch/x86/extable.c +++ b/arch/x86/extable.c @@ -3,22 +3,8 @@ * * Common x86 exception table helper functions. */ -#include #include -#include -#include - -/** - * Record the current fault in @%eax - * - * Sample usage: - *
- *   asm volatile ("1: $INSN; 2:"
- *                 _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
- *                 : "=a" (fault) : "0" (0));
- * 
- */ bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex) { regs->ax = EXINFO(regs->entry_vector, regs->error_code); @@ -27,16 +13,6 @@ bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex) return true; } -/** - * Record the current fault in @%edi - * - * Sample usage: - *
- *   asm volatile ("1: $INSN; 2:"
- *                 _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_edi)
- *                 : "=D" (fault) : "0" (0));
- * 
- */ bool ex_record_fault_edi(struct cpu_regs *regs, const struct extable_entry *ex) { regs->di = EXINFO(regs->entry_vector, regs->error_code); @@ -45,11 +21,6 @@ bool ex_record_fault_edi(struct cpu_regs *regs, const struct extable_entry *ex) return true; } -/** - * Fixup from a rdmsr fault - * - * Clobber the MSR index to signify error, and zero output. - */ bool ex_rdmsr_safe(struct cpu_regs *regs, const struct extable_entry *ex) { regs->ax = regs->dx = 0; @@ -59,11 +30,6 @@ bool ex_rdmsr_safe(struct cpu_regs *regs, const struct extable_entry *ex) return true; } -/** - * Fixup from a wrmsr fault - * - * Clobber the MSR index to signify error. - */ bool ex_wrmsr_safe(struct cpu_regs *regs, const struct extable_entry *ex) { regs->cx = -1u; diff --git a/arch/x86/include/arch/extable.h b/arch/x86/include/arch/extable.h new file mode 100644 index 0000000..3039d16 --- /dev/null +++ b/arch/x86/include/arch/extable.h @@ -0,0 +1,60 @@ +/** + * @file arch/x86/include/arch/extable.h + * + * Common x86 exception table helper functions. + */ +#ifndef XTF_X86_EXTABLE_H +#define XTF_X86_EXTABLE_H + +#include +#include + +/** + * Record the current fault in @%eax + * + * Sample usage: + *
+ *   asm volatile ("1: $INSN; 2:"
+ *                 _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
+ *                 : "=a" (fault) : "0" (0));
+ * 
+ */ +bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex); + +/** + * Record the current fault in @%edi + * + * Sample usage: + *
+ *   asm volatile ("1: $INSN; 2:"
+ *                 _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_edi)
+ *                 : "=D" (fault) : "0" (0));
+ * 
+ */ +bool ex_record_fault_edi(struct cpu_regs *regs, const struct extable_entry *ex); + +/** + * Fixup from a rdmsr fault + * + * Clobber the MSR index to signify error, and zero output. + */ +bool ex_rdmsr_safe(struct cpu_regs *regs, const struct extable_entry *ex); + +/** + * Fixup from a wrmsr fault + * + * Clobber the MSR index to signify error. + */ +bool ex_wrmsr_safe(struct cpu_regs *regs, const struct extable_entry *ex); + +#endif /* XTF_X86_EXTABLE_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/include/xtf/extable.h b/include/xtf/extable.h index aaa2053..b646be8 100644 --- a/include/xtf/extable.h +++ b/include/xtf/extable.h @@ -96,6 +96,8 @@ void sort_extable(void); */ const struct extable_entry *search_extable(unsigned long addr); +#include + #endif /* __ASSEMBLY__ */ #endif /* XTF_EXTABLE_H */