aboutsummaryrefslogtreecommitdiff
path: root/sim/sh/interp.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2002-10-11 15:31:28 +0000
committerJoern Rennecke <joern.rennecke@embecosm.com>2002-10-11 15:31:28 +0000
commitfd8f4948fe9454ec1cc6cb8a33c4992f6145c43d (patch)
treeee978366c913795d35da5d763f6c26ec63e3c625 /sim/sh/interp.c
parent6c381eeb71e6f61062fb64795097e144d48fa798 (diff)
downloadgdb-fd8f4948fe9454ec1cc6cb8a33c4992f6145c43d.zip
gdb-fd8f4948fe9454ec1cc6cb8a33c4992f6145c43d.tar.gz
gdb-fd8f4948fe9454ec1cc6cb8a33c4992f6145c43d.tar.bz2
gcc uses trap 33 for profiling, but the simulator didn't support it.
This patch fixes the gcc.dg/nest.c failures for sh-elf. Fri Oct 11 16:22:28 2002 J"orn Rennecke <joern.rennecke@superh.com> * interp.c (trap): Return int. Take extra parameter for address of the trap instruction. Changed all callers. Add case 33 for profiling. * gencode.c (trapa): Handle trap 33 using the trap function. Add read of vector for generic traps.
Diffstat (limited to 'sim/sh/interp.c')
-rw-r--r--sim/sh/interp.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 2f5d1d3..8c2f359 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -954,12 +954,14 @@ strnswap (str, len)
while (start < end);
}
-/* Simulate a monitor trap, put the result into r0 and errno into r1 */
+/* Simulate a monitor trap, put the result into r0 and errno into r1
+ return offset by which to adjust pc. */
-static void
-trap (i, regs, memory, maskl, maskw, endianw)
+static int
+trap (i, regs, insn_ptr, memory, maskl, maskw, endianw)
int i;
int *regs;
+ unsigned char *insn_ptr;
unsigned char *memory;
{
switch (i)
@@ -971,6 +973,13 @@ trap (i, regs, memory, maskl, maskw, endianw)
raise_exception (SIGQUIT);
break;
case 3: /* FIXME: for backwards compat, should be removed */
+ case 33:
+ {
+ unsigned int countp = * (unsigned int *) (insn_ptr + 4);
+
+ WLAT (countp, RLAT (countp) + 1);
+ return 6;
+ }
case 34:
{
extern int errno;
@@ -1154,9 +1163,11 @@ trap (i, regs, memory, maskl, maskw, endianw)
case 0xc3:
case 255:
raise_exception (SIGTRAP);
+ if (i == 0xc3)
+ return -2;
break;
}
-
+ return 0;
}
void