Remove redundant test in BFD_ASSERT
[deliverable/binutils-gdb.git] / gdb / dcache.c
index d6268f700f3a4e62f5dc92cddc5dff9c07ea8e3e..e3ffa4a9d18de44d7d4a4cf34f1a5bc4c66e2f21 100644 (file)
@@ -1,6 +1,7 @@
-/* Caching code.
-   Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+/* Caching code for GDB, the GNU debugger.
+
+   Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free
+   Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -217,7 +218,7 @@ dcache_invalidate (DCACHE *dcache)
 static struct dcache_block *
 dcache_hit (DCACHE *dcache, CORE_ADDR addr)
 {
-  register struct dcache_block *db;
+  struct dcache_block *db;
 
   /* Search all cache blocks for one that is at this address.  */
   db = dcache->valid_head;
@@ -239,7 +240,7 @@ dcache_hit (DCACHE *dcache, CORE_ADDR addr)
    be written is. */
 
 static int
-dcache_write_line (DCACHE *dcache, register struct dcache_block *db)
+dcache_write_line (DCACHE *dcache, struct dcache_block *db)
 {
   CORE_ADDR memaddr;
   char *myaddr;
@@ -278,20 +279,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 +309,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;
            }
        }
@@ -378,7 +384,7 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
 static struct dcache_block *
 dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
 {
-  register struct dcache_block *db;
+  struct dcache_block *db;
 
   /* Take something from the free list */
   db = dcache->free_head;
@@ -439,7 +445,7 @@ dcache_writeback (DCACHE *dcache)
 static int
 dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 {
-  register struct dcache_block *db = dcache_hit (dcache, addr);
+  struct dcache_block *db = dcache_hit (dcache, addr);
 
   if (!db)
     {
@@ -466,7 +472,7 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 static int
 dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 {
-  register struct dcache_block *db = dcache_hit (dcache, addr);
+  struct dcache_block *db = dcache_hit (dcache, addr);
 
   if (!db)
     {
@@ -579,7 +585,7 @@ dcache_info (char *exp, int tty)
 void
 _initialize_dcache (void)
 {
-  add_show_from_set
+  deprecated_add_show_from_set
     (add_set_cmd ("remotecache", class_support, var_boolean,
                  (char *) &dcache_enabled_p,
                  "\
This page took 0.026038 seconds and 4 git commands to generate.