From ed71703766a59469c137d3061321cd9d0f31f4eb Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sun, 22 Jan 2012 18:18:47 -0800 Subject: [PATCH] disentangle decode.h from other headers --- riscv/decode.h | 16 ---------------- riscv/mmu.h | 1 + riscv/processor.h | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/riscv/decode.h b/riscv/decode.h index b76617a..6fa0a4b 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -3,8 +3,6 @@ #define __STDC_LIMIT_MACROS #include -#include "common.h" -#include "config.h" typedef int int128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI))); @@ -206,20 +204,6 @@ private: #define sext_xprlen(x) (((sreg_t)(x) << (64-xprlen)) >> (64-xprlen)) #define zext_xprlen(x) (((reg_t)(x) << (64-xprlen)) >> (64-xprlen)) -#ifndef RISCV_ENABLE_RVC -# define set_pc(x) \ - do { if((x) & (sizeof(insn_t)-1)) \ - { badvaddr = (x); throw trap_instruction_address_misaligned; } \ - npc = (x); \ - } while(0) -#else -# define set_pc(x) \ - do { if((x) & ((sr & SR_EC) ? 1 : 3)) \ - { badvaddr = (x); throw trap_instruction_address_misaligned; } \ - npc = (x); \ - } while(0) -#endif - // RVC stuff #define INSN_IS_RVC(x) (((x) & 0x3) < 0x3) diff --git a/riscv/mmu.h b/riscv/mmu.h index 9d648ef..0c61a77 100644 --- a/riscv/mmu.h +++ b/riscv/mmu.h @@ -4,6 +4,7 @@ #include "decode.h" #include "trap.h" #include "common.h" +#include "config.h" #include "processor.h" class processor_t; diff --git a/riscv/processor.h b/riscv/processor.h index a675141..1e007a8 100644 --- a/riscv/processor.h +++ b/riscv/processor.h @@ -4,6 +4,7 @@ #include "decode.h" #include #include "trap.h" +#include "config.h" #define MAX_UTS 2048 @@ -87,4 +88,18 @@ private: #include "dispatch.h" }; +#ifndef RISCV_ENABLE_RVC +# define set_pc(x) \ + do { if((x) & (sizeof(insn_t)-1)) \ + { badvaddr = (x); throw trap_instruction_address_misaligned; } \ + npc = (x); \ + } while(0) +#else +# define set_pc(x) \ + do { if((x) & ((sr & SR_EC) ? 1 : 3)) \ + { badvaddr = (x); throw trap_instruction_address_misaligned; } \ + npc = (x); \ + } while(0) +#endif + #endif -- 2.30.2