1 /* run front end support for arm
2 Copyright (C) 1995 Free Software Foundation, Inc.
4 This file is part of ARM SIM
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
26 #include "remote-sim.h"
27 static struct ARMul_State *state;
36 state = ARMul_NewState ();
37 ARMul_MemoryInit(state, 1<<21);
39 ARMul_CoProInit(state);
45 ARMul_ConsolePrint (ARMul_State * state, const char *format,...)
48 va_start (ap, format);
54 ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr)
64 ARMul_MemoryInit (state, 1 << size);
73 sim_set_profile_size ()
78 sim_write (addr, buffer, size)
80 unsigned char *buffer;
85 for (i = 0; i < size; i++)
87 ARMul_WriteByte (state, addr+i, buffer[i]);
93 sim_read (addr, buffer, size)
95 unsigned char *buffer;
100 for (i = 0; i < size; i++)
102 buffer[i] = ARMul_ReadByte (state, addr + i);
114 sim_resume (step, siggnal)
120 state->Reg[15] = ARMul_DoInstr (state);
124 state->Reg[15] = ARMul_DoProg (state);
129 sim_create_inferior (start_address, argv, env)
130 SIM_ADDR start_address;
134 ARMul_SetPC(state, start_address);
145 frommem (state, memory)
146 struct ARMul_State *state;
147 unsigned char *memory;
149 if (state->bigendSig == HIGH)
151 return (memory[0] << 24)
158 return (memory[3] << 24)
167 tomem (state, memory, val)
168 struct ARMul_State *state;
169 unsigned char *memory;
172 if (state->bigendSig == HIGH)
174 memory[0] = val >> 24;
175 memory[1] = val >> 16;
176 memory[2] = val >> 8;
177 memory[3] = val >> 0;
181 memory[3] = val >> 24;
182 memory[2] = val >> 16;
183 memory[1] = val >> 8;
184 memory[0] = val >> 0;
189 sim_store_register (rn, memory)
191 unsigned char *memory;
194 ARMul_SetReg(state, state->Mode, rn, frommem (state, memory));
198 sim_fetch_register (rn, memory)
200 unsigned char *memory;
203 tomem (state, memory, ARMul_GetReg(state, state->Mode, rn));
224 sim_load (prog, from_tty)
228 /* Return nonzero so GDB will handle it. */
233 sim_stop_reason (reason, sigrc)
234 enum sim_stop *reason;
237 *reason = sim_stopped;
250 printf_filtered ("This simulator does not accept any commands.\n");
255 sim_set_callbacks (ptr)
256 struct host_callback_struct *ptr;