2 * This file is part of SIS.
4 * ERC32SIM, SPARC instruction simulator. Copyright (C) 1995 Jiri Gaisler,
5 * European Space Agency
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 675
19 * Mass Ave, Cambridge, MA 02139, USA.
24 #include "gdb/callback.h"
25 #include "gdb/remote-sim.h"
31 /* Maximum events in event queue */
34 /* Maximum # of floating point queue */
37 /* Maximum # of breakpoints */
45 /* type definitions */
47 typedef short int int16; /* 16-bit signed int */
48 typedef unsigned short int uint16; /* 16-bit unsigned int */
49 typedef int int32; /* 32-bit signed int */
50 typedef unsigned int uint32; /* 32-bit unsigned int */
51 typedef float float32; /* 32-bit float */
52 typedef double float64; /* 64-bit float */
54 /* FIXME: what about host compilers that don't support 64-bit ints? */
55 typedef unsigned long long uint64; /* 64-bit unsigned int */
56 typedef long long int64; /* 64-bit signed int */
60 float64 fd[16]; /* FPU registers */
61 #ifdef HOST_LITTLE_ENDIAN_FLOAT
70 uint32 fpq[FPUQN * 2];
77 uint32 fpu_pres; /* FPU present (0 = No, 1 = Yes) */
79 uint32 psr; /* IU registers */
85 uint32 asr17; /* Single vector trapping */
89 uint32 trap; /* Current trap type */
90 uint32 annul; /* Instruction annul */
91 uint32 data; /* Loaded data */
92 uint32 inst; /* Current instruction */
93 uint32 asi; /* Current ASI */
94 uint32 err_mode; /* IU error mode */
98 uint32 bpts[BPT_MAX]; /* Breakpoints */
100 uint32 ltime; /* Load interlock time */
101 uint32 hold; /* IU hold cycles in current inst */
102 uint32 fhold; /* FPU hold cycles in current inst */
103 uint32 icnt; /* Instruction cycles in curr inst */
105 uint32 histlen; /* Trace history management */
107 struct histype *histbuf;
108 float32 freq; /* Simulated processor frequency */
119 uint32 tlimit; /* Simulation time limit */
120 uint32 pwdtime; /* Cycles in power-down mode */
121 uint32 nstore; /* Number of load instructions */
122 uint32 nload; /* Number of store instructions */
123 uint32 nannul; /* Number of annuled instructions */
124 uint32 nbranch; /* Number of branch instructions */
125 uint32 ildreg; /* Destination of last load instruction */
126 uint32 ildtime; /* Last time point for load dependency */
128 int rett_err; /* IU in jmpl/restore error state (Rev.0) */
141 struct evcell *freeq;
160 extern void init_sim PARAMS ((void));
161 extern void reset PARAMS ((void));
162 extern void error_mode PARAMS ((uint32 pc));
163 extern void sim_halt PARAMS ((void));
164 extern void exit_sim PARAMS ((void));
165 extern void init_stdio PARAMS ((void));
166 extern void restore_stdio PARAMS ((void));
167 extern int memory_read PARAMS ((int32 asi, uint32 addr, uint32 *data,
168 int32 sz, int32 *ws));
169 extern int memory_write PARAMS ((int32 asi, uint32 addr, uint32 *data,
170 int32 sz, int32 *ws));
171 extern int sis_memory_write PARAMS ((uint32 addr, char *data,
173 extern int sis_memory_read PARAMS ((uint32 addr, char *data,
177 extern void set_regi PARAMS ((struct pstate *sregs, int32 reg,
179 extern void get_regi PARAMS ((struct pstate *sregs, int32 reg, char *buf));
180 extern int exec_cmd PARAMS ((struct pstate *sregs, char *cmd));
181 extern void reset_stat PARAMS ((struct pstate *sregs));
182 extern void show_stat PARAMS ((struct pstate *sregs));
183 extern void init_bpt PARAMS ((struct pstate *sregs));
184 extern void init_signals PARAMS ((void));
186 struct disassemble_info;
187 extern void dis_mem PARAMS ((uint32 addr, uint32 len,
188 struct disassemble_info *info));
189 extern void event PARAMS ((void (*cfunc) (), int32 arg, uint32 delta));
190 extern void set_int PARAMS ((int32 level, void (*callback) (), int32 arg));
191 extern void advance_time PARAMS ((struct pstate *sregs));
192 extern uint32 now PARAMS ((void));
193 extern int wait_for_irq PARAMS ((void));
194 extern int check_bpt PARAMS ((struct pstate *sregs));
195 extern void reset_all PARAMS ((void));
196 extern void sys_reset PARAMS ((void));
197 extern void sys_halt PARAMS ((void));
198 extern int bfd_load PARAMS ((char *fname));
201 extern int dispatch_instruction PARAMS ((struct pstate *sregs));
202 extern int execute_trap PARAMS ((struct pstate *sregs));
203 extern int check_interrupts PARAMS ((struct pstate *sregs));
204 extern void init_regs PARAMS ((struct pstate *sregs));
207 extern int run_sim PARAMS ((struct pstate *sregs,
208 unsigned int icount, int dis));
211 extern int get_accex PARAMS ((void));
212 extern void clear_accex PARAMS ((void));
213 extern void set_fsr PARAMS ((uint32 fsr));
216 extern void usage PARAMS ((void));
217 extern void gen_help PARAMS ((void));