-#include <signal.h>
#include "sim-main.h"
#include "v850_sim.h"
#include "simops.h"
#endif
#endif
-
-
-
-
- /* FIXME - should be including a version of syscall.h that does not
- pollute the name space */
-#include "../../libgloss/v850/sys/syscall.h"
+#include "targ-vals.h"
#include "libiberty.h"
#include <sys/time.h>
#endif
-/* start-sanitize-v850e */
/* This is an array of the bit positions of registers r20 .. r31 in
that order in a prepare/dispose instruction. */
int type1_regs[12] = { 27, 26, 25, 24, 31, 30, 29, 28, 23, 22, 0, 21 };
-/* end-sanitize-v850e */
-/* start-sanitize-v850eq */
/* This is an array of the bit positions of registers r16 .. r31 in
that order in a push/pop instruction. */
int type2_regs[16] = { 3, 2, 1, 0, 27, 26, 25, 24, 31, 30, 29, 28, 23, 22, 20, 21};
/* This is an array of the bit positions of registers r1 .. r15 in
that order in a push/pop instruction. */
int type3_regs[15] = { 2, 1, 0, 27, 26, 25, 24, 31, 30, 29, 28, 23, 22, 20, 21};
-/* end-sanitize-v850eq */
#ifdef DEBUG
#ifndef SIZE_INSTRUCTION
int trace_num_values;
unsigned32 trace_pc;
const char *trace_name;
-const char *trace_module;
+int trace_module;
void
trace_pc = PC;
trace_name = name;
- trace_module = "alu";
+ trace_module = TRACE_ALU_IDX;
switch (type)
{
trace_num_values = 1;
break;
- /* start-sanitize-v850e */
case OP_BIT_CHANGE:
- /* end-sanitize-v850e */
case OP_REG_REG:
case OP_REG_REG_CMP:
trace_values[0] = State.regs[OP[1]];
if (has_result)
sprintf (chp, " :: 0x%.8lx", (unsigned long)result);
- trace_one_insn (simulator, STATE_CPU (simulator, 0), trace_pc,
- TRACE_LINENUM_P (STATE_CPU (simulator, 0)),
- "simops", __LINE__, trace_module,
- "%-*s -%s", SIZE_INSTRUCTION, trace_name, buf);
+ trace_generic (simulator, STATE_CPU (simulator, 0), trace_module, buf);
}
void
return 1;
}
-/* start-sanitize-v850e */
static unsigned long
Add32 (unsigned long a1, unsigned long a2, int * carry)
return;
}
-/* end-sanitize-v850e */
\f
/* Read a null terminated string from memory, return in a buffer */
static char *
char *buf;
int nr = 0;
while (sim_core_read_1 (STATE_CPU (sd, 0),
- PC, sim_core_read_map, addr + nr) != 0)
+ PC, read_map, addr + nr) != 0)
nr++;
buf = NZALLOC (char, nr + 1);
sim_read (simulator, addr, buf, nr);
while (1)
{
unsigned32 a = sim_core_read_4 (STATE_CPU (sd, 0),
- PC, sim_core_read_map, addr + nr * 4);
+ PC, read_map, addr + nr * 4);
if (a == 0) break;
buf[nr] = fetch_str (sd, a);
nr ++;
/* FIXME this should put processor into a mode where NMI still handled */
trace_output (OP_NONE);
sim_engine_halt (simulator, STATE_CPU (simulator, 0), NULL, PC,
- sim_stopped, SIGTRAP);
+ sim_stopped, SIM_SIGTRAP);
return 0;
}
{
#ifdef HAVE_FORK
-#ifdef SYS_fork
- case SYS_fork:
+#ifdef TARGET_SYS_fork
+ case TARGET_SYS_fork:
RETVAL = fork ();
break;
#endif
#endif
#ifdef HAVE_EXECVE
-#ifdef SYS_execv
- case SYS_execve:
+#ifdef TARGET_SYS_execv
+ case TARGET_SYS_execve:
{
char *path = fetch_str (simulator, PARM1);
char **argv = fetch_argv (simulator, PARM2);
#endif
#if HAVE_EXECV
-#ifdef SYS_execv
- case SYS_execv:
+#ifdef TARGET_SYS_execv
+ case TARGET_SYS_execv:
{
char *path = fetch_str (simulator, PARM1);
char **argv = fetch_argv (simulator, PARM2);
#endif
#if 0
-#ifdef SYS_pipe
- case SYS_pipe:
+#ifdef TARGET_SYS_pipe
+ case TARGET_SYS_pipe:
{
reg_t buf;
int host_fd[2];
#endif
#if 0
-#ifdef SYS_wait
- case SYS_wait:
+#ifdef TARGET_SYS_wait
+ case TARGET_SYS_wait:
{
int status;
#endif
#endif
-#ifdef SYS_read
- case SYS_read:
+#ifdef TARGET_SYS_read
+ case TARGET_SYS_read:
{
char *buf = zalloc (PARM3);
RETVAL = sim_io_read (simulator, PARM1, buf, PARM3);
}
#endif
-#ifdef SYS_write
- case SYS_write:
+#ifdef TARGET_SYS_write
+ case TARGET_SYS_write:
{
char *buf = zalloc (PARM3);
sim_read (simulator, PARM2, buf, PARM3);
}
#endif
-#ifdef SYS_lseek
- case SYS_lseek:
+#ifdef TARGET_SYS_lseek
+ case TARGET_SYS_lseek:
RETVAL = sim_io_lseek (simulator, PARM1, PARM2, PARM3);
break;
#endif
-#ifdef SYS_close
- case SYS_close:
+#ifdef TARGET_SYS_close
+ case TARGET_SYS_close:
RETVAL = sim_io_close (simulator, PARM1);
break;
#endif
-#ifdef SYS_open
- case SYS_open:
+#ifdef TARGET_SYS_open
+ case TARGET_SYS_open:
{
char *buf = fetch_str (simulator, PARM1);
RETVAL = sim_io_open (simulator, buf, PARM2);
}
#endif
-#ifdef SYS_exit
- case SYS_exit:
+#ifdef TARGET_SYS_exit
+ case TARGET_SYS_exit:
if ((PARM1 & 0xffff0000) == 0xdead0000 && (PARM1 & 0xffff) != 0)
/* get signal encoded by kill */
sim_engine_halt (simulator, STATE_CPU (simulator, 0), NULL, PC,
else if (PARM1 == 0xdead)
/* old libraries */
sim_engine_halt (simulator, STATE_CPU (simulator, 0), NULL, PC,
- sim_exited, SIGABRT);
+ sim_stopped, SIM_SIGABRT);
else
/* PARM1 has exit status */
sim_engine_halt (simulator, STATE_CPU (simulator, 0), NULL, PC,
#endif
#if !defined(__GO32__) && !defined(_WIN32)
-#ifdef SYS_stat
- case SYS_stat: /* added at hmsi */
+#ifdef TARGET_SYS_stat
+ case TARGET_SYS_stat: /* added at hmsi */
/* stat system call */
{
struct stat host_stat;
#endif
#ifdef HAVE_CHOWN
-#ifdef SYS_chown
- case SYS_chown:
+#ifdef TARGET_SYS_chown
+ case TARGET_SYS_chown:
{
char *path = fetch_str (simulator, PARM1);
RETVAL = chown (path, PARM2, PARM3);
#endif
#if HAVE_CHMOD
-#ifdef SYS_chmod
- case SYS_chmod:
+#ifdef TARGET_SYS_chmod
+ case TARGET_SYS_chmod:
{
char *path = fetch_str (simulator, PARM1);
RETVAL = chmod (path, PARM2);
#endif
#endif
-#ifdef SYS_time
+#ifdef TARGET_SYS_time
#if HAVE_TIME
- case SYS_time:
+ case TARGET_SYS_time:
{
time_t now;
RETVAL = time (&now);
#endif
#if !defined(__GO32__) && !defined(_WIN32)
-#ifdef SYS_times
- case SYS_times:
+#ifdef TARGET_SYS_times
+ case TARGET_SYS_times:
{
struct tms tms;
RETVAL = times (&tms);
#endif
#endif
-#ifdef SYS_gettimeofday
+#ifdef TARGET_SYS_gettimeofday
#if !defined(__GO32__) && !defined(_WIN32)
- case SYS_gettimeofday:
+ case TARGET_SYS_gettimeofday:
{
struct timeval t;
struct timezone tz;
#endif
#endif
-#ifdef SYS_utime
+#ifdef TARGET_SYS_utime
#if HAVE_UTIME
- case SYS_utime:
+ case TARGET_SYS_utime:
{
/* Cast the second argument to void *, to avoid type mismatch
if a prototype is present. */
}
}
-/* start-sanitize-v850e */
/* tst1 reg2, [reg1] */
int
OP_E607E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* mulu reg1, reg2, reg3 */
int
OP_22207E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
-
#define BIT_CHANGE_OP( name, binop ) \
unsigned int bit; \
unsigned int temp; \
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850eq */
-/* This function is courtesy of Sugimoto at NEC, via Seow Tan (Soew_Tan@el.nec.com) */
+
+/* This function is courtesy of Sugimoto at NEC, via Seow Tan
+ (Soew_Tan@el.nec.com) */
void
divun
(
unsigned int N,
unsigned long int als,
unsigned long int sfi,
- unsigned long int * quotient_ptr,
- unsigned long int * remainder_ptr,
+ unsigned32 /*unsigned long int*/ * quotient_ptr,
+ unsigned32 /*unsigned long int*/ * remainder_ptr,
boolean * overflow_ptr
)
{
unsigned int N,
unsigned long int als,
unsigned long int sfi,
- signed long int * quotient_ptr,
- signed long int * remainder_ptr,
+ signed32 /*signed long int*/ * quotient_ptr,
+ signed32 /*signed long int*/ * remainder_ptr,
boolean * overflow_ptr
)
{
int
OP_1C207E0 (void)
{
- unsigned long int quotient;
- unsigned long int remainder;
+ unsigned32 /*unsigned long int*/ quotient;
+ unsigned32 /*unsigned long int*/ remainder;
unsigned long int divide_by;
unsigned long int divide_this;
boolean overflow = false;
int
OP_1C007E0 (void)
{
- signed long int quotient;
- signed long int remainder;
+ signed32 /*signed long int*/ quotient;
+ signed32 /*signed long int*/ remainder;
signed long int divide_by;
signed long int divide_this;
boolean overflow = false;
int
OP_18207E0 (void)
{
- unsigned long int quotient;
- unsigned long int remainder;
+ unsigned32 /*unsigned long int*/ quotient;
+ unsigned32 /*unsigned long int*/ remainder;
unsigned long int divide_by;
unsigned long int divide_this;
boolean overflow = false;
int
OP_18007E0 (void)
{
- signed long int quotient;
- signed long int remainder;
+ signed32 /*signed long int*/ quotient;
+ signed32 /*signed long int*/ remainder;
signed long int divide_by;
signed long int divide_this;
boolean overflow = false;
return 4;
}
-/* end-sanitize-v850eq */
-/* start-sanitize-v850e */
/* divu reg1, reg2, reg3 */
int
OP_2C207E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* div reg1, reg2, reg3 */
int
OP_2C007E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* divhu reg1, reg2, reg3 */
int
OP_28207E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* divh reg1, reg2, reg3 */
int
OP_28007E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* mulu imm9, reg2, reg3 */
int
OP_24207E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* mul imm9, reg2, reg3 */
int
OP_24007E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* ld.hu */
int
OP_107E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
+
/* ld.bu */
int
OP_10780 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850e */
/* mul reg1, reg2, reg3 */
int
OP_22007E0 (void)
return 4;
}
-/* end-sanitize-v850e */
-/* start-sanitize-v850eq */
-
/* popmh list18 */
int
OP_307F0 (void)
return 4;
}
-/* end-sanitize-v850eq */