sim: cr16: push down sd/cpu vars
[external/binutils.git] / sim / cr16 / cr16_sim.h
index e9769ac..5167ade 100644 (file)
@@ -66,7 +66,7 @@ struct simops
   uint32 opcode;
   int format;
   char fname[12];
-  void (*func)();
+  void (*func)(SIM_DESC, SIM_CPU *);
   int numops;
   operand_desc operands[4];
 };
@@ -251,8 +251,8 @@ struct _state
 
   creg_t cregs[16];            /* control registers */
 #define CREG(N) (State.cregs[(N)] + 0)
-#define SET_CREG(N,VAL) move_to_cr ((N), 0, (VAL), 0)
-#define SET_HW_CREG(N,VAL) move_to_cr ((N), 0, (VAL), 1)
+#define SET_CREG(N,VAL) move_to_cr (sd, cpu, (N), 0, (VAL), 0)
+#define SET_HW_CREG(N,VAL) move_to_cr (sd, cpu, (N), 0, (VAL), 1)
 
   reg_t sp[2];                  /* holding area for SPI(0)/SPU(1) */
 #define HELD_SP(N) (State.sp[(N)] + 0)
@@ -318,7 +318,7 @@ enum
 #define PSR CREG (PSR_CR)
 #define SET_PSR(VAL) SET_CREG (PSR_CR, (VAL))
 #define SET_HW_PSR(VAL) SET_HW_CREG (PSR_CR, (VAL))
-#define SET_PSR_BIT(MASK,VAL) move_to_cr (PSR_CR, ~((creg_t) MASK), (VAL) ? (MASK) : 0, 1)
+#define SET_PSR_BIT(MASK,VAL) move_to_cr (sd, cpu, PSR_CR, ~((creg_t) MASK), (VAL) ? (MASK) : 0, 1)
 
 #define PSR_SM ((PSR & PSR_SM_BIT) != 0)
 #define SET_PSR_SM(VAL) SET_PSR_BIT (PSR_SM_BIT, (VAL))
@@ -421,11 +421,11 @@ enum
 /* sign-extend a 32-bit number */
 #define SEXT32(x)      ((((x)&0xffffffff)^(~0x7fffffff))+0x80000000)
 
-extern uint8 *dmem_addr (uint32 offset);
-extern uint8 *imem_addr (uint32);
+extern uint8 *dmem_addr (SIM_DESC, SIM_CPU *, uint32 offset);
+extern uint8 *imem_addr (SIM_DESC, SIM_CPU *, uint32);
 extern bfd_vma decode_pc (void);
 
-#define        RB(x)   (*(dmem_addr(x)))
+#define        RB(x)   (*(dmem_addr (sd, cpu, x)))
 #define SB(addr,data)  ( RB(addr) = (data & 0xff))
 
 #if defined(__GNUC__) && defined(__OPTIMIZE__) && !defined(NO_ENDIAN_INLINE)
@@ -440,10 +440,10 @@ extern void write_word (uint8 *addr, uint16 data);
 extern void write_longword (uint8 *addr, uint32 data);
 #endif
 
-#define SW(addr,data)          write_word(dmem_addr(addr),data)
-#define RW(x)                  get_word(dmem_addr(x))
-#define SLW(addr,data)         write_longword(dmem_addr(addr),data)
-#define RLW(x)                 get_longword(dmem_addr(x))
+#define SW(addr,data)          write_word (dmem_addr (sd, cpu, addr), data)
+#define RW(x)                  get_word (dmem_addr (sd, cpu, x))
+#define SLW(addr,data)         write_longword (dmem_addr (sd, cpu, addr), data)
+#define RLW(x)                 get_longword (dmem_addr (sd, cpu, x))
 #define READ_16(x)             get_word(x)
 
 #define JMP(x)                 do { SET_PC (x); State.pc_changed = 1; } while (0)
@@ -467,7 +467,7 @@ extern void write_longword (uint8 *addr, uint32 data);
    (VAL & ~MASK)).  In addition, unless PSR_HW_P, a VAL intended for
    PSR is masked for zero bits. */
 
-extern creg_t move_to_cr (int cr, creg_t mask, creg_t val, int psw_hw_p);
+extern creg_t move_to_cr (SIM_DESC, SIM_CPU *, int cr, creg_t mask, creg_t val, int psw_hw_p);
 
 #ifndef SIGTRAP
 #define SIGTRAP 5