#include "remote-sim.h"
#include "d10v_sim.h"
-#include "sim-d10v.h"
+#include "gdb/sim-d10v.h"
enum _leftright { LEFT_FIRST, RIGHT_FIRST };
{
if (h->next == NULL)
{
- (*d10v_callback->printf_filtered)
- (d10v_callback, "ERROR: Illegal instruction %x at PC %x\n", ins, PC);
State.exception = SIGILL;
State.pc_changed = 1; /* Don't increment the PC. */
return NULL;
if (step)
sim_stop (sd);
+ switch (siggnal)
+ {
+ case 0:
+ break;
+#ifdef SIGBUS
+ case SIGBUS:
+#endif
+ case SIGSEGV:
+ SET_BPC (PC);
+ SET_BPSW (PSW);
+ SET_HW_PSW ((PSW & (PSW_F0_BIT | PSW_F1_BIT | PSW_C_BIT)));
+ JMP (AE_VECTOR_START);
+ SLOT_FLUSH ();
+ break;
+ case SIGILL:
+ SET_BPC (PC);
+ SET_BPSW (PSW);
+ SET_HW_PSW ((PSW & (PSW_F0_BIT | PSW_F1_BIT | PSW_C_BIT)));
+ JMP (RIE_VECTOR_START);
+ SLOT_FLUSH ();
+ break;
+ default:
+ /* just ignore it */
+ break;
+ }
+
do
{
iaddr = imem_addr ((uint32)PC << 2);
State.exception = SIGTRAP;
}
-int
-sim_trace (sd)
- SIM_DESC sd;
+void
+sim_set_trace (void)
{
#ifdef DEBUG
d10v_debug = DEBUG;
#endif
- sim_resume (sd, 0, 0);
- return 1;
}
void
/* reset all state information */
memset (&State.regs, 0, (int)&State.mem - (int)&State.regs);
- if (argv)
- {
- /* a hack to set r0/r1 with argc/argv */
- /* some high memory that won't be overwritten by the stack soon */
- bfd_vma addr = 0x7C00;
- int p = 20;
- int i = 0;
- while (argv[i])
- {
- int size = strlen (argv[i]) + 1;
- SW (addr + 2*i, addr + p);
- sim_write (sd, addr + 0, argv[i], size);
- p += size;
- i++;
- }
- SET_GPR (0, addr);
- SET_GPR (1, i);
- }
+ /* There was a hack here to copy the values of argc and argv into r0
+ and r1. The values were also saved into some high memory that
+ won't be overwritten by the stack (0x7C00). The reason for doing
+ this was to allow the 'run' program to accept arguments. Without
+ the hack, this is not possible anymore. If the simulator is run
+ from the debugger, arguments cannot be passed in, so this makes
+ no difference. */
/* set PC */
if (abfd != NULL)
set_imap_register (1, 0x1000);
set_dmap_register (0, 0x2000);
set_dmap_register (1, 0x2000);
- set_dmap_register (2, 0x0000); /* Old DMAP, Value is not 0x2000 */
+ set_dmap_register (2, 0x2000); /* DMAP2 initial internal value is
+ 0x2000 on the new board. */
set_dmap_register (3, 0x0000);
}
*sigrc = GPR (0);
break;
+ case SIG_D10V_BUS:
+ *reason = sim_stopped;
+#ifdef SIGBUS
+ *sigrc = SIGBUS;
+#else
+ *sigrc = SIGSEGV;
+#endif
+ break;
+
default: /* some signal */
*reason = sim_stopped;
if (stop_simulator && !State.exception)