5 #include "opcode/mn10300.h"
7 #include "remote-sim.h"
9 extern host_callback *mn10300_callback;
11 #define DEBUG_TRACE 0x00000001
12 #define DEBUG_VALUES 0x00000002
14 extern int mn10300_debug;
17 typedef unsigned char uint8;
18 typedef signed char int8;
20 #error "Char is not an 8-bit type"
24 typedef unsigned short uint16;
25 typedef signed short int16;
27 #error "Short is not a 16-bit type"
30 #if INT_MAX == 2147483647
32 typedef unsigned int uint32;
33 typedef signed int int32;
36 # if LONG_MAX == 2147483647
38 typedef unsigned long uint32;
39 typedef signed long int32;
42 # error "Neither int nor long is a 32-bit type"
59 /* The current state of the processor; registers, memory, etc. */
63 reg_t regs[15]; /* registers, d0-d3, a0-a3, sp, pc, mdr, psw,
65 uint8 *mem; /* main memory */
70 extern struct simops Simops[];
72 #define PC (State.regs[9])
74 #define PSW (State.regs[11])
90 #define SEXT3(x) ((((x)&0x7)^(~0x3))+0x4)
92 /* sign-extend a 4-bit number */
93 #define SEXT4(x) ((((x)&0xf)^(~0x7))+0x8)
95 /* sign-extend a 5-bit number */
96 #define SEXT5(x) ((((x)&0x1f)^(~0xf))+0x10)
98 /* sign-extend an 8-bit number */
99 #define SEXT8(x) ((((x)&0xff)^(~0x7f))+0x80)
101 /* sign-extend a 9-bit number */
102 #define SEXT9(x) ((((x)&0x1ff)^(~0xff))+0x100)
104 /* sign-extend a 16-bit number */
105 #define SEXT16(x) ((((x)&0xffff)^(~0x7fff))+0x8000)
107 /* sign-extend a 22-bit number */
108 #define SEXT22(x) ((((x)&0x3fffff)^(~0x1fffff))+0x200000)
110 #define MAX32 0x7fffffffLL
111 #define MIN32 0xff80000000LL
112 #define MASK32 0xffffffffLL
113 #define MASK40 0xffffffffffLL
115 #define RLW(x) load_mem (x, 4)
122 /* Function declarations. */
124 uint32 get_word PARAMS ((uint8 *));
125 uint16 get_half PARAMS ((uint8 *));
126 uint8 get_byte PARAMS ((uint8 *));
127 void put_word PARAMS ((uint8 *, uint32));
128 void put_half PARAMS ((uint8 *, uint16));
129 void put_byte PARAMS ((uint8 *, uint8));
131 extern uint32 load_mem PARAMS ((SIM_ADDR addr, int len));
132 extern void store_mem PARAMS ((SIM_ADDR addr, int len, uint32 data));
134 extern uint8 *map PARAMS ((SIM_ADDR addr));