aboutsummaryrefslogtreecommitdiff
path: root/sim/h8300/compile.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1996-07-02 07:37:50 +0000
committerJeff Law <law@redhat.com>1996-07-02 07:37:50 +0000
commit171f4664bec82c64bdd22f5ec2f34b9468b67cbc (patch)
treea888741a9daf2767d4e0cac41f083017dd921417 /sim/h8300/compile.c
parent6687c9531dd9abe1aafb2c1e9425119dd51d5bbc (diff)
downloadgdb-171f4664bec82c64bdd22f5ec2f34b9468b67cbc.zip
gdb-171f4664bec82c64bdd22f5ec2f34b9468b67cbc.tar.gz
gdb-171f4664bec82c64bdd22f5ec2f34b9468b67cbc.tar.bz2
* compile.c (sim_resume): Handle "ldm.l" and "stm.l".
HMSE H8/S.
Diffstat (limited to 'sim/h8300/compile.c')
-rw-r--r--sim/h8300/compile.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 2e02aa0..21b9d65 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -74,7 +74,7 @@ int debug;
#endif
#ifndef SEXTCHAR
-#define SEXTCHAR(x) ((x & 0x80) ? (x | ~0xff):x)
+#define SEXTCHAR(x) ((x & 0x80) ? (x | ~0xff): x & 0xff)
#endif
#define UEXTCHAR(x) ((x) & 0xff)
@@ -84,6 +84,9 @@ int debug;
static cpu_state_type cpu;
int h8300hmode = 0;
+/* start-sanitize-h8s */
+int h8300smode = 0;
+/* end-sanitize-h8s */
static int memory_size;
@@ -1424,6 +1427,42 @@ sim_resume (step, siggnal)
case O (O_NOP, SB):
goto next;
+/* start-sanitize-h8s */
+ case O (O_STM, SL):
+ {
+ int nregs, firstreg, i;
+
+ nregs = GET_MEMORY_B (pc + 1);
+ nregs >>= 4;
+ nregs &= 0xf;
+ firstreg = GET_MEMORY_B (pc + 3);
+ firstreg &= 0xf;
+ for (i = firstreg; i <= firstreg + nregs; i++)
+ {
+ cpu.regs[7] -= 4;
+ SET_MEMORY_L (cpu.regs[7], cpu.regs[i]);
+ }
+ }
+ goto next;
+
+ case O (O_LDM, SL):
+ {
+ int nregs, firstreg, i;
+
+ nregs = GET_MEMORY_B (pc + 1);
+ nregs >>= 4;
+ nregs &= 0xf;
+ firstreg = GET_MEMORY_B (pc + 3);
+ firstreg &= 0xf;
+ for (i = firstreg; i >= firstreg - nregs; i--)
+ {
+ cpu.regs[i] = GET_MEMORY_L (cpu.regs[7]);
+ cpu.regs[7] += 4;
+ }
+ }
+ goto next;
+
+/* end-sanitize-h8s */
default:
cpu.exception = SIGILL;
goto end;
@@ -1892,7 +1931,13 @@ sim_load (prog, from_tty)
if ((abfd = bfd_openr (prog, "coff-h8300")) != 0)
{
if (bfd_check_format (abfd, bfd_object))
- set_h8300h (abfd->arch_info->mach == bfd_mach_h8300h);
+ {
+ set_h8300h (abfd->arch_info->mach == bfd_mach_h8300h
+/* start-sanitize-h8s */
+ || abfd->arch_info->mach == bfd_mach_h8300s
+/* end-sanitize-h8s */
+ );
+ }
bfd_close (abfd);
}