summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog4
-rw-r--r--sim/common/cgen-trace.h2
-rw-r--r--sim/sh/ChangeLog8
-rw-r--r--sim/sh/gencode.c33
-rw-r--r--sim/sh/interp.c19
5 files changed, 38 insertions, 28 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index ae252fd2769..eb38a7bf944 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,7 @@
+2002-10-14 Alan Modra <amodra@bigpond.net.au>
+
+ * cgen-trace.h: Test __BFD_H_SEEN__ rather than BFD_VERSION.
+
2002-08-29 Dave Brolley <brolley@redhat.com>
* Make-common.in (CGEN_READ_SCM): Remove ../../cgen/stamp-cgen.
diff --git a/sim/common/cgen-trace.h b/sim/common/cgen-trace.h
index 5e796fbf061..be1dd1dff4e 100644
--- a/sim/common/cgen-trace.h
+++ b/sim/common/cgen-trace.h
@@ -78,7 +78,7 @@ typedef struct {
extern int sim_disasm_sprintf (SFILE *, const char *, ...);
/* For opcodes based disassemblers. */
-#ifdef BFD_VERSION
+#ifdef __BFD_H_SEEN__
struct disassemble_info;
extern int
sim_disasm_read_memory (bfd_vma memaddr_, bfd_byte *myaddr_, int length_,
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index ec587595082..60b41f7c552 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
Wed Jul 17 19:36:38 2002 J"orn Rennecke <joern.rennecke@superh.com>
* Makefile.in (interp.o): Depend on $(srcroot)/include/gdb/sim-sh.h.
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index ba6ee4c1bc6..8e2445a7e11 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -577,7 +577,7 @@ op tab[] =
},
{ "", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111",
- "trap (255,R0,memory,maskl,maskw, endianw);",
+ "trap (255, R0, PC, memory, maskl, maskw, endianw);",
"/* FIXME: mac.l support */",
},
@@ -951,8 +951,7 @@ op tab[] =
},
{ "", "", "sleep", "0000000000011011",
- "nip = PC;",
- "trap (0xc3, R0, memory, maskl, maskw, endianw);",
+ "nip += trap (0xc3, R0, PC, memory, maskl, maskw, endianw);",
},
{ "n", "", "stc <CREG_M>,<REG_N>", "0000nnnnmmmm0010",
@@ -1029,37 +1028,25 @@ op tab[] =
},
{ "0", "", "trapa #<imm>", "11000011i8*1....",
-#if 0
- /* SH-[12] */
"long imm = 0xff & i;",
- "if (i==0xc3)",
- " PC-=2;",
- "if (i<20||i==34||i==0xc3)",
- " trap(i,R,memory,maskl,maskw,endianw);",
+ "if (i < 20 || i == 33 || i == 34 || i == 0xc3)",
+ " nip += trap (i, R, PC, memory, maskl, maskw,endianw);",
+#if 0
"else {",
+ /* SH-[12] */
" R[15]-=4;",
- " WLAT(R[15],GET_SR());",
+ " WLAT (R[15], GET_SR());",
" R[15]-=4;",
- " WLAT(R[15],PC+2);",
- " PC=RLAT(VBR+(imm<<2))-2;",
- "}",
+ " WLAT (R[15], PH2T (PC + 2));",
#else
- "if (i == 0xc3)",
- " {",
- " nip = PC;",
- " trap (i, R, memory, maskl, maskw,endianw);",
- " }",
- "else if (i < 20 || i==34 || i==0xc3)",
- " trap (i, R, memory, maskl, maskw,endianw);",
"else if (!SR_BL) {",
- " /* FIXME: TRA = (imm << 2); */",
" SSR = GET_SR();",
" SPC = PH2T (PC + 2);",
" SET_SR (GET_SR() | SR_MASK_MD | SR_MASK_BL | SR_MASK_RB);",
" /* FIXME: EXPEVT = 0x00000160; */",
- " SET_NIP (PT2H (VBR + 0x00000100));",
- "}",
#endif
+ " SET_NIP (PT2H (RLAT (VBR + (imm<<2))));",
+ "}",
},
{ "", "mn", "tst <REG_M>,<REG_N>", "0010nnnnmmmm1000",
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 2f5d1d37d59..8c2f3598a5d 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