GDB (API)
|
00001 /* Memory attributes support, for GDB. 00002 00003 Copyright (C) 2001-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #ifndef MEMATTR_H 00021 #define MEMATTR_H 00022 00023 #include "vec.h" 00024 00025 enum mem_access_mode 00026 { 00027 MEM_NONE, /* Memory that is not physically present. */ 00028 MEM_RW, /* read/write */ 00029 MEM_RO, /* read only */ 00030 MEM_WO, /* write only */ 00031 00032 /* Read/write, but special steps are required to write to it. */ 00033 MEM_FLASH 00034 }; 00035 00036 enum mem_access_width 00037 { 00038 MEM_WIDTH_UNSPECIFIED, 00039 MEM_WIDTH_8, /* 8 bit accesses */ 00040 MEM_WIDTH_16, /* 16 " " */ 00041 MEM_WIDTH_32, /* 32 " " */ 00042 MEM_WIDTH_64 /* 64 " " */ 00043 }; 00044 00045 /* The set of all attributes that can be set for a memory region. 00046 00047 This structure was created so that memory attributes can be passed 00048 to target_ functions without exposing the details of memory region 00049 list, which would be necessary if these fields were simply added to 00050 the mem_region structure. 00051 00052 FIXME: It would be useful if there was a mechanism for targets to 00053 add their own attributes. For example, the number of wait states. */ 00054 00055 struct mem_attrib 00056 { 00057 /* read/write, read-only, or write-only */ 00058 enum mem_access_mode mode; 00059 00060 enum mem_access_width width; 00061 00062 /* enables hardware breakpoints */ 00063 int hwbreak; 00064 00065 /* enables host-side caching of memory region data */ 00066 int cache; 00067 00068 /* Enables memory verification. After a write, memory is re-read 00069 to verify that the write was successful. */ 00070 int verify; 00071 00072 /* Block size. Only valid if mode == MEM_FLASH. */ 00073 int blocksize; 00074 }; 00075 00076 struct mem_region 00077 { 00078 /* Lowest address in the region. */ 00079 CORE_ADDR lo; 00080 /* Address past the highest address of the region. 00081 If 0, upper bound is "infinity". */ 00082 CORE_ADDR hi; 00083 00084 /* Item number of this memory region. */ 00085 int number; 00086 00087 /* Status of this memory region (enabled if non-zero, otherwise 00088 disabled). */ 00089 int enabled_p; 00090 00091 /* Attributes for this region. */ 00092 struct mem_attrib attrib; 00093 }; 00094 00095 /* Declare a vector type for a group of mem_region structures. The 00096 typedef is necessary because vec.h can not handle a struct tag. 00097 Except during construction, these vectors are kept sorted. */ 00098 typedef struct mem_region mem_region_s; 00099 DEF_VEC_O(mem_region_s); 00100 00101 extern struct mem_region *lookup_mem_region(CORE_ADDR); 00102 00103 void invalidate_target_mem_regions (void); 00104 00105 void mem_region_init (struct mem_region *); 00106 00107 int mem_region_cmp (const void *, const void *); 00108 00109 #endif /* MEMATTR_H */