Get configure to define RETSIGTYPE
[deliverable/binutils-gdb.git] / sim / arm / wrapper.c
CommitLineData
a325a02e
SC
1/* run front end support for arm
2 Copyright (C) 1995 Free Software Foundation, Inc.
3
4This file is part of ARM SIM
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
19
20#include <stdio.h>
21#include <stdarg.h>
22#include <armdefs.h>
23#include <bfd.h>
24#include <signal.h>
25#include "callback.h"
26#include "remote-sim.h"
27static struct ARMul_State *state;
28
29static void
30init ()
31{
32 static int done;
33 if (!done)
34 {
35 ARMul_EmulateInit();
36 state = ARMul_NewState ();
37 ARMul_MemoryInit(state, 1<<21);
38 ARMul_OSInit(state);
39 ARMul_CoProInit(state);
40 done = 1;
41 }
42
43}
44void
45ARMul_ConsolePrint (ARMul_State * state, const char *format,...)
46{
47 va_list ap;
48 va_start (ap, format);
49 vprintf (format, ap);
50 va_end (ap);
51}
52
53ARMword
54ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr)
55{
56
57}
58
59void
60sim_size (size)
61 int size;
62{
63 init ();
64 ARMul_MemoryInit (state, 1 << size);
65}
66
67
68void
69sim_set_profile ()
70{
71}
72void
73sim_set_profile_size ()
74{
75}
76
77int
78sim_write (addr, buffer, size)
79 SIM_ADDR addr;
80 unsigned char *buffer;
81 int size;
82{
83 int i;
84 init ();
85 for (i = 0; i < size; i++)
86 {
87 ARMul_WriteByte (state, addr+i, buffer[i]);
88 }
89 return size;
90}
91
92int
93sim_read (addr, buffer, size)
94 SIM_ADDR addr;
95 unsigned char *buffer;
96 int size;
97{
98 int i;
99 init ();
100 for (i = 0; i < size; i++)
101 {
102 buffer[i] = ARMul_ReadByte (state, addr + i);
103 }
104 return size;
105}
106
107void
108sim_trace ()
109{
110}
111
112static int rc;
113void
114sim_resume (step, siggnal)
115 int step, siggnal;
116{
117 if (step)
118 {
119 rc = SIGTRAP;
120 state->Reg[15] = ARMul_DoInstr (state);
121 }
122 else
123 {
124 state->Reg[15] = ARMul_DoProg (state);
125 }
126}
127
128void
129sim_create_inferior (start_address, argv, env)
130 SIM_ADDR start_address;
131 char **argv;
132 char **env;
133{
134 ARMul_SetPC(state, start_address);
135}
136
137void
138sim_info (verbose)
139 int verbose;
140{
141}
142
143
144int
145frommem (state, memory)
146 struct ARMul_State *state;
147 unsigned char *memory;
148{
149 if (state->bigendSig == HIGH)
150 {
151 return (memory[0] << 24)
152 | (memory[1] << 16)
153 | (memory[2] << 8)
154 | (memory[3] << 0);
155 }
156 else
157 {
158 return (memory[3] << 24)
159 | (memory[2] << 16)
160 | (memory[1] << 8)
161 | (memory[0] << 0);
162 }
163}
164
165
166void
167tomem (state, memory, val)
168 struct ARMul_State *state;
169 unsigned char *memory;
170 int val;
171{
172 if (state->bigendSig == HIGH)
173 {
174 memory[0] = val >> 24;
175 memory[1] = val >> 16;
176 memory[2] = val >> 8;
177 memory[3] = val >> 0;
178 }
179 else
180 {
181 memory[3] = val >> 24;
182 memory[2] = val >> 16;
183 memory[1] = val >> 8;
184 memory[0] = val >> 0;
185 }
186}
187
188void
189sim_store_register (rn, memory)
190 int rn;
191 unsigned char *memory;
192{
193 init ();
194 ARMul_SetReg(state, state->Mode, rn, frommem (state, memory));
195}
196
197void
198sim_fetch_register (rn, memory)
199 int rn;
200 unsigned char *memory;
201{
202 init ();
203 tomem (state, memory, ARMul_GetReg(state, state->Mode, rn));
204}
205
206
207
208
209void
210sim_open (name)
211 char *name;
212{
213 /* nothing to do */
214}
215
216void
217sim_close (quitting)
218 int quitting;
219{
220 /* nothing to do */
221}
222
223int
224sim_load (prog, from_tty)
225 char *prog;
226 int from_tty;
227{
228 /* Return nonzero so GDB will handle it. */
229 return 1;
230}
231
232void
233sim_stop_reason (reason, sigrc)
234 enum sim_stop *reason;
235 int *sigrc;
236{
237 *reason = sim_stopped;
238 *sigrc = rc;
239}
240void
241sim_kill ()
242{
243 /* nothing to do */
244}
245
246void
247sim_do_command (cmd)
248 char *cmd;
249{
250 printf_filtered ("This simulator does not accept any commands.\n");
251}
252
253
254void
255sim_set_callbacks (ptr)
256struct host_callback_struct *ptr;
257{
258
259}
This page took 0.102285 seconds and 4 git commands to generate.