From 9a1312e741193778718ed37b3779c2b964649e9d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 24 Nov 2010 18:35:39 +0100 Subject: Change exception handling, more instructions implemented --- instruction.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'instruction.h') 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; -- cgit v1.2.3-54-g00ecf