X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fdcache.c;h=0cfb390ca5a1011fb2ad2ac53a0074ed363fd7f1;hb=4117d76827b3768e9da6ef52f52a59c5ae92bed3;hp=bff7e9fccab74bce2d7629aca73e5dd410a41b32;hpb=920d2a441963dd93b50e836dfabdd58e7f0016fb;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/dcache.c b/gdb/dcache.c index bff7e9fcca..0cfb390ca5 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -1,13 +1,13 @@ /* Caching code for GDB, the GNU debugger. - Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free - Software Foundation, Inc. + Copyright (C) 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2007 + Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,9 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see . */ #include "defs.h" #include "dcache.h" @@ -124,7 +122,7 @@ struct dcache_block { struct dcache_block *p; /* next in list */ CORE_ADDR addr; /* Address for which data is recorded. */ - char data[LINE_SIZE]; /* bytes at given address */ + gdb_byte data[LINE_SIZE]; /* bytes at given address */ unsigned char state[LINE_SIZE]; /* what state the data is in */ /* whether anything in state is dirty - used to speed up the @@ -162,10 +160,6 @@ struct dcache_struct struct dcache_block *the_cache; }; -static int dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr); - -static int dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr); - static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr); static int dcache_write_line (DCACHE *dcache, struct dcache_block *db); @@ -250,7 +244,7 @@ static int dcache_write_line (DCACHE *dcache, struct dcache_block *db) { CORE_ADDR memaddr; - char *myaddr; + gdb_byte *myaddr; int len; int res; int reg_len; @@ -306,19 +300,15 @@ dcache_write_line (DCACHE *dcache, struct dcache_block *db) } dirty_len = e - s; - while (dirty_len > 0) - { - res = do_xfer_memory(memaddr, myaddr, dirty_len, 1, - ®ion->attrib); - if (res <= 0) - return 0; - - memset (&db->state[XFORM(memaddr)], ENTRY_OK, res); - memaddr += res; - myaddr += res; - len -= res; - dirty_len -= res; - } + res = target_write (¤t_target, TARGET_OBJECT_RAW_MEMORY, + NULL, myaddr, memaddr, dirty_len); + if (res < dirty_len) + return 0; + + memset (&db->state[XFORM(memaddr)], ENTRY_OK, res); + memaddr += res; + myaddr += res; + len -= res; } } @@ -331,7 +321,7 @@ static int dcache_read_line (DCACHE *dcache, struct dcache_block *db) { CORE_ADDR memaddr; - char *myaddr; + gdb_byte *myaddr; int len; int res; int reg_len; @@ -365,18 +355,14 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db) continue; } - while (reg_len > 0) - { - res = do_xfer_memory (memaddr, myaddr, reg_len, 0, - ®ion->attrib); - if (res <= 0) - return 0; + res = target_read (¤t_target, TARGET_OBJECT_RAW_MEMORY, + NULL, myaddr, memaddr, reg_len); + if (res < reg_len) + return 0; - memaddr += res; - myaddr += res; - len -= res; - reg_len -= res; - } + memaddr += res; + myaddr += res; + len -= res; } memset (db->state, ENTRY_OK, sizeof (db->data)); @@ -450,7 +436,7 @@ dcache_writeback (DCACHE *dcache) Returns 0 on error. */ static int -dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr) +dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr) { struct dcache_block *db = dcache_hit (dcache, addr); @@ -477,7 +463,7 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr) */ static int -dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr) +dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr) { struct dcache_block *db = dcache_hit (dcache, addr); @@ -532,11 +518,11 @@ dcache_free (DCACHE *dcache) This routine is indended to be called by remote_xfer_ functions. */ int -dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, char *myaddr, int len, - int should_write) +dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, + int len, int should_write) { int i; - int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, char *ptr); + int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr); xfunc = should_write ? dcache_poke_byte : dcache_peek_byte; for (i = 0; i < len; i++)