CACAO
Data Structures | Typedefs | Enumerations | Functions
trap.hpp File Reference

Go to the source code of this file.

Data Structures

struct  trapinfo_t
 Contains information about a decoded trap instruction. More...
 

Typedefs

typedef struct trapinfo_t trapinfo_t
 Contains information about a decoded trap instruction. More...
 

Enumerations

enum  {
  TRAP_SIGRESERVED = 0, TRAP_SIGSEGV = 1, TRAP_SIGILL = 2, TRAP_SIGTRAP = 3,
  TRAP_SIGFPE = 4, TRAP_SIGEND
}
 Trap signal number defines. More...
 

Functions

void trap_init (void)
 Mmap the first memory page to support hardware exceptions and check the maximum hardware trap displacement on the architectures where it is required (TRAP_INSTRUCTION_IS_LOAD defined to 1). More...
 
void trap_handle (int sig, void *xpc, void *context)
 Handles the signal which is generated by trap instructions, caught by a signal handler and calls the correct function. More...
 
bool md_trap_decode (trapinfo_t *trp, int sig, void *xpc, executionstate_t *es)
 Decode the trap instruction at the given PC. More...
 

Typedef Documentation

typedef struct trapinfo_t trapinfo_t

Contains information about a decoded trap instruction.

Enumeration Type Documentation

anonymous enum

Trap signal number defines.

Use these instead of the signal numbers provided by your specific OS.

Enumerator
TRAP_SIGRESERVED 
TRAP_SIGSEGV 
TRAP_SIGILL 
TRAP_SIGTRAP 
TRAP_SIGFPE 
TRAP_SIGEND 

Definition at line 52 of file trap.hpp.

Function Documentation

bool md_trap_decode ( trapinfo_t trp,
int  sig,
void _xpc,
executionstate_t es 
)

Decode the trap instruction at the given PC.

Parameters
trpinformation about trap to be filled
sigsignal number
xpcexception PC
esexecution state of the machine
Returns
true if trap was decoded successfully, false otherwise.

Definition at line 192 of file md.cpp.

void trap_handle ( int  sig,
void xpc,
void context 
)

Handles the signal which is generated by trap instructions, caught by a signal handler and calls the correct function.

Parameters
sigsignal number
xpcexception PC
contextpointer to OS dependent machine context

Definition at line 101 of file trap.cpp.

void trap_init ( void  )

Mmap the first memory page to support hardware exceptions and check the maximum hardware trap displacement on the architectures where it is required (TRAP_INSTRUCTION_IS_LOAD defined to 1).

Definition at line 68 of file trap.cpp.