Xen Test Framework
extable.h
Go to the documentation of this file.
1 
10 #ifndef XTF_EXTABLE_H
11 #define XTF_EXTABLE_H
12 
13 #include <xtf/types.h>
14 #include <xtf/asm_macros.h>
15 #include <xtf/macro_magic.h>
16 
17 #ifdef __ASSEMBLY__
18 
25 #define _ASM_EXTABLE_HANDLER(fault, fixup, handler) \
26  .pushsection .ex_table, "a"; \
27  _WORD fault, fixup, handler; \
28  .popsection
29 
30 #else
31 
38 #define _ASM_EXTABLE_HANDLER(fault, fixup, handler) \
39  ".pushsection .ex_table, \"a\";\n" \
40  _WORD STR(fault) ", " STR(fixup) ", " STR(handler) ";\n" \
41  ".popsection;\n"
42 
43 #endif
44 
50 #define _ASM_EXTABLE(fault, fixup) _ASM_EXTABLE_HANDLER(fault, fixup, 0)
51 
57 #define _ASM_TRAP_OK(loc) _ASM_EXTABLE(loc, loc)
58 
59 #ifndef __ASSEMBLY__
60 
61 struct cpu_regs;
62 
65 {
66  unsigned long fault;
67  unsigned long fixup;
79  bool (*handler)(struct cpu_regs *regs,
80  const struct extable_entry *ex);
81 };
82 
87 void sort_extable(void);
88 
95 const struct extable_entry *search_extable(unsigned long addr);
96 
97 #include <arch/extable.h>
98 
99 #endif /* __ASSEMBLY__ */
100 
101 #endif /* XTF_EXTABLE_H */
102 
103 /*
104  * Local variables:
105  * mode: C
106  * c-file-style: "BSD"
107  * c-basic-offset: 4
108  * tab-width: 4
109  * indent-tabs-mode: nil
110  * End:
111  */
unsigned long fixup
Fixup address.
Definition: extable.h:67
Common declarations for all tests.
Varadic macro helpers - Here be many dragons.
bool(* handler)(struct cpu_regs *regs, const struct extable_entry *ex)
Optional custom handler.
Definition: extable.h:79
const struct extable_entry * search_extable(unsigned long addr)
Search the exception table to find the entry associated with a specific faulting address.
Definition: extable.c:11
unsigned long fault
Faulting address.
Definition: extable.h:66
_Bool bool
Definition: stdbool.h:9
Exception table entry.
Definition: extable.h:64
Macros for use in assembly files.
void sort_extable(void)
Sort the exception table.
Definition: extable.c:52
Common x86 exception table helper functions.