* run.c (main): If h8/300h binary detected, call set_h8300h.
authorDavid Edelsohn <dje.gcc@gmail.com>
Thu, 15 Jul 1993 17:01:40 +0000 (17:01 +0000)
committerDavid Edelsohn <dje.gcc@gmail.com>
Thu, 15 Jul 1993 17:01:40 +0000 (17:01 +0000)
* compile.c (sim_resume): Fix O_NEG insn.

sim/h8300/ChangeLog
sim/h8300/compile.c
sim/h8300/run.c

index 2075c7c3e1bd9ea0eb906287d452635b700c7d8b..e4cd0d48ff01d4f99358ef9546fb3a876920b6a3 100644 (file)
@@ -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.
index 2db45ddb3192446d4ecd07d08b8fd77e6b7f9193..b18f7eac160c1be8d93be776c9071f4d6bf3429d 100644 (file)
@@ -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);
index 5b0f73277ae577965d593a006901295e48398ed4..30104330b0d12723287b6a40308860740bb8665a 100644 (file)
@@ -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;
 }