* elf.c (_bfd_elf_make_section_from_shdr): Only set SEC_DATA if
[deliverable/binutils-gdb.git] / gdb / dcache.h
1 /* Declarations for caching. Typically used by remote back ends for
2 caching remote memory.
3
4 Copyright 1992, 1993 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
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.
12
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.
17
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. */
21
22 #ifndef DCACHE_H
23 #define DCACHE_H
24
25 /* The data cache leads to incorrect results because it doesn't know about
26 volatile variables, thus making it impossible to debug functions which
27 use hardware registers. Therefore it is #if 0'd out. Effect on
28 performance is some, for backtraces of functions with a few
29 arguments each. For functions with many arguments, the stack
30 frames don't fit in the cache blocks, which makes the cache less
31 helpful. Disabling the cache is a big performance win for fetching
32 large structures, because the cache code fetched data in 16-byte
33 chunks. */
34
35 #define LINE_SIZE_POWER (4)
36 /* eg 1<<3 == 8 */
37 #define LINE_SIZE (1 << LINE_SIZE_POWER)
38 /* Number of cache blocks */
39 #define DCACHE_SIZE (64)
40
41 struct dcache_block
42 {
43 struct dcache_block *next, *last;
44 unsigned int addr; /* Address for which data is recorded. */
45 int data[LINE_SIZE / sizeof (int)];
46 };
47
48 typedef int (*memxferfunc) PARAMS((CORE_ADDR memaddr,
49 unsigned char *myaddr,
50 int len));
51
52 typedef struct {
53 /* Function to actually read the target memory. */
54 memxferfunc read_memory;
55
56 /* Function to actually write the target memory */
57 memxferfunc write_memory;
58
59 /* free list */
60 struct dcache_block dcache_free;
61
62 /* in use list */
63 struct dcache_block dcache_valid;
64
65 /* The cache itself. */
66 struct dcache_block *the_cache;
67
68 } DCACHE;
69
70 /* Using the data cache DCACHE return the contents of the word at
71 address ADDR in the remote machine. */
72 int dcache_fetch PARAMS((DCACHE *dcache, CORE_ADDR addr));
73
74 /* Flush DCACHE. */
75 void dcache_flush PARAMS((DCACHE *dcache));
76
77 /* Initialize DCACHE. */
78 DCACHE *dcache_init PARAMS((memxferfunc reading, memxferfunc writing));
79
80 /* Write the word at ADDR both in the data cache and in the remote machine. */
81 void dcache_poke PARAMS((DCACHE *dcache, CORE_ADDR addr, int data));
82
83 #endif /* DCACHE_H */
This page took 0.036129 seconds and 4 git commands to generate.