aboutsummaryrefslogtreecommitdiff
path: root/sim/v850/v850_sim.h
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-10-24 17:39:30 +0000
committerStu Grossman <grossman@cygnus>1996-10-24 17:39:30 +0000
commit968519095a3386323bb7ef7f88583e6ed902e691 (patch)
tree9d68fdba03f4a9d8de08e5361f9b5655c43e8437 /sim/v850/v850_sim.h
parent139e2c0f92e06fcca01a815614c46a53e93a2f55 (diff)
downloadgdb-968519095a3386323bb7ef7f88583e6ed902e691.zip
gdb-968519095a3386323bb7ef7f88583e6ed902e691.tar.gz
gdb-968519095a3386323bb7ef7f88583e6ed902e691.tar.bz2
* Makefile.in: Get rid of srcroot. Set all INSTALL macros via
autoconf. * gencode.c (write_opcodes): Pad operands field to account for MSVC braindamage. * simops.c: Include errno.h. Exclude SYS_chown, since MSVC doesn't support it. (Why is this here in the first place?!?) * v850_sim.h: Get rid of 64 bit defs. Also, get rid of #elif's. Change number of operands in struct simops from 9 to 6. Define SIGTRAP and SIGQUIT for MSVC.
Diffstat (limited to 'sim/v850/v850_sim.h')
-rw-r--r--sim/v850/v850_sim.h78
1 files changed, 60 insertions, 18 deletions
diff --git a/sim/v850/v850_sim.h b/sim/v850/v850_sim.h
index e4b7746..641c9e5 100644
--- a/sim/v850/v850_sim.h
+++ b/sim/v850/v850_sim.h
@@ -3,17 +3,45 @@
#include "ansidecl.h"
#include "callback.h"
#include "opcode/v850.h"
+#include <limits.h>
+#include "remote-sim.h"
extern host_callback *v850_callback;
-/* FIXME: host defines */
+#define DEBUG_TRACE 0x00000001
+#define DEBUG_VALUES 0x00000002
+
+extern int v850_debug;
+
+#if UCHAR_MAX == 255
typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
typedef signed char int8;
+#else
+#error "Char is not an 8-bit type"
+#endif
+
+#if SHRT_MAX == 32767
+typedef unsigned short uint16;
typedef signed short int16;
+#else
+#error "Short is not a 16-bit type"
+#endif
+
+#if INT_MAX == 2147483647
+
+typedef unsigned int uint32;
typedef signed int int32;
-typedef signed long long int64;
+
+#else
+# if LONG_MAX == 2147483647
+
+typedef unsigned long uint32;
+typedef signed long int32;
+
+# else
+# error "Neither int nor long is a 32-bit type"
+# endif
+#endif
/* FIXME: V850 defines */
typedef uint32 reg_t;
@@ -24,7 +52,7 @@ struct simops
long mask;
void (*func)();
int numops;
- int operands[9];
+ int operands[6];
};
struct _state
@@ -50,17 +78,29 @@ extern struct simops Simops[];
#define PSW_S 0x2
#define PSW_Z 0x1
-#define SEXT3(x) ((((x)&0x7)^(~3))+4)
+#define SEXT3(x) ((((x)&0x7)^(~0x3))+0x4)
/* sign-extend a 4-bit number */
-#define SEXT4(x) ((((x)&0xf)^(~7))+8)
+#define SEXT4(x) ((((x)&0xf)^(~0x7))+0x8)
+
+/* sign-extend a 5-bit number */
+#define SEXT5(x) ((((x)&0x1f)^(~0xf))+0x10)
+
+/* sign-extend a 7-bit number */
+#define SEXT7(x) ((((x)&0x7f)^(~0x4f))+0x40)
/* sign-extend an 8-bit number */
#define SEXT8(x) ((((x)&0xff)^(~0x7f))+0x80)
+/* sign-extend a 9-bit number */
+#define SEXT9(x) ((((x)&0x1ff)^(~0xff))+0x100)
+
/* sign-extend a 16-bit number */
#define SEXT16(x) ((((x)&0xffff)^(~0x7fff))+0x8000)
+/* sign-extend a 22-bit number */
+#define SEXT22(x) ((((x)&0x3fffff)^(~0x1fffff))+0x200000)
+
/* sign-extend a 32-bit number */
#define SEXT32(x) ((((x)&0xffffffffLL)^(~0x7fffffffLL))+0x80000000LL)
@@ -80,22 +120,24 @@ 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.mem)))
-#define SB(addr,data) ( RB(addr) = (data & 0xff))
-
-#ifdef WORDS_BIGENDIAN
+/*#define RB(x) (*((uint8 *)((x)+State.mem)))*/
+/*#define SB(addr,data) ( RB(addr) = (data & 0xff))*/
uint32 get_word PARAMS ((uint8 *));
uint16 get_half PARAMS ((uint8 *));
uint8 get_byte PARAMS ((uint8 *));
-#define RLW(x) (*((uint32 *)((x)+State.mem)))
+void put_word PARAMS ((uint8 *, uint32));
+void put_half PARAMS ((uint8 *, uint16));
+void put_byte PARAMS ((uint8 *, uint8));
-#else
+uint32 load_mem PARAMS ((SIM_ADDR addr, int len));
+void store_mem PARAMS ((SIM_ADDR addr, int len, uint32 data));
-uint32 get_word PARAMS ((uint8 *));
-uint16 get_half PARAMS ((uint8 *));
-uint8 get_byte PARAMS ((uint8 *));
+uint8 *map PARAMS ((SIM_ADDR addr));
-#define RLW(x) get_word((long)(x)+State.mem)
+#define RLW(x) load_mem (x, 4)
-#endif /* not WORDS_BIGENDIAN */
+#ifdef _WIN32
+#define SIGTRAP 5
+#define SIGQUIT 3
+#endif