* run.c (main): Don't "load" sections which don't have
authorJeff Law <law@redhat.com>
Wed, 3 Jul 1996 05:10:47 +0000 (05:10 +0000)
committerJeff Law <law@redhat.com>
Wed, 3 Jul 1996 05:10:47 +0000 (05:10 +0000)
        SEC_LOAD set.
        * compile.c (sim_resume, case "O_NOT"): Use ONOT instead
        of OSHIFTS.
        (ONOT): Define.
        (sim_resume, shift/rotate cases): Add support for shift/rotate
        by two bits.
        (OSHIFTS): Corresponding changes.
Handling more H8/S ops.

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

index 0b76bf6509f54d8c9d8fa83cf27bada787b1e807..90a61c645d5dc30526eebb2446a2df10fda2f57b 100644 (file)
@@ -1,3 +1,14 @@
+Tue Jul  2 23:08:45 1996  Jeffrey A Law  (law@cygnus.com)
+
+       * run.c (main): Don't "load" sections which don't have
+       SEC_LOAD set.
+       * compile.c (sim_resume, case "O_NOT"): Use ONOT instead
+       of OSHIFTS.
+       (ONOT): Define.
+       (sim_resume, shift/rotate cases): Add support for shift/rotate
+       by two bits.
+       (OSHIFTS): Corresponding changes.
+
 start-sanitize-h8s 
 Tue Jul  2 01:37:27 1996  Jeffrey A Law  (law@cygnus.com)
 
index 21b9d6587bb16494652d3f48314ac1479edf5be4..a04657b5a53acf7452603b85a3a03e652e36f22e 100644 (file)
@@ -823,7 +823,7 @@ mop (code, bsize, sign)
 
 }
 
-#define OSHIFTS(name, how) \
+#define ONOT(name, how) \
 case O(name, SB):                              \
 {                                              \
   int t;                                       \
@@ -849,6 +849,53 @@ case O(name, SL):                          \
   goto shift32;                                        \
 }
 
+#define OSHIFTS(name, how1, how2) \
+case O(name, SB):                              \
+{                                              \
+  int t;                                       \
+  int hm = 0x80;                               \
+  rd = GET_B_REG (code->src.reg);              \
+  if ((GET_MEMORY_B (pc + 1) & 0x40) == 0)     \
+    {                                          \
+      how1;                                    \
+    }                                          \
+  else                                         \
+    {                                          \
+      how2;                                    \
+    }                                          \
+  goto shift8;                                 \
+}                                              \
+case O(name, SW):                              \
+{                                              \
+  int t;                                       \
+  int hm = 0x8000;                             \
+  rd = GET_W_REG (code->src.reg);              \
+  if ((GET_MEMORY_B (pc + 1) & 0x40) == 0)     \
+    {                                          \
+      how1;                                    \
+    }                                          \
+  else                                         \
+    {                                          \
+      how2;                                    \
+    }                                          \
+  goto shift16;                                        \
+}                                              \
+case O(name, SL):                              \
+{                                              \
+  int t;                                       \
+  int hm = 0x80000000;                                 \
+  rd = GET_L_REG (code->src.reg);              \
+  if ((GET_MEMORY_B (pc + 1) & 0x40) == 0)     \
+    {                                          \
+      how1;                                    \
+    }                                          \
+  else                                         \
+    {                                          \
+      how2;                                    \
+    }                                          \
+  goto shift32;                                        \
+}
+
 #define OBITOP(name,f, s, op)                  \
 case  O(name, SB):                             \
 {                                              \
@@ -1204,38 +1251,31 @@ sim_resume (step, siggnal)
          printf ("%c", cpu.regs[2]);
          goto next;
 
-         OSHIFTS (O_NOT, rd = ~rd; v = 0;);
-         OSHIFTS (O_SHLL, c = rd & hm; v = 0;
-                  rd <<= 1);
-         OSHIFTS (O_SHLR, c = rd & 1; v = 0;
-                  rd = (unsigned int) rd >> 1);
-         OSHIFTS (O_SHAL, c = rd & hm;
-                  v = (rd & hm) != ((rd & (hm >> 1)) << 1);
-                  rd <<= 1);
-         OSHIFTS (O_SHAR, t = rd & hm;
-                  c = rd & 1;
-                  v = 0;
-                  rd >>= 1;
-                  rd |= t;
-                  );
-         OSHIFTS (O_ROTL, c = rd & hm;
-                  v = 0;
-                  rd <<= 1;
-                  rd |= C);
-         OSHIFTS (O_ROTR, c = rd & 1;
-                  v = 0;
-                  rd = (unsigned int) rd >> 1;
-                  if (c) rd |= hm;);
-         OSHIFTS (O_ROTXL, t = rd & hm;
-                  rd <<= 1;
-                  rd |= C;
-                  c = t;
-                  v = 0;
-                  );
-         OSHIFTS (O_ROTXR, t = rd & 1;
-                  rd = (unsigned int) rd >> 1;
-                  if (C) rd |= hm; c = t;
-                  v = 0;);
+         ONOT (O_NOT, rd = ~rd; v = 0;);
+         OSHIFTS (O_SHLL,
+                  c = rd & hm; v = 0; rd <<= 1,
+                  c = rd & (hm >> 1); v = 0; rd <<= 2);
+         OSHIFTS (O_SHLR,
+                  c = rd & 1; v = 0; rd = (unsigned int) rd >> 1,
+                  c = rd & 2; v = 0; rd = (unsigned int) rd >> 2);
+         OSHIFTS (O_SHAL,
+                  c = rd & hm; v = (rd & hm) != ((rd & (hm >> 1)) << 1); rd <<= 1,
+                  c = rd & (hm >> 1); v = (rd & (hm >> 1)) != ((rd & (hm >> 2)) << 2); rd <<= 2);
+         OSHIFTS (O_SHAR,
+                  t = rd & hm; c = rd & 1; v = 0; rd >>= 1; rd |= t,
+                  t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1 );
+         OSHIFTS (O_ROTL,
+                  c = rd & hm; v = 0; rd <<= 1; rd |= C,
+                  c = rd & (hm >> 1); v = 0; rd <<= 2; rd |= C);
+         OSHIFTS (O_ROTR,
+                  c = rd & 1; v = 0; rd = (unsigned int) rd >> 1; if (c) rd |= hm,
+                  c = rd & 2; v = 0; rd = (unsigned int) rd >> 2; if (c) rd |= hm);
+         OSHIFTS (O_ROTXL,
+                  t = rd & hm; rd <<= 1; rd |= C; c = t; v = 0,
+                  t = rd & (hm >> 1); rd <<= 2; rd |= C; c = t; v = 0);
+         OSHIFTS (O_ROTXR,
+                  t = rd & 1; rd = (unsigned int) rd >> 1; if (C) rd |= hm; c = t; v = 0,
+                  t = rd & 2; rd = (unsigned int) rd >> 2; if (C) rd |= hm; c = t; v = 0);
 
        case O (O_JMP, SB):
          {
index f19488a0f81e52a529b6a33e9e33a72b71220c66..8921ae6c2548d13f1c72e4d52551ad1767da6a96 100644 (file)
@@ -98,9 +98,16 @@ main (ac, av)
 
   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));
+      char *buffer;
+
+      if (s->flags & SEC_LOAD)
+       {
+
+         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);