-#define TRAP_LIST \
- DECLARE_TRAP(illegal_instruction), \
- DECLARE_TRAP(privileged_instruction), \
- DECLARE_TRAP(fp_disabled), \
- DECLARE_TRAP(reserved0), \
- DECLARE_TRAP(instruction_address_misaligned), \
- DECLARE_TRAP(data_address_misaligned), \
- DECLARE_TRAP(instruction_access_fault), \
- DECLARE_TRAP(data_access_fault), \
- DECLARE_TRAP(syscall), \
- DECLARE_TRAP(breakpoint), \
- DECLARE_TRAP(reserved1), \
- DECLARE_TRAP(reserved2), \
- DECLARE_TRAP(reserved3), \
- DECLARE_TRAP(reserved4), \
- DECLARE_TRAP(reserved5), \
- DECLARE_TRAP(reserved6), \
- DECLARE_TRAP(int0), \
- DECLARE_TRAP(int1), \
- DECLARE_TRAP(int2), \
- DECLARE_TRAP(int3), \
- DECLARE_TRAP(int4), \
- DECLARE_TRAP(int5), \
- DECLARE_TRAP(int6), \
- DECLARE_TRAP(int7), \
-
-#define DECLARE_TRAP(x) trap_##x
-enum trap_t
+#include "decode.h"
+
+struct state_t;
+
+class trap_t
+{
+ public:
+ trap_t(reg_t which) : which(which) {}
+ virtual const char* name();
+ virtual void side_effects(state_t* state) {}
+ reg_t cause() { return which; }
+ private:
+ char _name[16];
+ reg_t which;
+};
+
+class mem_trap_t : public trap_t