#include <signal.h>
#include "sysdep.h"
-#include "bfd.h"
#include "remote-sim.h"
#include "d10v_sim.h"
uint16 OP[4];
+static int init_text_p = 0;
+asection *text;
+bfd_vma text_start;
+bfd_vma text_end;
+
static long hash PARAMS ((long insn, int format));
static struct hash_entry *lookup_hash PARAMS ((uint32 ins, int size));
static void get_operands PARAMS ((struct simops *s, uint32 ins));
}
}
+bfd_vma
+decode_pc ()
+{
+ asection *s;
+ if (!init_text_p)
+ {
+ init_text_p = 1;
+ for (s = exec_bfd->sections; s; s = s->next)
+ if (strcmp (bfd_get_section_name (exec_bfd, s), ".text") == 0)
+ {
+ text = s;
+ text_start = bfd_get_section_vma (exec_bfd, s);
+ text_end = text_start + bfd_section_size (exec_bfd, s);
+ break;
+ }
+ }
+
+ return (PC << 2) + text_start;
+}
+
static void
do_long (ins)
uint32 ins;
if (addr > 0xbfff)
{
if ( (addr & 0xfff0) != 0xff00)
- (*d10v_callback->printf_filtered) (d10v_callback, "Data address %x is in I/O space.\n",addr);
+ (*d10v_callback->printf_filtered) (d10v_callback, "Data address 0x%lx is in I/O space, pc = 0x%lx.\n",
+ (long)addr, (long)decode_pc ());
return State.dmem + addr;
}
seg = (DMAP & 0x3ff) >> 2;
if (State.umem[seg] == NULL)
{
- (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped\n", seg);
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped, pc = 0x%lx\n",
+ seg, (long)decode_pc ());
exit(1);
}
return State.umem[seg] + (DMAP & 3) * 0x4000;
if (State.umem[imap & 0xff] == NULL)
{
- (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped\n", imap & 0xff);
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped, pc = 0x%lx\n",
+ imap & 0xff, (long)PC);
State.exception = SIGILL;
return 0;
}