static char *myname;
static SIM_OPEN_KIND sim_kind;
-static bfd_vma start_address;
int d10v_debug;
host_callback *d10v_callback;
unsigned long ins_type_counters[ (int)INS_MAX ];
static void do_2_short PARAMS ((uint16 ins1, uint16 ins2, enum _leftright leftright));
static void do_parallel PARAMS ((uint16 ins1, uint16 ins2));
static char *add_commas PARAMS ((char *buf, int sizeof_buf, unsigned long value));
-extern void sim_size PARAMS ((int power));
static void init_system PARAMS ((void));
extern void sim_set_profile PARAMS ((int n));
extern void sim_set_profile_size PARAMS ((int n));
}
+static int
+sim_write_phys (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char *buffer;
+ int size;
+{
+ return xfer_mem( addr, buffer, size, 1);
+}
+
int
sim_write (sd, addr, buffer, size)
SIM_DESC sd;
unsigned char *buffer;
int size;
{
+ /* FIXME: this should be performing a virtual transfer */
return xfer_mem( addr, buffer, size, 1);
}
unsigned char *buffer;
int size;
{
+ /* FIXME: this should be performing a virtual transfer */
return xfer_mem( addr, buffer, size, 0);
}
SIM_DESC
-sim_open (kind, argv)
+sim_open (kind, callback, abfd, argv)
SIM_OPEN_KIND kind;
+ host_callback *callback;
+ struct _bfd *abfd;
char **argv;
{
struct simops *s;
char **p;
sim_kind = kind;
+ d10v_callback = callback;
myname = argv[0];
for (p = argv + 1; *p; ++p)
{
- /* Ignore endian specification. */
- if (strcmp (*p, "-E") == 0)
- ++p;
- else
#ifdef DEBUG
if (strcmp (*p, "-t") == 0)
d10v_debug = DEBUG;
return 0;
}
+ /* Discard upper bit(s) of PC in case IMAP1 selects unified memory. */
+ pc &= (1 << UMEM_SIZE) - 1;
+
return State.umem[imap & 0xff] + pc;
}
{
RPT_C -= 1;
if (RPT_C == 0)
- State.RP = 0;
+ {
+ State.RP = 0;
+ PC++;
+ }
else
PC = RPT_S;
}
}
SIM_RC
-sim_create_inferior (sd, argv, env)
+sim_create_inferior (sd, abfd, argv, env)
SIM_DESC sd;
+ struct _bfd *abfd;
char **argv;
char **env;
{
-#ifdef DEBUG
- if (d10v_debug)
- (*d10v_callback->printf_filtered) (d10v_callback, "sim_create_inferior: PC=0x%x\n", start_address);
-#endif
+ bfd_vma start_address;
/* reset all state information */
memset (&State.regs, 0, (int)&State.imem - (int)&State.regs[0]);
/* set PC */
+ if (abfd != NULL)
+ start_address = bfd_get_start_address (prog_bfd);
+ else
+ start_address = 0xffc0 << 2;
+#ifdef DEBUG
+ if (d10v_debug)
+ (*d10v_callback->printf_filtered) (d10v_callback, "sim_create_inferior: PC=0x%lx\n", (long) start_address);
+#endif
PC = start_address >> 2;
/* cpu resets imap0 to 0 and imap1 to 0x7f, but D10V-EVA board */
void
-sim_kill (sd)
- SIM_DESC sd;
-{
- /* nothing to do */
-}
-
-void
-sim_set_callbacks (sd, p)
- SIM_DESC sd;
+sim_set_callbacks (p)
host_callback *p;
{
d10v_callback = p;
if (prog_bfd != NULL && prog_bfd_was_opened_p)
bfd_close (prog_bfd);
prog_bfd = sim_load_file (sd, myname, d10v_callback, prog, abfd,
- sim_kind == SIM_OPEN_DEBUG);
+ sim_kind == SIM_OPEN_DEBUG,
+ 0, sim_write_phys);
if (prog_bfd == NULL)
return SIM_RC_FAIL;
- start_address = bfd_get_start_address (prog_bfd);
prog_bfd_was_opened_p = abfd == NULL;
return SIM_RC_OK;
}