ev5.cc revision 8794:e2ac2b7164dd
12686Sksewell@umich.edu/* 25254Sksewell@umich.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan 35254Sksewell@umich.edu * All rights reserved. 42686Sksewell@umich.edu * 55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145254Sksewell@umich.edu * this software without specific prior written permission. 152686Sksewell@umich.edu * 165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272706Sksewell@umich.edu * 285254Sksewell@umich.edu * Authors: Steve Reinhardt 292686Sksewell@umich.edu * Nathan Binkert 302686Sksewell@umich.edu */ 317678Sgblack@eecs.umich.edu 327678Sgblack@eecs.umich.edu#include "arch/alpha/faults.hh" 334661Sksewell@umich.edu#include "arch/alpha/isa_traits.hh" 342686Sksewell@umich.edu#include "arch/alpha/kernel_stats.hh" 354661Sksewell@umich.edu#include "arch/alpha/osfpal.hh" 364661Sksewell@umich.edu#include "arch/alpha/tlb.hh" 374661Sksewell@umich.edu#include "base/cp_annotate.hh" 384661Sksewell@umich.edu#include "base/debug.hh" 394661Sksewell@umich.edu#include "cpu/base.hh" 402980Sgblack@eecs.umich.edu#include "cpu/simple_thread.hh" 412686Sksewell@umich.edu#include "cpu/thread_context.hh" 425222Sksewell@umich.edu#include "sim/sim_exit.hh" 436379Sgblack@eecs.umich.edu 445222Sksewell@umich.edunamespace AlphaISA { 455222Sksewell@umich.edu 465222Sksewell@umich.edu//////////////////////////////////////////////////////////////////////// 475222Sksewell@umich.edu// 485222Sksewell@umich.edu// Machine dependent functions 492686Sksewell@umich.edu// 504661Sksewell@umich.eduvoid 512686Sksewell@umich.eduinitCPU(ThreadContext *tc, int cpuId) 525222Sksewell@umich.edu{ 535222Sksewell@umich.edu initIPRs(tc, cpuId); 542686Sksewell@umich.edu 557693SAli.Saidi@ARM.com tc->setIntReg(16, cpuId); 565222Sksewell@umich.edu tc->setIntReg(0, cpuId); 575222Sksewell@umich.edu 586379Sgblack@eecs.umich.edu AlphaFault *reset = new ResetFault; 595222Sksewell@umich.edu 606379Sgblack@eecs.umich.edu tc->pcState(tc->readMiscRegNoEffect(IPR_PAL_BASE) + reset->vect()); 615222Sksewell@umich.edu 626379Sgblack@eecs.umich.edu delete reset; 635222Sksewell@umich.edu} 645222Sksewell@umich.edu 655498Ssaidi@eecs.umich.edutemplate <class CPU> 665222Sksewell@umich.eduvoid 676379Sgblack@eecs.umich.eduzeroRegisters(CPU *cpu) 685222Sksewell@umich.edu{ 695222Sksewell@umich.edu // Insure ISA semantics 705222Sksewell@umich.edu // (no longer very clean due to the change in setIntReg() in the 715222Sksewell@umich.edu // cpu model. Consider changing later.) 725222Sksewell@umich.edu cpu->thread->setIntReg(ZeroReg, 0); 735222Sksewell@umich.edu cpu->thread->setFloatReg(ZeroReg, 0.0); 745222Sksewell@umich.edu} 755222Sksewell@umich.edu 765222Sksewell@umich.edu//////////////////////////////////////////////////////////////////////// 775222Sksewell@umich.edu// 782686Sksewell@umich.edu// 792686Sksewell@umich.edu// 802686Sksewell@umich.eduvoid 812686Sksewell@umich.eduinitIPRs(ThreadContext *tc, int cpuId) 822686Sksewell@umich.edu{ 832686Sksewell@umich.edu for (int i = 0; i < NumInternalProcRegs; ++i) { 842686Sksewell@umich.edu tc->setMiscRegNoEffect(i, 0); 852686Sksewell@umich.edu } 862686Sksewell@umich.edu 872686Sksewell@umich.edu tc->setMiscRegNoEffect(IPR_PAL_BASE, PalBase); 882686Sksewell@umich.edu tc->setMiscRegNoEffect(IPR_MCSR, 0x6); 892686Sksewell@umich.edu tc->setMiscRegNoEffect(IPR_PALtemp16, cpuId); 902686Sksewell@umich.edu} 912686Sksewell@umich.edu 922686Sksewell@umich.eduMiscReg 932686Sksewell@umich.eduISA::readIpr(int idx, ThreadContext *tc) 942686Sksewell@umich.edu{ 952686Sksewell@umich.edu uint64_t retval = 0; // return value, default 0 962686Sksewell@umich.edu 972686Sksewell@umich.edu switch (idx) { 982686Sksewell@umich.edu case IPR_PALtemp0: 992686Sksewell@umich.edu case IPR_PALtemp1: 1002686Sksewell@umich.edu case IPR_PALtemp2: 1012686Sksewell@umich.edu case IPR_PALtemp3: 1022686Sksewell@umich.edu case IPR_PALtemp4: 1032686Sksewell@umich.edu case IPR_PALtemp5: 1042686Sksewell@umich.edu case IPR_PALtemp6: 1052686Sksewell@umich.edu case IPR_PALtemp7: 1062686Sksewell@umich.edu case IPR_PALtemp8: 1072686Sksewell@umich.edu case IPR_PALtemp9: 1082686Sksewell@umich.edu case IPR_PALtemp10: 1092686Sksewell@umich.edu case IPR_PALtemp11: 1102686Sksewell@umich.edu case IPR_PALtemp12: 1112686Sksewell@umich.edu case IPR_PALtemp13: 1122686Sksewell@umich.edu case IPR_PALtemp14: 1132686Sksewell@umich.edu case IPR_PALtemp15: 1142686Sksewell@umich.edu case IPR_PALtemp16: 1152686Sksewell@umich.edu case IPR_PALtemp17: 1162686Sksewell@umich.edu case IPR_PALtemp18: 1172686Sksewell@umich.edu case IPR_PALtemp19: 1182686Sksewell@umich.edu case IPR_PALtemp20: 1192686Sksewell@umich.edu case IPR_PALtemp21: 1202686Sksewell@umich.edu case IPR_PALtemp22: 1215222Sksewell@umich.edu case IPR_PALtemp23: 1222686Sksewell@umich.edu case IPR_PAL_BASE: 1232686Sksewell@umich.edu 1242686Sksewell@umich.edu case IPR_IVPTBR: 1252686Sksewell@umich.edu case IPR_DC_MODE: 1262686Sksewell@umich.edu case IPR_MAF_MODE: 1272686Sksewell@umich.edu case IPR_ISR: 1282686Sksewell@umich.edu case IPR_EXC_ADDR: 1292686Sksewell@umich.edu case IPR_IC_PERR_STAT: 1302686Sksewell@umich.edu case IPR_DC_PERR_STAT: 1312686Sksewell@umich.edu case IPR_MCSR: 1325222Sksewell@umich.edu case IPR_ASTRR: 1332686Sksewell@umich.edu case IPR_ASTER: 1342686Sksewell@umich.edu case IPR_SIRR: 1352686Sksewell@umich.edu case IPR_ICSR: 1362686Sksewell@umich.edu case IPR_ICM: 1372686Sksewell@umich.edu case IPR_DTB_CM: 1382686Sksewell@umich.edu case IPR_IPLR: 1395222Sksewell@umich.edu case IPR_INTID: 1402686Sksewell@umich.edu case IPR_PMCTR: 1412686Sksewell@umich.edu // no side-effect 1422686Sksewell@umich.edu retval = ipr[idx]; 1432686Sksewell@umich.edu break; 1442686Sksewell@umich.edu 1452686Sksewell@umich.edu case IPR_CC: 1462686Sksewell@umich.edu retval |= ipr[idx] & ULL(0xffffffff00000000); 1475222Sksewell@umich.edu retval |= tc->getCpuPtr()->curCycle() & ULL(0x00000000ffffffff); 1482686Sksewell@umich.edu break; 1492686Sksewell@umich.edu 1502686Sksewell@umich.edu case IPR_VA: 1515570Snate@binkert.org retval = ipr[idx]; 1522686Sksewell@umich.edu break; 1532686Sksewell@umich.edu 1542686Sksewell@umich.edu case IPR_VA_FORM: 1552686Sksewell@umich.edu case IPR_MM_STAT: 1562686Sksewell@umich.edu case IPR_IFAULT_VA_FORM: 1572686Sksewell@umich.edu case IPR_EXC_MASK: 1582686Sksewell@umich.edu case IPR_EXC_SUM: 1595222Sksewell@umich.edu retval = ipr[idx]; 1602686Sksewell@umich.edu break; 1612686Sksewell@umich.edu 1622686Sksewell@umich.edu case IPR_DTB_PTE: 1632686Sksewell@umich.edu { 1642686Sksewell@umich.edu TlbEntry &entry 1652686Sksewell@umich.edu = tc->getDTBPtr()->index(!tc->misspeculating()); 1662686Sksewell@umich.edu 1672686Sksewell@umich.edu retval |= ((uint64_t)entry.ppn & ULL(0x7ffffff)) << 32; 1682686Sksewell@umich.edu retval |= ((uint64_t)entry.xre & ULL(0xf)) << 8; 1692686Sksewell@umich.edu retval |= ((uint64_t)entry.xwe & ULL(0xf)) << 12; 1702686Sksewell@umich.edu retval |= ((uint64_t)entry.fonr & ULL(0x1)) << 1; 1712686Sksewell@umich.edu retval |= ((uint64_t)entry.fonw & ULL(0x1))<< 2; 1722686Sksewell@umich.edu retval |= ((uint64_t)entry.asma & ULL(0x1)) << 4; 1735222Sksewell@umich.edu retval |= ((uint64_t)entry.asn & ULL(0x7f)) << 57; 1742686Sksewell@umich.edu } 1752686Sksewell@umich.edu break; 1762686Sksewell@umich.edu 1772686Sksewell@umich.edu // write only registers 1782686Sksewell@umich.edu case IPR_HWINT_CLR: 1792686Sksewell@umich.edu case IPR_SL_XMIT: 1802686Sksewell@umich.edu case IPR_DC_FLUSH: 1812686Sksewell@umich.edu case IPR_IC_FLUSH: 1822686Sksewell@umich.edu case IPR_ALT_MODE: 1832686Sksewell@umich.edu case IPR_DTB_IA: 1842686Sksewell@umich.edu case IPR_DTB_IAP: 1852686Sksewell@umich.edu case IPR_ITB_IA: 1862686Sksewell@umich.edu case IPR_ITB_IAP: 1872686Sksewell@umich.edu panic("Tried to read write only register %d\n", idx); 1882686Sksewell@umich.edu break; 1892686Sksewell@umich.edu 1902686Sksewell@umich.edu default: 1912686Sksewell@umich.edu // invalid IPR 1922686Sksewell@umich.edu panic("Tried to read from invalid ipr %d\n", idx); 1932686Sksewell@umich.edu break; 1942686Sksewell@umich.edu } 1952686Sksewell@umich.edu 1965222Sksewell@umich.edu return retval; 1972686Sksewell@umich.edu} 1982686Sksewell@umich.edu 1992686Sksewell@umich.edu// Cause the simulator to break when changing to the following IPL 2002686Sksewell@umich.eduint break_ipl = -1; 2012686Sksewell@umich.edu 2022686Sksewell@umich.eduvoid 2032686Sksewell@umich.eduISA::setIpr(int idx, uint64_t val, ThreadContext *tc) 2042686Sksewell@umich.edu{ 2052686Sksewell@umich.edu uint64_t old; 2062686Sksewell@umich.edu 2072686Sksewell@umich.edu if (tc->misspeculating()) 2082686Sksewell@umich.edu return; 2092686Sksewell@umich.edu 2102686Sksewell@umich.edu switch (idx) { 2112686Sksewell@umich.edu case IPR_PALtemp0: 2122686Sksewell@umich.edu case IPR_PALtemp1: 2132686Sksewell@umich.edu case IPR_PALtemp2: 2142686Sksewell@umich.edu case IPR_PALtemp3: 2152686Sksewell@umich.edu case IPR_PALtemp4: 2162686Sksewell@umich.edu case IPR_PALtemp5: 2172686Sksewell@umich.edu case IPR_PALtemp6: 2185222Sksewell@umich.edu case IPR_PALtemp7: 2192686Sksewell@umich.edu case IPR_PALtemp8: 2202686Sksewell@umich.edu case IPR_PALtemp9: 2212686Sksewell@umich.edu case IPR_PALtemp10: 2222686Sksewell@umich.edu case IPR_PALtemp11: 2232686Sksewell@umich.edu case IPR_PALtemp12: 2242686Sksewell@umich.edu case IPR_PALtemp13: 2252686Sksewell@umich.edu case IPR_PALtemp14: 2262686Sksewell@umich.edu case IPR_PALtemp15: 2272686Sksewell@umich.edu case IPR_PALtemp16: 2282686Sksewell@umich.edu case IPR_PALtemp17: 2292686Sksewell@umich.edu case IPR_PALtemp18: 2302686Sksewell@umich.edu case IPR_PALtemp19: 2312686Sksewell@umich.edu case IPR_PALtemp20: 2322686Sksewell@umich.edu case IPR_PALtemp21: 2332686Sksewell@umich.edu case IPR_PALtemp22: 2342686Sksewell@umich.edu case IPR_PAL_BASE: 2352686Sksewell@umich.edu case IPR_IC_PERR_STAT: 2362686Sksewell@umich.edu case IPR_DC_PERR_STAT: 2372686Sksewell@umich.edu case IPR_PMCTR: 2384661Sksewell@umich.edu // write entire quad w/ no side-effect 2395222Sksewell@umich.edu ipr[idx] = val; 2405222Sksewell@umich.edu break; 2415222Sksewell@umich.edu 2425222Sksewell@umich.edu case IPR_CC_CTL: 2435222Sksewell@umich.edu // This IPR resets the cycle counter. We assume this only 2445222Sksewell@umich.edu // happens once... let's verify that. 2455222Sksewell@umich.edu assert(ipr[idx] == 0); 2465222Sksewell@umich.edu ipr[idx] = 1; 2475222Sksewell@umich.edu break; 2485222Sksewell@umich.edu 2495222Sksewell@umich.edu case IPR_CC: 2505222Sksewell@umich.edu // This IPR only writes the upper 64 bits. It's ok to write 2515222Sksewell@umich.edu // all 64 here since we mask out the lower 32 in rpcc (see 2525222Sksewell@umich.edu // isa_desc). 2535715Shsul@eecs.umich.edu ipr[idx] = val; 2545222Sksewell@umich.edu break; 2555222Sksewell@umich.edu 2566329Sgblack@eecs.umich.edu case IPR_PALtemp23: 2576329Sgblack@eecs.umich.edu // write entire quad w/ no side-effect 2586329Sgblack@eecs.umich.edu old = ipr[idx]; 2596329Sgblack@eecs.umich.edu ipr[idx] = val; 2606329Sgblack@eecs.umich.edu if (tc->getKernelStats()) 2616329Sgblack@eecs.umich.edu tc->getKernelStats()->context(old, val, tc); 2626329Sgblack@eecs.umich.edu break; 2636329Sgblack@eecs.umich.edu 2646329Sgblack@eecs.umich.edu case IPR_DTB_PTE: 2656329Sgblack@eecs.umich.edu // write entire quad w/ no side-effect, tag is forthcoming 2666329Sgblack@eecs.umich.edu ipr[idx] = val; 2677693SAli.Saidi@ARM.com break; 2687693SAli.Saidi@ARM.com 2697693SAli.Saidi@ARM.com case IPR_EXC_ADDR: 2707693SAli.Saidi@ARM.com // second least significant bit in PC is always zero 2717693SAli.Saidi@ARM.com ipr[idx] = val & ~2; 2727693SAli.Saidi@ARM.com break; 2737693SAli.Saidi@ARM.com 2747693SAli.Saidi@ARM.com case IPR_ASTRR: 2757693SAli.Saidi@ARM.com case IPR_ASTER: 2766329Sgblack@eecs.umich.edu // only write least significant four bits - privilege mask 2775222Sksewell@umich.edu ipr[idx] = val & 0xf; 278 break; 279 280 case IPR_IPLR: 281#ifdef DEBUG 282 if (break_ipl != -1 && break_ipl == (int)(val & 0x1f)) 283 Debug::breakpoint(); 284#endif 285 286 // only write least significant five bits - interrupt level 287 ipr[idx] = val & 0x1f; 288 if (tc->getKernelStats()) 289 tc->getKernelStats()->swpipl(ipr[idx]); 290 break; 291 292 case IPR_DTB_CM: 293 if (val & 0x18) { 294 if (tc->getKernelStats()) 295 tc->getKernelStats()->mode(Kernel::user, tc); 296 } else { 297 if (tc->getKernelStats()) 298 tc->getKernelStats()->mode(Kernel::kernel, tc); 299 } 300 301 case IPR_ICM: 302 // only write two mode bits - processor mode 303 ipr[idx] = val & 0x18; 304 break; 305 306 case IPR_ALT_MODE: 307 // only write two mode bits - processor mode 308 ipr[idx] = val & 0x18; 309 break; 310 311 case IPR_MCSR: 312 // more here after optimization... 313 ipr[idx] = val; 314 break; 315 316 case IPR_SIRR: 317 // only write software interrupt mask 318 ipr[idx] = val & 0x7fff0; 319 break; 320 321 case IPR_ICSR: 322 ipr[idx] = val & ULL(0xffffff0300); 323 break; 324 325 case IPR_IVPTBR: 326 case IPR_MVPTBR: 327 ipr[idx] = val & ULL(0xffffffffc0000000); 328 break; 329 330 case IPR_DC_TEST_CTL: 331 ipr[idx] = val & 0x1ffb; 332 break; 333 334 case IPR_DC_MODE: 335 case IPR_MAF_MODE: 336 ipr[idx] = val & 0x3f; 337 break; 338 339 case IPR_ITB_ASN: 340 ipr[idx] = val & 0x7f0; 341 break; 342 343 case IPR_DTB_ASN: 344 ipr[idx] = val & ULL(0xfe00000000000000); 345 break; 346 347 case IPR_EXC_SUM: 348 case IPR_EXC_MASK: 349 // any write to this register clears it 350 ipr[idx] = 0; 351 break; 352 353 case IPR_INTID: 354 case IPR_SL_RCV: 355 case IPR_MM_STAT: 356 case IPR_ITB_PTE_TEMP: 357 case IPR_DTB_PTE_TEMP: 358 // read-only registers 359 panic("Tried to write read only ipr %d\n", idx); 360 361 case IPR_HWINT_CLR: 362 case IPR_SL_XMIT: 363 case IPR_DC_FLUSH: 364 case IPR_IC_FLUSH: 365 // the following are write only 366 ipr[idx] = val; 367 break; 368 369 case IPR_DTB_IA: 370 // really a control write 371 ipr[idx] = 0; 372 373 tc->getDTBPtr()->flushAll(); 374 break; 375 376 case IPR_DTB_IAP: 377 // really a control write 378 ipr[idx] = 0; 379 380 tc->getDTBPtr()->flushProcesses(); 381 break; 382 383 case IPR_DTB_IS: 384 // really a control write 385 ipr[idx] = val; 386 387 tc->getDTBPtr()->flushAddr(val, DTB_ASN_ASN(ipr[IPR_DTB_ASN])); 388 break; 389 390 case IPR_DTB_TAG: { 391 struct TlbEntry entry; 392 393 // FIXME: granularity hints NYI... 394 if (DTB_PTE_GH(ipr[IPR_DTB_PTE]) != 0) 395 panic("PTE GH field != 0"); 396 397 // write entire quad 398 ipr[idx] = val; 399 400 // construct PTE for new entry 401 entry.ppn = DTB_PTE_PPN(ipr[IPR_DTB_PTE]); 402 entry.xre = DTB_PTE_XRE(ipr[IPR_DTB_PTE]); 403 entry.xwe = DTB_PTE_XWE(ipr[IPR_DTB_PTE]); 404 entry.fonr = DTB_PTE_FONR(ipr[IPR_DTB_PTE]); 405 entry.fonw = DTB_PTE_FONW(ipr[IPR_DTB_PTE]); 406 entry.asma = DTB_PTE_ASMA(ipr[IPR_DTB_PTE]); 407 entry.asn = DTB_ASN_ASN(ipr[IPR_DTB_ASN]); 408 409 // insert new TAG/PTE value into data TLB 410 tc->getDTBPtr()->insert(val, entry); 411 } 412 break; 413 414 case IPR_ITB_PTE: { 415 struct TlbEntry entry; 416 417 // FIXME: granularity hints NYI... 418 if (ITB_PTE_GH(val) != 0) 419 panic("PTE GH field != 0"); 420 421 // write entire quad 422 ipr[idx] = val; 423 424 // construct PTE for new entry 425 entry.ppn = ITB_PTE_PPN(val); 426 entry.xre = ITB_PTE_XRE(val); 427 entry.xwe = 0; 428 entry.fonr = ITB_PTE_FONR(val); 429 entry.fonw = ITB_PTE_FONW(val); 430 entry.asma = ITB_PTE_ASMA(val); 431 entry.asn = ITB_ASN_ASN(ipr[IPR_ITB_ASN]); 432 433 // insert new TAG/PTE value into data TLB 434 tc->getITBPtr()->insert(ipr[IPR_ITB_TAG], entry); 435 } 436 break; 437 438 case IPR_ITB_IA: 439 // really a control write 440 ipr[idx] = 0; 441 442 tc->getITBPtr()->flushAll(); 443 break; 444 445 case IPR_ITB_IAP: 446 // really a control write 447 ipr[idx] = 0; 448 449 tc->getITBPtr()->flushProcesses(); 450 break; 451 452 case IPR_ITB_IS: 453 // really a control write 454 ipr[idx] = val; 455 456 tc->getITBPtr()->flushAddr(val, ITB_ASN_ASN(ipr[IPR_ITB_ASN])); 457 break; 458 459 default: 460 // invalid IPR 461 panic("Tried to write to invalid ipr %d\n", idx); 462 } 463 464 // no error... 465} 466 467void 468copyIprs(ThreadContext *src, ThreadContext *dest) 469{ 470 for (int i = 0; i < NumInternalProcRegs; ++i) 471 dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i)); 472} 473 474} // namespace AlphaISA 475 476using namespace AlphaISA; 477 478Fault 479SimpleThread::hwrei() 480{ 481 PCState pc = pcState(); 482 if (!(pc.pc() & 0x3)) 483 return new UnimplementedOpcodeFault; 484 485 pc.npc(readMiscRegNoEffect(IPR_EXC_ADDR)); 486 pcState(pc); 487 488 CPA::cpa()->swAutoBegin(tc, pc.npc()); 489 490 if (!misspeculating()) { 491 if (kernelStats) 492 kernelStats->hwrei(); 493 } 494 495 // FIXME: XXX check for interrupts? XXX 496 return NoFault; 497} 498 499/** 500 * Check for special simulator handling of specific PAL calls. 501 * If return value is false, actual PAL call will be suppressed. 502 */ 503bool 504SimpleThread::simPalCheck(int palFunc) 505{ 506 if (kernelStats) 507 kernelStats->callpal(palFunc, tc); 508 509 switch (palFunc) { 510 case PAL::halt: 511 halt(); 512 if (--System::numSystemsRunning == 0) 513 exitSimLoop("all cpus halted"); 514 break; 515 516 case PAL::bpt: 517 case PAL::bugchk: 518 if (system->breakpoint()) 519 return false; 520 break; 521 } 522 523 return true; 524} 525