Xen Test Framework
Data Structures | Macros | Functions
extable.h File Reference

Exception table support. More...

#include <xtf/types.h>
#include <xtf/asm_macros.h>
#include <xtf/macro_magic.h>
#include <arch/extable.h>
+ Include dependency graph for extable.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  extable_entry
 Exception table entry. More...
 

Macros

#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
 Create an exception table entry with custom handler. More...
 
#define _ASM_EXTABLE(fault, fixup)   _ASM_EXTABLE_HANDLER(fault, fixup, 0)
 Create an exception table entry. More...
 
#define _ASM_TRAP_OK(loc)   _ASM_EXTABLE(loc, loc)
 Create an exception table entry, whitelisting a trap as being ok at loc. More...
 

Functions

void sort_extable (void)
 Sort the exception table. More...
 
const struct extable_entrysearch_extable (unsigned long addr)
 Search the exception table to find the entry associated with a specific faulting address. More...
 

Detailed Description

Exception table support.

Allows code to tag an instruction which might fault, and where to jump to in order to recover. For more complicated recovery, a custom handler can be registered.

Definition in file extable.h.

Macro Definition Documentation

◆ _ASM_EXTABLE_HANDLER

#define _ASM_EXTABLE_HANDLER (   fault,
  fixup,
  handler 
)
Value:
".pushsection .ex_table, \"a\";\n" \
_WORD STR(fault) ", " STR(fixup) ", " STR(handler) ";\n" \
".popsection;\n"
#define STR(x)
Stringise an expression, expanding preprocessor tokens.
Definition: macro_magic.h:17

Create an exception table entry with custom handler.

Parameters
faultFaulting address.
fixupFixup address.
handlerHandler to call.

Definition at line 38 of file extable.h.

◆ _ASM_EXTABLE

#define _ASM_EXTABLE (   fault,
  fixup 
)    _ASM_EXTABLE_HANDLER(fault, fixup, 0)

Create an exception table entry.

Parameters
faultFaulting address.
fixupFixup address.

Definition at line 50 of file extable.h.

◆ _ASM_TRAP_OK

#define _ASM_TRAP_OK (   loc)    _ASM_EXTABLE(loc, loc)

Create an exception table entry, whitelisting a trap as being ok at loc.

(ab)uses the fault fixup logic to fixup to its current position.

Parameters
locLocation of the trap.

Definition at line 57 of file extable.h.

Function Documentation

◆ sort_extable()

void sort_extable ( void  )

Sort the exception table.

Required to be called once on boot to make searching efficient.

Definition at line 52 of file extable.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ search_extable()

const struct extable_entry * search_extable ( unsigned long  addr)

Search the exception table to find the entry associated with a specific faulting address.

Parameters
addrFaulting address.
Returns
Appropriate extable_entry, or NULL if no entry.

Definition at line 11 of file extable.c.

+ Here is the caller graph for this function: