aboutsummaryrefslogtreecommitdiff
path: root/sim/v850/v850_sim.h
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1996-09-03 16:25:51 +0000
committerJeff Law <law@redhat.com>1996-09-03 16:25:51 +0000
commitd81352b8b83eb8cd3f4d81860580e9ba7864834a (patch)
tree9b9c14d642dfcc790749936fd322bb1e8cf89354 /sim/v850/v850_sim.h
parent7b0af209eb7abe65c5f10bf3f528b9f22de53654 (diff)
downloadgdb-d81352b8b83eb8cd3f4d81860580e9ba7864834a.zip
gdb-d81352b8b83eb8cd3f4d81860580e9ba7864834a.tar.gz
gdb-d81352b8b83eb8cd3f4d81860580e9ba7864834a.tar.bz2
* interp.c: OP should be an array of 32bit operands!
(v850_callback): Declare. (do_format_5): Fix extraction of OP[0]. (sim_size): Remove debugging printf. (sim_set_callbacks): Do something useful. (sim_stop_reason): Gross hacks to get c-torture running. * simops.c: Simplify code for computing targets of bCC insns. Invert 's' bit if 'ov' bit is set for some instructions. Fix 'cy' bit handling for numerous instructions. Make the simulator stop when a halt instruction is encountered. Very crude support for emulated syscalls (trap 0). * v850_sim.h: Include "callback.h" and declare v850_callback. Items in the operand array are 32bits. Fixes & syscall stuff.
Diffstat (limited to 'sim/v850/v850_sim.h')
-rw-r--r--sim/v850/v850_sim.h39
1 files changed, 15 insertions, 24 deletions
diff --git a/sim/v850/v850_sim.h b/sim/v850/v850_sim.h
index be0f1b6..e4b7746 100644
--- a/sim/v850/v850_sim.h
+++ b/sim/v850/v850_sim.h
@@ -1,8 +1,11 @@
#include <stdio.h>
#include <ctype.h>
#include "ansidecl.h"
+#include "callback.h"
#include "opcode/v850.h"
+extern host_callback *v850_callback;
+
/* FIXME: host defines */
typedef unsigned char uint8;
typedef unsigned short uint16;
@@ -29,12 +32,11 @@ struct _state
reg_t regs[32]; /* general-purpose registers */
reg_t sregs[32]; /* system regsiters, including psw */
reg_t pc;
- uint8 *imem;
- uint8 *dmem;
+ uint8 *mem;
int exception;
} State;
-extern uint16 OP[4];
+extern uint32 OP[4];
extern struct simops Simops[];
#define PC (State.pc)
@@ -78,33 +80,22 @@ extern struct simops Simops[];
#define INC_ADDR(x,i) x = ((State.MD && x == MOD_E) ? MOD_S : (x)+(i))
-#define RB(x) (*((uint8 *)((x)+State.imem)))
+#define RB(x) (*((uint8 *)((x)+State.mem)))
#define SB(addr,data) ( RB(addr) = (data & 0xff))
#ifdef WORDS_BIGENDIAN
-#define RW(x) (*((uint16 *)((x)+State.imem)))
-#define RLW(x) (*((uint32 *)((x)+State.imem)))
-#define SW(addr,data) RW(addr)=data
-#define READ_16(x) (*((int16 *)(x)))
-#define WRITE_16(addr,data) (*(int16 *)(addr)=data)
-#define READ_64(x) (*((int64 *)(x)))
-#define WRITE_64(addr,data) (*(int64 *)(addr)=data)
+uint32 get_word PARAMS ((uint8 *));
+uint16 get_half PARAMS ((uint8 *));
+uint8 get_byte PARAMS ((uint8 *));
+#define RLW(x) (*((uint32 *)((x)+State.mem)))
#else
-uint32 get_longword PARAMS ((uint8 *));
-uint16 get_word PARAMS ((uint8 *));
-int64 get_longlong PARAMS ((uint8 *));
-void write_word PARAMS ((uint8 *addr, uint16 data));
-void write_longlong PARAMS ((uint8 *addr, int64 data));
-
-#define SW(addr,data) write_word((long)(addr)+State.imem,data)
-#define RW(x) get_word((long)(x)+State.imem)
-#define RLW(x) get_longword((long)(x)+State.imem)
-#define READ_16(x) get_word(x)
-#define WRITE_16(addr,data) write_word(addr,data)
-#define READ_64(x) get_longlong(x)
-#define WRITE_64(addr,data) write_longlong(addr,data)
+uint32 get_word PARAMS ((uint8 *));
+uint16 get_half PARAMS ((uint8 *));
+uint8 get_byte PARAMS ((uint8 *));
+
+#define RLW(x) get_word((long)(x)+State.mem)
#endif /* not WORDS_BIGENDIAN */