]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/memattr.h
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / memattr.h
1 /* Memory attributes support, for GDB.
2
3 Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22 #ifndef MEMATTR_H
23 #define MEMATTR_H
24
25 #include "vec.h"
26
27 enum mem_access_mode
28 {
29 MEM_NONE, /* Memory that is not physically present. */
30 MEM_RW, /* read/write */
31 MEM_RO, /* read only */
32 MEM_WO, /* write only */
33
34 /* Read/write, but special steps are required to write to it. */
35 MEM_FLASH
36 };
37
38 enum mem_access_width
39 {
40 MEM_WIDTH_UNSPECIFIED,
41 MEM_WIDTH_8, /* 8 bit accesses */
42 MEM_WIDTH_16, /* 16 " " */
43 MEM_WIDTH_32, /* 32 " " */
44 MEM_WIDTH_64 /* 64 " " */
45 };
46
47 /* The set of all attributes that can be set for a memory region.
48
49 This structure was created so that memory attributes can be passed
50 to target_ functions without exposing the details of memory region
51 list, which would be necessary if these fields were simply added to
52 the mem_region structure.
53
54 FIXME: It would be useful if there was a mechanism for targets to
55 add their own attributes. For example, the number of wait states. */
56
57 struct mem_attrib
58 {
59 /* read/write, read-only, or write-only */
60 enum mem_access_mode mode;
61
62 enum mem_access_width width;
63
64 /* enables hardware breakpoints */
65 int hwbreak;
66
67 /* enables host-side caching of memory region data */
68 int cache;
69
70 /* enables memory verification. after a write, memory is re-read
71 to verify that the write was successful. */
72 int verify;
73
74 /* Block size. Only valid if mode == MEM_FLASH. */
75 int blocksize;
76 };
77
78 struct mem_region
79 {
80 /* Lowest address in the region. */
81 CORE_ADDR lo;
82 /* Address past the highest address of the region.
83 If 0, upper bound is "infinity". */
84 CORE_ADDR hi;
85
86 /* Item number of this memory region. */
87 int number;
88
89 /* Status of this memory region (enabled if non-zero, otherwise disabled) */
90 int enabled_p;
91
92 /* Attributes for this region */
93 struct mem_attrib attrib;
94 };
95
96 /* Declare a vector type for a group of mem_region structures. The
97 typedef is necessary because vec.h can not handle a struct tag.
98 Except during construction, these vectors are kept sorted. */
99 typedef struct mem_region mem_region_s;
100 DEF_VEC_O(mem_region_s);
101
102 extern struct mem_region *lookup_mem_region(CORE_ADDR);
103
104 void invalidate_target_mem_regions (void);
105
106 void mem_region_init (struct mem_region *);
107
108 int mem_region_cmp (const void *, const void *);
109
110 #endif /* MEMATTR_H */