* dcache.c (dcache_write_line): Fixed bugs where cache line was
authorJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 6 Apr 2001 22:43:55 +0000 (22:43 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 6 Apr 2001 22:43:55 +0000 (22:43 +0000)
not written to target correctly.

gdb/ChangeLog
gdb/dcache.c

index 20de0be4aa00fdbcfa1e66259c68bf5232a023b3..95a30ef77cdffc3f5d0fb81b5513995d5f4e31d4 100644 (file)
@@ -1,5 +1,8 @@
 2001-04-06  J.T. Conklin  <jtc@redback.com>
 
+       * dcache.c (dcache_write_line): Fixed bugs where cache line was
+       not written to target correctly.
+
        * gdbserver/low-hppabsd.c (read_inferior_memory): Add explicit 
        void return value;
        * gdbserver/low-nbsd.c: Likewise.
index d6268f700f3a4e62f5dc92cddc5dff9c07ea8e3e..6e742746363b4cad7a67e24214bb6a0fcef8ef4d 100644 (file)
@@ -278,20 +278,24 @@ dcache_write_line (DCACHE *dcache, register struct dcache_block *db)
       while (reg_len > 0)
        {
          s = XFORM(memaddr);
-         do {
+         while (reg_len > 0) {
            if (db->state[s] == ENTRY_DIRTY)
              break;
            s++;
            reg_len--;
-         } while (reg_len > 0);
+
+           memaddr++;
+           myaddr++;
+           len--;
+         }
 
          e = s;
-         do {
+         while (reg_len > 0) {
            if (db->state[e] != ENTRY_DIRTY)
              break;
            e++;
            reg_len--;
-         } while (reg_len > 0);
+         }
 
          dirty_len = e - s;
          while (dirty_len > 0)
@@ -304,6 +308,7 @@ dcache_write_line (DCACHE *dcache, register struct dcache_block *db)
              memset (&db->state[XFORM(memaddr)], ENTRY_OK, res);
              memaddr   += res;
              myaddr    += res;
+             len       -= res;
              dirty_len -= res;
            }
        }