- refactored libsys into common
git-svn-id: http://moon:8086/svn/mips@198 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#ifndef XCPT_H
|
||||
#define XCPT_H
|
||||
|
||||
#define MAX_NUM_XCPT 32
|
||||
#define XCPT_ERR_NOTHANDLED 0x80000000
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EXC_INT = 0, EXC_MOD = 1, EXC_TLBL = 2, EXC_TLBS = 3, EXC_ADEL = 4, EXC_ADES = 5,
|
||||
EXC_IBE = 6, EXC_DBE = 7, EXC_SYSCALL = 8, EXC_BP = 9, EXC_RI = 10, EXC_CPU = 11,
|
||||
EXC_OV = 12, EXC_TRAP = 13, EXC_VCEI = 14, EXC_FPE = 15, EXC_C2E = 16, EXC_WATCH = 23, EXC_VCED = 31
|
||||
|
||||
} EXCEPTION_CODE;
|
||||
|
||||
typedef unsigned int reg_t;
|
||||
|
||||
typedef struct xcptcontext
|
||||
{
|
||||
/* This is the exception context frame that is passed to the exception
|
||||
handlers. It gets filled in by the low-level exception handler in
|
||||
"machine.S". An assembler version of this structure can be found at the
|
||||
bottom of "machine.H".*/
|
||||
reg_t sr; /* Status Register */
|
||||
reg_t cr; /* Cause Register */
|
||||
reg_t epc; /* PC at time of exception. */
|
||||
reg_t baddr;
|
||||
reg_t regs[32]; /* Copy of all general purpose registers */
|
||||
reg_t mdlo; /* HI/LO registers (used for memory management) */
|
||||
reg_t mdhi;
|
||||
reg_t count; /* Timer registers */
|
||||
reg_t compare;
|
||||
struct xcptcontext * prev; /* To link exceptions. (unused for now) */
|
||||
unsigned xclass; /* Priority class of this exception. (unused for now). */
|
||||
|
||||
} EXCEPTION_CONTEXT;
|
||||
|
||||
typedef int (*fp_xcpt_t)(struct xcptcontext * xcp);
|
||||
|
||||
#define PRINT_REG(tag_str, reg) \
|
||||
sputs(tag_str); \
|
||||
print_word(reg); \
|
||||
sputs(" ");
|
||||
|
||||
|
||||
#define PRINT_REG_CHG(tag_str, reg, reg_last) \
|
||||
sputs(tag_str); \
|
||||
print_word(reg); \
|
||||
sputs(reg != reg_last ? "*" : " "); \
|
||||
sputs(" ");
|
||||
|
||||
|
||||
// Public functions
|
||||
void xcpt_register(int xcpt_num, fp_xcpt_t fp);
|
||||
int xcpt_get_type(struct xcptcontext * xcp);
|
||||
void xcpt_registers_print(struct xcptcontext * xcp);
|
||||
void xcpt_registers_print_with_change(struct xcptcontext * xcp, struct xcptcontext * xcp_last);
|
||||
void xcpt_exctype_print(struct xcptcontext * xcp);
|
||||
|
||||
#endif // XCPT_H
|
||||
Reference in New Issue
Block a user