diff options
Diffstat (limited to 'instruction.h')
-rw-r--r-- | instruction.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/instruction.h b/instruction.h index 1992b6a..defa546 100644 --- a/instruction.h +++ b/instruction.h @@ -198,11 +198,16 @@ enum { #define INSTR_ERR -1 /* Error in instruction */ #define PC_INC_NORMAL 0 /* Normal PC increment after instruction */ #define PC_INC_BY_INSTR 1 /* PC got incremented by instruction */ -#define INSTR_EXCEPTION_BASE 255 /* Instruction generated an exception */ - -#define EXCEPTION(cause) (INSTR_EXCEPTION_BASE + (cause)) -#define IS_EXCEPTION(ret) ((ret) >= INSTR_EXCEPTION_BASE) -#define EXCEPTION_CAUSE(ret) ((uint8_t)((ret) - INSTR_EXCEPTION_BASE)) +#define INSTR_BREAK 2 /* Break encountered */ +#define INSTR_EXCEPTION 255 /* Instruction generated an exception + (the exception cause will be stored + in struct nios2 */ + +#define EXCEPTION(cpu, cause) \ + ({ \ + (cpu)->exception_cause = cause; \ + INSTR_EXCEPTION; \ + }) /* Forward declaration */ struct nios2; |