5 #include "opcode/mn10200.h"
7 #include "remote-sim.h"
17 extern host_callback
*mn10200_callback
;
19 #define DEBUG_TRACE 0x00000001
20 #define DEBUG_VALUES 0x00000002
22 extern int mn10200_debug
;
31 typedef unsigned char uint8
;
32 typedef SIGNED
char int8
;
34 error
"Char is not an 8-bit type"
38 typedef unsigned short uint16
;
39 typedef SIGNED
short int16
;
41 error
"Short is not a 16-bit type"
44 #if INT_MAX == 2147483647
46 typedef unsigned int uint32
;
47 typedef SIGNED
int int32
;
50 # if LONG_MAX == 2147483647
52 typedef unsigned long uint32
;
53 typedef SIGNED
long int32
;
56 error
"Neither int nor long is a 32-bit type"
73 /* The current state of the processor; registers, memory, etc. */
77 reg_t regs
[11]; /* registers, d0-d3, a0-a3, pc, mdr, psw */
78 uint8
*mem
; /* main memory */
79 int exception
; /* Actually a signal number. */
80 int exited
; /* Did the program exit? */
84 extern struct simops Simops
[];
86 #define PC (State.regs[8])
88 #define PSW (State.regs[10])
105 #define SEXT3(x) ((((x)&0x7)^(~0x3))+0x4)
107 /* sign-extend a 4-bit number */
108 #define SEXT4(x) ((((x)&0xf)^(~0x7))+0x8)
110 /* sign-extend a 5-bit number */
111 #define SEXT5(x) ((((x)&0x1f)^(~0xf))+0x10)
113 /* sign-extend an 8-bit number */
114 #define SEXT8(x) ((((x)&0xff)^(~0x7f))+0x80)
116 /* sign-extend a 9-bit number */
117 #define SEXT9(x) ((((x)&0x1ff)^(~0xff))+0x100)
119 /* sign-extend a 16-bit number */
120 #define SEXT16(x) ((((x)&0xffff)^(~0x7fff))+0x8000)
122 /* sign-extend a 22-bit number */
123 #define SEXT22(x) ((((x)&0x3fffff)^(~0x1fffff))+0x200000)
125 /* sign-extend a 24-bit number */
126 #define SEXT24(x) ((((x)&0xffffff)^(~0x7fffff))+0x800000)
135 #define load_mem_big(addr,len) \
136 (len == 1 ? *(((addr) & 0xffffff) + State.mem) : \
137 len == 2 ? ((*(((addr) & 0xffffff) + State.mem) << 8) \
138 | *((((addr) + 1) & 0xffffff) + State.mem)) : \
139 ((*(((addr) & 0xffffff) + State.mem) << 16) \
140 | (*((((addr) + 1) & 0xffffff) + State.mem) << 8) \
141 | *((((addr) + 2) & 0xffffff) + State.mem)))
147 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
150 if ((addr
& 0xffffff) > max_mem
)
161 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
164 if ((addr
& 0xffffff) > max_mem
)
168 return p
[1] << 8 | p
[0];
175 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
178 if ((addr
& 0xffffff) > max_mem
)
182 return p
[2] << 16 | p
[1] << 8 | p
[0];
189 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
192 if ((addr
& 0xffffff) > max_mem
)
196 return p
[3] << 24 | p
[2] << 16 | p
[1] << 8 | p
[0];
204 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
207 if ((addr
& 0xffffff) > max_mem
)
216 return p
[1] << 8 | p
[0];
218 return p
[2] << 16 | p
[1] << 8 | p
[0];
220 return p
[3] << 24 | p
[2] << 16 | p
[1] << 8 | p
[0];
227 store_byte (addr
, data
)
231 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
234 if ((addr
& 0xffffff) > max_mem
)
242 store_half (addr
, data
)
246 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
249 if ((addr
& 0xffffff) > max_mem
)
258 store_3_byte (addr
, data
)
262 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
265 if ((addr
& 0xffffff) > max_mem
)
275 store_word (addr
, data
)
279 uint8
*p
= (addr
& 0xffffff) + State
.mem
;
282 if ((addr
& 0xffffff) > max_mem
)
292 /* Function declarations. */
294 uint32 get_word
PARAMS ((uint8
*));
295 void put_word
PARAMS ((uint8
*, uint32
));
297 extern uint8
*map
PARAMS ((SIM_ADDR addr
));
This page took 0.035646 seconds and 4 git commands to generate.