This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix dcache.c:dcache_write_line()
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH]: Fix dcache.c:dcache_write_line()
- From: jtc at redback dot com (J.T. Conklin)
- Date: 06 Apr 2001 15:41:04 -0700
- Reply-To: jtc at redback dot com
With many thanks to Frank Ch. Eigler who discovered the problem, this
patch fixes a bug in dcache.c:dcache_write_line() where the cache was
not written to the target correctly.
Frank reported that cached memory was being written to the target one
byte at a time and suspected the memory region attribute subsystem.
It turned out to be worse than that.
--jtc
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.
Index: dcache.c
===================================================================
RCS file: /cvs/src/src/gdb/dcache.c,v
retrieving revision 1.14
diff -c -r1.14 dcache.c
*** dcache.c 2001/03/06 08:21:06 1.14
--- dcache.c 2001/04/06 22:32:02
***************
*** 278,297 ****
while (reg_len > 0)
{
s = XFORM(memaddr);
! do {
if (db->state[s] == ENTRY_DIRTY)
break;
s++;
reg_len--;
- } while (reg_len > 0);
e = s;
! do {
if (db->state[e] != ENTRY_DIRTY)
break;
e++;
reg_len--;
! } while (reg_len > 0);
dirty_len = e - s;
while (dirty_len > 0)
--- 278,301 ----
while (reg_len > 0)
{
s = XFORM(memaddr);
! while (reg_len > 0) {
if (db->state[s] == ENTRY_DIRTY)
break;
s++;
reg_len--;
+ memaddr++;
+ myaddr++;
+ len--;
+ }
+
e = s;
! while (reg_len > 0) {
if (db->state[e] != ENTRY_DIRTY)
break;
e++;
reg_len--;
! }
dirty_len = e - s;
while (dirty_len > 0)
***************
*** 304,309 ****
--- 308,314 ----
memset (&db->state[XFORM(memaddr)], ENTRY_OK, res);
memaddr += res;
myaddr += res;
+ len -= res;
dirty_len -= res;
}
}
--
J.T. Conklin
RedBack Networks