aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/v850/ChangeLog11
-rw-r--r--sim/v850/interp.c42
-rw-r--r--sim/v850/simops.c34
3 files changed, 43 insertions, 44 deletions
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index fa8e4d7..771b6d8 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,14 @@
+Mon Sep 9 20:50:46 1996 Jeffrey A Law (law@cygnus.com)
+
+ * interp.c (hash): Make this an inline function
+ when compiling with GCC. Simplify.
+ * simpos.c: Explicitly include "sys/syscall.h". Remove
+ some #if 0'd code. Enable more emulated syscalls.
+
+Wed Sep 4 01:48:55 1996 Jeffrey A Law (law@cygnus.com)
+
+ * interp.c: Fix sign bit handling for add and sub instructions.
+
Tue Sep 3 10:20:30 1996 Jeffrey A Law (law@cygnus.com)
* gencode.c: Fix various indention & style problems.
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index bb7aa9b..b9f5a9e 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -6,6 +6,14 @@
#include "v850_sim.h"
+#ifndef INLINE
+#ifdef __GNUC__
+#define INLINE inline
+#else
+#define INLINE
+#endif
+#endif
+
#define MEM_SIZE 18 /* V850 memory size is 18 bits XXX */
host_callback *v850_callback;
@@ -14,6 +22,16 @@ host_callback *v850_callback;
uint32 OP[4];
static struct hash_entry *lookup_hash PARAMS ((uint32 ins));
+static long hash PARAMS ((long));
+static void do_format_1_2 PARAMS ((uint32));
+static void do_format_3 PARAMS ((uint32));
+static void do_format_4 PARAMS ((uint32));
+static void do_format_5 PARAMS ((uint32));
+static void do_format_6 PARAMS ((uint32));
+static void do_format_7 PARAMS ((uint32));
+static void do_format_8 PARAMS ((uint32));
+static void do_format_9_10 PARAMS ((uint32));
+static void init_system PARAMS ((void));
#define MAX_HASH 63
struct hash_entry
@@ -26,25 +44,22 @@ struct hash_entry
struct hash_entry hash_table[MAX_HASH+1];
-static long
+
+static INLINE long
hash(insn)
long insn;
{
if ((insn & 0x0600) == 0
- || (insn & 0x0700) == 0x0200)
+ || (insn & 0x0700) == 0x0200
+ || (insn & 0x0700) == 0x0600
+ || (insn & 0x0780) == 0x0700)
return (insn & 0x07e0) >> 5;
if ((insn & 0x0700) == 0x0300
|| (insn & 0x0700) == 0x0400
|| (insn & 0x0700) == 0x0500)
return (insn & 0x0780) >> 7;
- if ((insn & 0x0700) == 0x0600)
- return (insn & 0x07e0) >> 5;
- if ((insn & 0x0780) == 0x0700)
- return (insn & 0x07e0) >> 5;
if ((insn & 0x07c0) == 0x0780)
return (insn & 0x07c0) >> 6;
- if ((insn & 0x07E0) == 0x07C0)
- return (insn & 0x07e0) >> 5;
return (insn & 0x07e0) >> 5;
}
@@ -56,7 +71,7 @@ lookup_hash (ins)
h = &hash_table[hash(ins)];
- while ( (ins & h->mask) != h->opcode)
+ while ((ins & h->mask) != h->opcode)
{
if (h->next == NULL)
{
@@ -209,7 +224,7 @@ do_format_8 (insn)
}
static void
-do_formats_9_10 (insn)
+do_format_9_10 (insn)
uint32 insn;
{
struct hash_entry *h;
@@ -266,7 +281,7 @@ sim_open (args)
char *args;
{
struct simops *s;
- struct hash_entry *h, *prev;
+ struct hash_entry *h;
if (args != NULL)
printf ("sim_open %s\n",args);
@@ -317,10 +332,8 @@ sim_resume (step, siggnal)
int step, siggnal;
{
uint32 inst, opcode;
- int i;
reg_t oldpc;
-
if (step)
State.exception = SIGTRAP;
else
@@ -373,7 +386,7 @@ sim_resume (step, siggnal)
}
else
{
- do_formats_9_10 (inst);
+ do_format_9_10 (inst);
PC += 4;
}
}
@@ -449,6 +462,7 @@ sim_store_register (rn, memory)
State.regs[rn]= *(uint32 *)memory;
}
+int
sim_read (addr, buffer, size)
SIM_ADDR addr;
unsigned char *buffer;
diff --git a/sim/v850/simops.c b/sim/v850/simops.c
index 65ee98b..2c47db8 100644
--- a/sim/v850/simops.c
+++ b/sim/v850/simops.c
@@ -1,6 +1,7 @@
#include <signal.h>
#include "v850_sim.h"
#include "simops.h"
+#include "sys/syscall.h"
/* sld.b */
void
@@ -466,10 +467,6 @@ OP_1C0 ()
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
&& (op0 & 0x80000000) != (result & 0x80000000));
- /* According to the manual, 's' is inverted if 'ov'
- is set. */
- s = ov ? !s : s;
-
/* Store the result and condition codes. */
State.regs[OP[1]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
@@ -498,10 +495,6 @@ OP_240 ()
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
&& (op0 & 0x80000000) != (result & 0x80000000));
- /* According to the manual, 's' is inverted if 'ov'
- is set. */
- s = ov ? !s : s;
-
/* Store the result and condition codes. */
State.regs[OP[1]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
@@ -530,10 +523,6 @@ OP_600 ()
ov = ((op0 & 0x80000000) == (op1 & 0x80000000)
&& (op0 & 0x80000000) != (result & 0x80000000));
- /* According to the manual, 's' is inverted if 'ov'
- is set. */
- s = ov ? !s : s;
-
/* Store the result and condition codes. */
State.regs[OP[2]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
@@ -559,10 +548,6 @@ OP_1A0 ()
ov = ((op1 & 0x80000000) != (op0 & 0x80000000)
&& (op1 & 0x80000000) != (result & 0x80000000));
- /* According to the manual, 's' is inverted if 'ov'
- is set. */
- s = ov ? !s : s;
-
/* Store the result and condition codes. */
State.regs[OP[1]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
@@ -588,10 +573,6 @@ OP_180 ()
ov = ((op0 & 0x80000000) != (op1 & 0x80000000)
&& (op0 & 0x80000000) != (result & 0x80000000));
- /* According to the manual, 's' is inverted if 'ov'
- is set. */
- s = ov ? !s : s;
-
/* Store the result and condition codes. */
State.regs[OP[1]] = result;
State.sregs[5] &= ~(PSW_Z | PSW_S | PSW_CY | PSW_OV);
@@ -1411,10 +1392,6 @@ OP_10007E0 ()
if (OP[0] == 0)
{
-#if 0
- char *fstr = State.regs[2] + State.imem;
- printf (fstr,State.regs[3],State.regs[4],State.regs[5]);
-#else
int save_errno = errno;
errno = 0;
@@ -1437,7 +1414,6 @@ OP_10007E0 ()
switch (FUNC)
{
-#if 0
#if !defined(__GO32__) && !defined(_WIN32)
case SYS_fork:
RETVAL = fork ();
@@ -1449,6 +1425,7 @@ OP_10007E0 ()
case SYS_execv:
RETVAL = execve (MEMPTR (PARM1), (char **) MEMPTR (PARM2), NULL);
break;
+#if 0
case SYS_pipe:
{
reg_t buf;
@@ -1471,12 +1448,12 @@ OP_10007E0 ()
}
break;
#endif
+#endif
case SYS_read:
RETVAL = v850_callback->read (v850_callback, PARM1, MEMPTR (PARM2),
PARM3);
break;
-#endif
case SYS_write:
if (PARM1 == 1)
RETVAL = (int)v850_callback->write_stdout (v850_callback,
@@ -1485,7 +1462,6 @@ OP_10007E0 ()
RETVAL = (int)v850_callback->write (v850_callback, PARM1,
MEMPTR (PARM2), PARM3);
break;
-#if 0
case SYS_lseek:
RETVAL = v850_callback->lseek (v850_callback, PARM1, PARM2, PARM3);
break;
@@ -1495,7 +1471,6 @@ OP_10007E0 ()
case SYS_open:
RETVAL = v850_callback->open (v850_callback, MEMPTR (PARM1), PARM2);
break;
-#endif
case SYS_exit:
/* EXIT - caller can look in PARM1 to work out the
reason */
@@ -1531,6 +1506,7 @@ OP_10007E0 ()
SLW (buf+28, host_stat.st_mtime);
SLW (buf+36, host_stat.st_ctime);
}
+#endif
break;
case SYS_chown:
@@ -1544,13 +1520,11 @@ OP_10007E0 ()
if a prototype is present. */
RETVAL = utime (MEMPTR (PARM1), (void *) MEMPTR (PARM2));
break;
-#endif
default:
abort ();
}
RETERR = errno;
errno = save_errno;
-#endif
}
else if (OP[0] == 1 )
{