base.isa (3931:de791fa53d04) base.isa (3978:739bc3a17929)
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 175 unchanged lines hidden (view full) ---

184
185 void
186 SparcStaticInst::printReg(std::ostream &os, int reg) const
187 {
188 const int MaxGlobal = 8;
189 const int MaxOutput = 16;
190 const int MaxLocal = 24;
191 const int MaxInput = 32;
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 175 unchanged lines hidden (view full) ---

184
185 void
186 SparcStaticInst::printReg(std::ostream &os, int reg) const
187 {
188 const int MaxGlobal = 8;
189 const int MaxOutput = 16;
190 const int MaxLocal = 24;
191 const int MaxInput = 32;
192 const int MaxMicroReg = 33;
193 if (reg == FramePointerReg)
194 ccprintf(os, "%%fp");
195 else if (reg == StackPointerReg)
196 ccprintf(os, "%%sp");
197 else if(reg < MaxGlobal)
198 ccprintf(os, "%%g%d", reg);
199 else if(reg < MaxOutput)
200 ccprintf(os, "%%o%d", reg - MaxGlobal);
201 else if(reg < MaxLocal)
202 ccprintf(os, "%%l%d", reg - MaxOutput);
203 else if(reg < MaxInput)
204 ccprintf(os, "%%i%d", reg - MaxLocal);
205 else if(reg < MaxMicroReg)
206 ccprintf(os, "%%u%d", reg - MaxInput);
207 else {
208 ccprintf(os, "%%f%d", reg - MaxMicroReg);
192 const int MaxMicroReg = 40;
193 if (reg < FP_Base_DepTag) {
194 //If we used a register from the next or previous window,
195 //take out the offset.
196 while (reg >= MaxMicroReg)
197 reg -= MaxMicroReg;
198 if (reg == FramePointerReg)
199 ccprintf(os, "%%fp");
200 else if (reg == StackPointerReg)
201 ccprintf(os, "%%sp");
202 else if(reg < MaxGlobal)
203 ccprintf(os, "%%g%d", reg);
204 else if(reg < MaxOutput)
205 ccprintf(os, "%%o%d", reg - MaxGlobal);
206 else if(reg < MaxLocal)
207 ccprintf(os, "%%l%d", reg - MaxOutput);
208 else if(reg < MaxInput)
209 ccprintf(os, "%%i%d", reg - MaxLocal);
210 else if(reg < MaxMicroReg)
211 ccprintf(os, "%%u%d", reg - MaxInput);
212 //The fake int regs that are really control regs
213 else {
214 switch (reg - MaxMicroReg) {
215 case 1:
216 ccprintf(os, "%%y");
217 break;
218 case 2:
219 ccprintf(os, "%%ccr");
220 break;
221 case 3:
222 ccprintf(os, "%%cansave");
223 break;
224 case 4:
225 ccprintf(os, "%%canrestore");
226 break;
227 case 5:
228 ccprintf(os, "%%cleanwin");
229 break;
230 case 6:
231 ccprintf(os, "%%otherwin");
232 break;
233 case 7:
234 ccprintf(os, "%%wstate");
235 break;
236 }
237 }
238 } else if (reg < Ctrl_Base_DepTag) {
239 ccprintf(os, "%%f%d", reg - FP_Base_DepTag);
240 } else {
241 switch (reg - Ctrl_Base_DepTag) {
242 case MISCREG_ASI:
243 ccprintf(os, "%%asi");
244 break;
245 case MISCREG_FPRS:
246 ccprintf(os, "%%fprs");
247 break;
248 case MISCREG_PCR:
249 ccprintf(os, "%%pcr");
250 break;
251 case MISCREG_PIC:
252 ccprintf(os, "%%pic");
253 break;
254 case MISCREG_GSR:
255 ccprintf(os, "%%gsr");
256 break;
257 case MISCREG_SOFTINT:
258 ccprintf(os, "%%softint");
259 break;
260 case MISCREG_SOFTINT_SET:
261 ccprintf(os, "%%softint_set");
262 break;
263 case MISCREG_SOFTINT_CLR:
264 ccprintf(os, "%%softint_clr");
265 break;
266 case MISCREG_TICK_CMPR:
267 ccprintf(os, "%%tick_cmpr");
268 break;
269 case MISCREG_STICK:
270 ccprintf(os, "%%stick");
271 break;
272 case MISCREG_STICK_CMPR:
273 ccprintf(os, "%%stick_cmpr");
274 break;
275 case MISCREG_TPC:
276 ccprintf(os, "%%tpc");
277 break;
278 case MISCREG_TNPC:
279 ccprintf(os, "%%tnpc");
280 break;
281 case MISCREG_TSTATE:
282 ccprintf(os, "%%tstate");
283 break;
284 case MISCREG_TT:
285 ccprintf(os, "%%tt");
286 break;
287 case MISCREG_TICK:
288 ccprintf(os, "%%tick");
289 break;
290 case MISCREG_TBA:
291 ccprintf(os, "%%tba");
292 break;
293 case MISCREG_PSTATE:
294 ccprintf(os, "%%pstate");
295 break;
296 case MISCREG_TL:
297 ccprintf(os, "%%tl");
298 break;
299 case MISCREG_PIL:
300 ccprintf(os, "%%pil");
301 break;
302 case MISCREG_CWP:
303 ccprintf(os, "%%cwp");
304 break;
305 case MISCREG_GL:
306 ccprintf(os, "%%gl");
307 break;
308 case MISCREG_HPSTATE:
309 ccprintf(os, "%%hpstate");
310 break;
311 case MISCREG_HTSTATE:
312 ccprintf(os, "%%htstate");
313 break;
314 case MISCREG_HINTP:
315 ccprintf(os, "%%hintp");
316 break;
317 case MISCREG_HTBA:
318 ccprintf(os, "%%htba");
319 break;
320 case MISCREG_HSTICK_CMPR:
321 ccprintf(os, "%%hstick_cmpr");
322 break;
323 case MISCREG_HVER:
324 ccprintf(os, "%%hver");
325 break;
326 case MISCREG_STRAND_STS_REG:
327 ccprintf(os, "%%strand_sts_reg");
328 break;
329 case MISCREG_FSR:
330 ccprintf(os, "%%fsr");
331 break;
332 default:
333 ccprintf(os, "%%ctrl%d", reg - Ctrl_Base_DepTag);
334 }
209 }
210 }
211
212 std::string SparcStaticInst::generateDisassembly(Addr pc,
213 const SymbolTable *symtab) const
214 {
215 std::stringstream ss;
216

--- 68 unchanged lines hidden (view full) ---

285 case OverflowSet:
286 return condCodes.v;
287 }
288 panic("Tried testing condition nonexistant "
289 "condition code %d", condition);
290 }
291}};
292
335 }
336 }
337
338 std::string SparcStaticInst::generateDisassembly(Addr pc,
339 const SymbolTable *symtab) const
340 {
341 std::stringstream ss;
342

--- 68 unchanged lines hidden (view full) ---

411 case OverflowSet:
412 return condCodes.v;
413 }
414 panic("Tried testing condition nonexistant "
415 "condition code %d", condition);
416 }
417}};
418
293output exec {{
294 /// Check "FP enabled" machine status bit. Called when executing any FP
295 /// instruction in full-system mode.
296 /// @retval Full-system mode: NoFault if FP is enabled, FpDisabled
297 /// if not. Non-full-system mode: always returns NoFault.
298#if FULL_SYSTEM
299 inline Fault checkFpEnableFault(%(CPU_exec_context)s *xc)
300 {
301 Fault fault = NoFault; // dummy... this ipr access should not fault
302 if (xc->readMiscRegWithEffect(MISCREG_PSTATE) & PSTATE::pef &&
303 xc->readMiscRegWithEffect(MISCREG_FPRS) & 0x4)
304 return NoFault;
305 else
306 return new FpDisabled;
307 }
308#else
309 inline Fault checkFpEnableFault(%(CPU_exec_context)s *xc)
310 {
311 return NoFault;
312 }
313#endif
314}};
315
316