1 /* Declarations for caching. Typically used by remote back ends for
4 Copyright 1992, 1993 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25 #define LINE_SIZE_POWER (4)
27 #define LINE_SIZE (1 << LINE_SIZE_POWER)
28 /* Number of cache blocks */
29 #define DCACHE_SIZE (64)
33 struct dcache_block *next, *last;
34 unsigned int addr; /* Address for which data is recorded. */
35 int data[LINE_SIZE / sizeof (int)];
38 typedef int (*memxferfunc) PARAMS((CORE_ADDR memaddr,
39 unsigned char *myaddr,
43 /* Function to actually read the target memory. */
44 memxferfunc read_memory;
46 /* Function to actually write the target memory */
47 memxferfunc write_memory;
50 struct dcache_block dcache_free;
53 struct dcache_block dcache_valid;
55 /* The cache itself. */
56 struct dcache_block *the_cache;
60 int dcache_fetch PARAMS((DCACHE *dcache, CORE_ADDR addr));
61 void dcache_flush PARAMS((DCACHE *dcache));
62 DCACHE *dcache_init PARAMS((memxferfunc reading, memxferfunc writing));
64 /* Write the word at ADDR both in the data cache and in the remote machine. */
65 void dcache_poke PARAMS((DCACHE *dcache, CORE_ADDR addr, int data));