From cf5b4aa63a7e219290baa1c502ae82218b748e99 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 15 Jul 1993 17:01:40 +0000 Subject: [PATCH] * run.c (main): If h8/300h binary detected, call set_h8300h. * compile.c (sim_resume): Fix O_NEG insn. --- sim/h8300/ChangeLog | 5 +++++ sim/h8300/compile.c | 8 ++++---- sim/h8300/run.c | 38 +++++++++++++++++++------------------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 2075c7c3e1b..e4cd0d48ff0 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 15 09:59:01 1993 Doug Evans (dje@canuck.cygnus.com) + + * run.c (main): If h8/300h binary detected, call set_h8300h. + * compile.c (sim_resume): Fix O_NEG insn. + Fri Jul 9 14:36:48 1993 Doug Evans (dje@canuck.cygnus.com) * run.c (main): Add -h flag to enable h8/300h emulation. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 2db45ddb319..b18f7eac160 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -823,11 +823,11 @@ sim_resume (step) res = rd + ea; goto alu8; -#define RD rd = fetch(&code->src); -#define RD_EA rd = fetch(&code->dst); ea = fetch(&code->src); +#define EA ea = fetch(&code->src); +#define RD_EA ea = fetch(&code->src); rd = fetch(&code->dst); - ALUOP (1, O_SUB, RD_EA; ea = -ea ; res = rd + ea); - ALUOP (1, O_NEG, RD; ea = -ea ;rd = 0; res = rd + ea); + ALUOP (1, O_SUB, RD_EA; ea = -ea ; res = rd + ea); + ALUOP (1, O_NEG, EA; ea = -ea ; rd = 0; res = rd + ea); case O(O_ADD,SB): rd = GET_B_REG(code->dst.reg); diff --git a/sim/h8300/run.c b/sim/h8300/run.c index 5b0f73277ae..30104330b0d 100644 --- a/sim/h8300/run.c +++ b/sim/h8300/run.c @@ -56,29 +56,29 @@ main (ac, av) if (verbose) printf ("run %s\n", name); - abfd = bfd_openr (name, "coff-h8300"); - if (abfd) + abfd = bfd_openr (name, "coff-h8300"); + if (abfd) + { + if (bfd_check_format(abfd, bfd_object)) { - if (bfd_check_format(abfd, bfd_object)) - { - - for (s = abfd->sections; s; s=s->next) - { - char *buffer = malloc(bfd_section_size(abfd,s)); - bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s)); - sim_write(s->vma, buffer, bfd_section_size(abfd,s)); - } + if (abfd->arch_info->mach == bfd_mach_h8300h) + set_h8300h (); - start_address = bfd_get_start_address(abfd); - sim_store_register( - 9,start_address); - sim_resume(0,0); - if (verbose) - sim_info (verbose); - return 0; + for (s = abfd->sections; s; s=s->next) + { + char *buffer = malloc(bfd_section_size(abfd,s)); + bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s)); + sim_write(s->vma, buffer, bfd_section_size(abfd,s)); } + + start_address = bfd_get_start_address(abfd); + sim_store_register(9,start_address); + sim_resume(0,0); + if (verbose) + sim_info (verbose); + return 0; } - + } return 1; } -- 2.30.2