1 /* The common simulator framework for GDB, the GNU Debugger. 2 3 Copyright 2002-2020 Free Software Foundation, Inc. 4 5 Contributed by Andrew Cagney and Red Hat. 6 7 This file is part of GDB. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22 23 #ifndef SIM_BASICS_H 24 #define SIM_BASICS_H 25 26 27 /* Basic configuration */ 28 29 #ifdef HAVE_CONFIG_H 30 #include "config.h" 31 #endif 32 33 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will 34 bring potential conflicts out in the open */ 35 36 #include <stdarg.h> 37 #include <stdio.h> 38 #include <setjmp.h> 39 40 #ifdef __CYGWIN32__ 41 extern int vasprintf (char **result, const char *format, va_list args); 42 extern int asprintf (char **result, const char *format, ...); 43 #endif 44 45 46 #ifndef NULL 47 #define NULL 0 48 #endif 49 50 51 #ifndef min 52 #define min(a, b) ((a) < (b) ? (a) : (b)) 53 #endif 54 #ifndef max 55 #define max(a, b) ((a) > (b) ? (a) : (b)) 56 #endif 57 58 59 /* Some versions of GCC include an attribute operator, define it */ 60 61 #if !defined (__attribute__) 62 #if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)) 63 #define __attribute__(arg) 64 #endif 65 #endif 66 67 68 /* Global types that code manipulates */ 69 70 struct hw; 71 struct _sim_fpu; 72 73 74 /* Generic address space (maps) and access attributes */ 75 76 enum { 77 read_map = 0, 78 write_map = 1, 79 exec_map = 2, 80 io_map = 3, 81 nr_maps = 32, /* something small */ 82 }; 83 84 enum { 85 access_invalid = 0, 86 access_read = 1 << read_map, 87 access_write = 1 << write_map, 88 access_exec = 1 << exec_map, 89 access_io = 1 << io_map, 90 }; 91 92 enum { 93 access_read_write = (access_read | access_write), 94 access_read_exec = (access_read | access_exec), 95 access_write_exec = (access_write | access_exec), 96 access_read_write_exec = (access_read | access_write | access_exec), 97 access_read_io = (access_read | access_io), 98 access_write_io = (access_write | access_io), 99 access_read_write_io = (access_read | access_write | access_io), 100 access_exec_io = (access_exec | access_io), 101 access_read_exec_io = (access_read | access_exec | access_io), 102 access_write_exec_io = (access_write | access_exec | access_io), 103 access_read_write_exec_io = (access_read | access_write | access_exec | access_io), 104 }; 105 106 107 /* disposition of an object when things are reset */ 108 109 typedef enum { 110 permenant_object, 111 temporary_object, 112 } object_disposition; 113 114 115 /* Memory transfer types */ 116 117 typedef enum _transfer_type { 118 read_transfer, 119 write_transfer, 120 } transfer_type; 121 122 123 /* directions */ 124 125 typedef enum { 126 bidirect_port, 127 input_port, 128 output_port, 129 } port_direction; 130 131 132 133 /* Basic definitions - ordered so that nothing calls what comes after it. */ 134 135 #include "ansidecl.h" 136 #include "gdb/callback.h" 137 #include "gdb/remote-sim.h" 138 139 #include "sim-config.h" 140 141 #include "sim-inline.h" 142 143 #include "sim-types.h" 144 #include "sim-bits.h" 145 #include "sim-endian.h" 146 #include "sim-signal.h" 147 148 #include "sim-utils.h" 149 150 #include "libiberty.h" 151 152 /* Note: Only the simpler interfaces are defined here. More heavy 153 weight objects, such as core and events, are defined in the more 154 serious sim-base.h header. */ 155 156 #endif /* SIM_BASICS_H */ 157