1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 typedef struct _sim_core_mapping sim_core_mapping
;
29 struct _sim_core_mapping
{
44 sim_core_mapping
*next
;
47 typedef struct _sim_core_map sim_core_map
;
48 struct _sim_core_map
{
49 sim_core_mapping
*first
;
60 /* Main core structure */
62 typedef struct _sim_core sim_core
;
65 sim_core_map map
[nr_sim_core_maps
];
69 /* Per CPU distributed component of the core */
71 typedef sim_core sim_cpu_core
;
74 /* Install the "core" module. */
77 (SIM_RC
) sim_core_install (SIM_DESC sd
);
80 /* Uninstall the "core" subsystem. */
84 sim_core_uninstall (SIM_DESC sd
);
91 (SIM_RC
) sim_core_init
99 (void) sim_core_set_trace\
105 /* Create a memory space within the core.
107 The CPU option (when non NULL) specifes the single processor that
108 the memory space is to be attached to. (unimplemented) */
111 (void) sim_core_attach
118 unsigned nr_bytes
, /* host limited */
120 void *optional_buffer
);
124 /* Variable sized read/write
126 Transfer a variable sized block of raw data between the host and
127 target. Should any problems occure, the number of bytes
128 successfully transfered is returned. */
131 (unsigned) sim_core_read_buffer
139 (unsigned) sim_core_write_buffer
147 /* Fixed sized, processor oriented, read/write.
149 Transfer a fixed amout of memory between the host and target. The
150 data transfered is translated from/to host to/from target byte
151 order. Should the transfer fail, the operation shall abort (no
152 return). The aligned alternative makes the assumption that that
153 the address is N byte aligned (no alignment checks are made). The
154 unaligned alternative checks the address for correct byte
155 alignment. Action, as defined by WITH_ALIGNMENT, being taken
156 should the check fail. */
158 #define DECLARE_SIM_CORE_WRITE_N(ALIGNMENT,N) \
160 (void) sim_core_write_##ALIGNMENT##_##N \
164 unsigned_word addr, \
167 DECLARE_SIM_CORE_WRITE_N(aligned
,1)
168 DECLARE_SIM_CORE_WRITE_N(aligned
,2)
169 DECLARE_SIM_CORE_WRITE_N(aligned
,4)
170 DECLARE_SIM_CORE_WRITE_N(aligned
,8)
171 DECLARE_SIM_CORE_WRITE_N(aligned
,word
)
173 DECLARE_SIM_CORE_WRITE_N(unaligned
,1)
174 DECLARE_SIM_CORE_WRITE_N(unaligned
,2)
175 DECLARE_SIM_CORE_WRITE_N(unaligned
,4)
176 DECLARE_SIM_CORE_WRITE_N(unaligned
,8)
177 DECLARE_SIM_CORE_WRITE_N(unaligned
,word
)
179 #define sim_core_write_1 sim_core_write_aligned_1
180 #define sim_core_write_2 sim_core_write_aligned_2
181 #define sim_core_write_4 sim_core_write_aligned_4
182 #define sim_core_write_8 sim_core_write_aligned_8
184 #undef DECLARE_SIM_CORE_WRITE_N
187 #define DECLARE_SIM_CORE_READ_N(ALIGNMENT,N) \
189 (unsigned_##N) sim_core_read_##ALIGNMENT##_##N \
195 DECLARE_SIM_CORE_READ_N(aligned
,1)
196 DECLARE_SIM_CORE_READ_N(aligned
,2)
197 DECLARE_SIM_CORE_READ_N(aligned
,4)
198 DECLARE_SIM_CORE_READ_N(aligned
,8)
199 DECLARE_SIM_CORE_READ_N(aligned
,word
)
201 DECLARE_SIM_CORE_READ_N(unaligned
,1)
202 DECLARE_SIM_CORE_READ_N(unaligned
,2)
203 DECLARE_SIM_CORE_READ_N(unaligned
,4)
204 DECLARE_SIM_CORE_READ_N(unaligned
,8)
205 DECLARE_SIM_CORE_READ_N(unaligned
,word
)
207 #define sim_core_read_1 sim_core_read_aligned_1
208 #define sim_core_read_2 sim_core_read_aligned_2
209 #define sim_core_read_4 sim_core_read_aligned_4
210 #define sim_core_read_8 sim_core_read_aligned_8
212 #undef DECLARE_SIM_CORE_READ_N