gdb/memattr.h - gdb

Global variables defined

Data types defined

Macros defined

Source code

  1. /* Memory attributes support, for GDB.

  2.    Copyright (C) 2001-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef MEMATTR_H
  15. #define MEMATTR_H

  16. #include "vec.h"

  17. enum mem_access_mode
  18. {
  19.   MEM_NONE,                     /* Memory that is not physically present.  */
  20.   MEM_RW,                        /* read/write */
  21.   MEM_RO,                        /* read only */
  22.   MEM_WO,                        /* write only */

  23.   /* Read/write, but special steps are required to write to it.  */
  24.   MEM_FLASH
  25. };

  26. enum mem_access_width
  27. {
  28.   MEM_WIDTH_UNSPECIFIED,
  29.   MEM_WIDTH_8,                        /*  8 bit accesses */
  30.   MEM_WIDTH_16,                        /* 16  "      "    */
  31.   MEM_WIDTH_32,                        /* 32  "      "    */
  32.   MEM_WIDTH_64                        /* 64  "      "    */
  33. };

  34. /* The set of all attributes that can be set for a memory region.

  35.    This structure was created so that memory attributes can be passed
  36.    to target_ functions without exposing the details of memory region
  37.    list, which would be necessary if these fields were simply added to
  38.    the mem_region structure.

  39.    FIXME: It would be useful if there was a mechanism for targets to
  40.    add their own attributes.  For example, the number of wait states.  */

  41. struct mem_attrib
  42. {
  43.   /* read/write, read-only, or write-only */
  44.   enum mem_access_mode mode;

  45.   enum mem_access_width width;

  46.   /* enables hardware breakpoints */
  47.   int hwbreak;

  48.   /* enables host-side caching of memory region data */
  49.   int cache;

  50.   /* Enables memory verification.  After a write, memory is re-read
  51.      to verify that the write was successful.  */
  52.   int verify;

  53.   /* Block size.  Only valid if mode == MEM_FLASH.  */
  54.   int blocksize;
  55. };

  56. struct mem_region
  57. {
  58.   /* Lowest address in the region.  */
  59.   CORE_ADDR lo;
  60.   /* Address past the highest address of the region.
  61.      If 0, upper bound is "infinity".  */
  62.   CORE_ADDR hi;

  63.   /* Item number of this memory region.  */
  64.   int number;

  65.   /* Status of this memory region (enabled if non-zero, otherwise
  66.      disabled).  */
  67.   int enabled_p;

  68.   /* Attributes for this region.  */
  69.   struct mem_attrib attrib;
  70. };

  71. /* Declare a vector type for a group of mem_region structures.  The
  72.    typedef is necessary because vec.h can not handle a struct tag.
  73.    Except during construction, these vectors are kept sorted.  */
  74. typedef struct mem_region mem_region_s;
  75. DEF_VEC_O(mem_region_s);

  76. extern struct mem_region *lookup_mem_region(CORE_ADDR);

  77. void invalidate_target_mem_regions (void);

  78. void mem_region_init (struct mem_region *);

  79. int mem_region_cmp (const void *, const void *);

  80. #endif        /* MEMATTR_H */