2011-05-23 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / memattr.h
CommitLineData
80629b1b 1/* Memory attributes support, for GDB.
c96fc75e 2
7b6bb8da 3 Copyright (C) 2001, 2006, 2007, 2008, 2009, 2010, 2011
4c38e0a4 4 Free Software Foundation, Inc.
80629b1b
EZ
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
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
80629b1b
EZ
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
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
80629b1b 20
29e57380
C
21#ifndef MEMATTR_H
22#define MEMATTR_H
23
c96fc75e
DJ
24#include "vec.h"
25
29e57380
C
26enum mem_access_mode
27{
025bb325 28 MEM_NONE, /* Memory that is not physically present. */
29e57380
C
29 MEM_RW, /* read/write */
30 MEM_RO, /* read only */
fd79ecee
DJ
31 MEM_WO, /* write only */
32
33 /* Read/write, but special steps are required to write to it. */
34 MEM_FLASH
29e57380
C
35};
36
37enum mem_access_width
38{
39 MEM_WIDTH_UNSPECIFIED,
40 MEM_WIDTH_8, /* 8 bit accesses */
41 MEM_WIDTH_16, /* 16 " " */
42 MEM_WIDTH_32, /* 32 " " */
43 MEM_WIDTH_64 /* 64 " " */
44};
45
46/* The set of all attributes that can be set for a memory region.
47
48 This structure was created so that memory attributes can be passed
49 to target_ functions without exposing the details of memory region
50 list, which would be necessary if these fields were simply added to
51 the mem_region structure.
52
53 FIXME: It would be useful if there was a mechanism for targets to
025bb325 54 add their own attributes. For example, the number of wait states. */
29e57380
C
55
56struct mem_attrib
57{
58 /* read/write, read-only, or write-only */
59 enum mem_access_mode mode;
60
61 enum mem_access_width width;
62
63 /* enables hardware breakpoints */
64 int hwbreak;
65
66 /* enables host-side caching of memory region data */
67 int cache;
68
025bb325
MS
69 /* Enables memory verification. After a write, memory is re-read
70 to verify that the write was successful. */
71 int verify;
fd79ecee
DJ
72
73 /* Block size. Only valid if mode == MEM_FLASH. */
74 int blocksize;
29e57380
C
75};
76
77struct mem_region
78{
4b5752d0 79 /* Lowest address in the region. */
29e57380 80 CORE_ADDR lo;
4b5752d0
VP
81 /* Address past the highest address of the region.
82 If 0, upper bound is "infinity". */
29e57380
C
83 CORE_ADDR hi;
84
025bb325 85 /* Item number of this memory region. */
29e57380
C
86 int number;
87
025bb325
MS
88 /* Status of this memory region (enabled if non-zero, otherwise
89 disabled). */
b5de0fa7 90 int enabled_p;
29e57380 91
025bb325 92 /* Attributes for this region. */
29e57380
C
93 struct mem_attrib attrib;
94};
95
c96fc75e
DJ
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. */
99typedef struct mem_region mem_region_s;
100DEF_VEC_O(mem_region_s);
101
29e57380
C
102extern struct mem_region *lookup_mem_region(CORE_ADDR);
103
fd79ecee
DJ
104void invalidate_target_mem_regions (void);
105
106void mem_region_init (struct mem_region *);
107
108int mem_region_cmp (const void *, const void *);
109
29e57380 110#endif /* MEMATTR_H */
This page took 0.870261 seconds and 4 git commands to generate.