00001 /* 00002 * machine/sparc/sparc.h - Emulator interface file 00003 * 00004 * Automatically generated by genemu 0.61 on Tue Mar 19 18:21:35 2002 from: 00005 * machine/sparc/sparc-core.spec (Wed Nov 28 09:33:18 2001) 00006 * machine/sparc/sparc.ssl (Wed Nov 28 09:33:21 2001) 00007 */ 00008 #ifndef sparc_emu_H 00009 #define sparc_emu_H 00010 00011 #include <stdlib.h> 00012 00013 typedef signed char sint8_t; 00014 typedef signed short sint16_t; 00015 typedef signed int sint32_t; 00016 typedef signed long long sint64_t; 00017 typedef unsigned char uint8_t; 00018 typedef unsigned short uint16_t; 00019 typedef unsigned int uint32_t; 00020 typedef unsigned long long uint64_t; 00021 typedef float float32_t; 00022 typedef double float64_t; 00023 typedef long double float128_t; 00024 typedef long double NO_SUCH_TYPE; /* temporary copout */ 00025 00026 #ifndef HAVE_disasm_fmt_t 00027 #define HAVE_disasm_fmt_t 00028 00029 typedef struct { 00030 char *addrfmt; 00031 char *hexfmt; 00032 int hexwidth, hexlen; 00033 int opnamelen; 00034 int operandlen; 00035 bool showHex; 00036 bool showSymbols; 00037 } disasm_fmt_t; 00038 00039 #endif /* !HAVE_disasm_fmt_t */ 00040 00041 extern disasm_fmt_t defDisasmFmt; 00042 00043 /* 00044 * Low-level disassembly function. Given mem relative pc, 00045 * disassembles one instruction, returning the operands as a string in 00046 * params, and setting name (if not NULL) to the operation name. 00047 * Returns the pc of the immediately following instruction 00048 */ 00049 int disassembleInstruction( int pc, char *params, size_t paramlen, 00050 char **name ); 00051 /* 00052 * Public disassembly function. Given mem relative pc, disassembles 00053 * the instruction and stores a human-readable representation in buf, with the 00054 * formatting determined by fmt. Returns the pc of the following instruction. 00055 */ 00056 int sprintDisassembleInst( int pc, char *buf, int buflen, 00057 disasm_fmt_t &fmt = defDisasmFmt ); 00058 00059 /* Globals */ 00060 00061 /* Zero if debugging should be turned off, non-zero otherwise */ 00062 extern int debug; 00063 00064 /* count of total instructions executed to date */ 00065 extern long int icount; 00066 00067 /* Functions */ 00068 00069 /* 00070 * Low-level function that executes the instruction at the given pc, and returns 00071 * the pc of the immediately following instruction (this is not necessarily the 00072 * next instruction to be executed). You don't usually need to use this directly 00073 */ 00074 uint32_t execute( uint32_t pc ); 00075 00076 /* 00077 * Public single-step function. Executes the instruction at the current pc, and 00078 * updates the pc to point to the next instruction for execution. 00079 */ 00080 void executeOneInstruction( void ); 00081 00082 /* 00083 * Callback hook for traps. cond is true if the trap should execute, and the 00084 * trap number is given in trap. 00085 */ 00086 void doTrap( int trap ); 00087 00088 /* 00089 * Various register dumping procedures. 00090 */ 00091 void dumpControlRegisters( FILE *f ); 00092 void dumpMainRegisters( FILE *f ); 00093 void dumpFloatRegisters( FILE *f ); 00094 void dumpAllRegisters( FILE *f ); 00095 00096 /* Register structure */ 00097 struct RegisterFile { 00098 sint32_t rd[32]; 00099 union { 00100 struct { 00101 union { 00102 struct { 00103 float32_t r_f0; 00104 float32_t r_f1; 00105 } r_f0to1_str; 00106 float64_t r_f0to1; 00107 } r_f0to1_un; 00108 union { 00109 struct { 00110 float32_t r_f2; 00111 float32_t r_f3; 00112 } r_f2to3_str; 00113 float64_t r_f2to3; 00114 } r_f2to3_un; 00115 } r_f0to3_str; 00116 float128_t r_f0to3; 00117 } r_f0to3_un; 00118 union { 00119 struct { 00120 union { 00121 struct { 00122 float32_t r_f4; 00123 float32_t r_f5; 00124 } r_f4to5_str; 00125 float64_t r_f4to5; 00126 } r_f4to5_un; 00127 union { 00128 struct { 00129 float32_t r_f6; 00130 float32_t r_f7; 00131 } r_f6to7_str; 00132 float64_t r_f6to7; 00133 } r_f6to7_un; 00134 } r_f4to7_str; 00135 float128_t r_f4to7; 00136 } r_f4to7_un; 00137 union { 00138 struct { 00139 union { 00140 struct { 00141 float32_t r_f8; 00142 float32_t r_f9; 00143 } r_f8to9_str; 00144 float64_t r_f8to9; 00145 } r_f8to9_un; 00146 union { 00147 struct { 00148 float32_t r_f10; 00149 float32_t r_f11; 00150 } r_f10to11_str; 00151 float64_t r_f10to11; 00152 } r_f10to11_un; 00153 } r_f8to11_str; 00154 float128_t r_f8to11; 00155 } r_f8to11_un; 00156 union { 00157 struct { 00158 union { 00159 struct { 00160 float32_t r_f12; 00161 float32_t r_f13; 00162 } r_f12to13_str; 00163 float64_t r_f12to13; 00164 } r_f12to13_un; 00165 union { 00166 struct { 00167 float32_t r_f14; 00168 float32_t r_f15; 00169 } r_f14to15_str; 00170 float64_t r_f14to15; 00171 } r_f14to15_un; 00172 } r_f12to15_str; 00173 float128_t r_f12to15; 00174 } r_f12to15_un; 00175 union { 00176 struct { 00177 union { 00178 struct { 00179 float32_t r_f16; 00180 float32_t r_f17; 00181 } r_f16to17_str; 00182 float64_t r_f16to17; 00183 } r_f16to17_un; 00184 union { 00185 struct { 00186 float32_t r_f18; 00187 float32_t r_f19; 00188 } r_f18to19_str; 00189 float64_t r_f18to19; 00190 } r_f18to19_un; 00191 } r_f16to19_str; 00192 float128_t r_f16to19; 00193 } r_f16to19_un; 00194 union { 00195 struct { 00196 union { 00197 struct { 00198 float32_t r_f20; 00199 float32_t r_f21; 00200 } r_f20to21_str; 00201 float64_t r_f20to21; 00202 } r_f20to21_un; 00203 union { 00204 struct { 00205 float32_t r_f22; 00206 float32_t r_f23; 00207 } r_f22to23_str; 00208 float64_t r_f22to23; 00209 } r_f22to23_un; 00210 } r_f20to23_str; 00211 float128_t r_f20to23; 00212 } r_f20to23_un; 00213 union { 00214 struct { 00215 union { 00216 struct { 00217 float32_t r_f24; 00218 float32_t r_f25; 00219 } r_f24to25_str; 00220 float64_t r_f24to25; 00221 } r_f24to25_un; 00222 union { 00223 struct { 00224 float32_t r_f26; 00225 float32_t r_f27; 00226 } r_f26to27_str; 00227 float64_t r_f26to27; 00228 } r_f26to27_un; 00229 } r_f24to27_str; 00230 float128_t r_f24to27; 00231 } r_f24to27_un; 00232 union { 00233 struct { 00234 union { 00235 struct { 00236 float32_t r_f28; 00237 float32_t r_f29; 00238 } r_f28to29_str; 00239 float64_t r_f28to29; 00240 } r_f28to29_un; 00241 union { 00242 struct { 00243 float32_t r_f30; 00244 float32_t r_f31; 00245 } r_f30to31_str; 00246 float64_t r_f30to31; 00247 } r_f30to31_un; 00248 } r_f28to31_str; 00249 float128_t r_f28to31; 00250 } r_f28to31_un; 00251 sint8_t r_AF; 00252 sint8_t r_CF; 00253 sint8_t r_CTI; 00254 sint32_t r_CWP; 00255 sint8_t r_FGF; 00256 sint8_t r_FLF; 00257 sint32_t r_FSR; 00258 sint8_t r_FZF; 00259 sint32_t r_NEXT; 00260 sint8_t r_NF; 00261 sint8_t r_OF; 00262 sint32_t r_PSR; 00263 sint32_t r_TBR; 00264 sint32_t r_WIM; 00265 sint32_t r_Y; 00266 sint8_t r_ZF; 00267 sint32_t r_npc; 00268 sint32_t r_pc; 00269 }; 00270 00271 00272 extern RegisterFile regs; 00273 ; 00274 00275 extern char *mem; 00276 00277 00278 00279 #endif /* !sparc_emu_H */ 00280