ev5.cc revision 5702:bf84e2fa05f7
112852Sgabeblack@google.com/* 212852Sgabeblack@google.com * Copyright (c) 2002-2005 The Regents of The University of Michigan 312852Sgabeblack@google.com * All rights reserved. 412852Sgabeblack@google.com * 512852Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612852Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712852Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912852Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112852Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212852Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312852Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412852Sgabeblack@google.com * this software without specific prior written permission. 1512852Sgabeblack@google.com * 1612852Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712852Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812852Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912852Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012852Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112852Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212852Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312852Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412852Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512852Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612852Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712852Sgabeblack@google.com * 2812852Sgabeblack@google.com * Authors: Steve Reinhardt 2912852Sgabeblack@google.com * Nathan Binkert 3012852Sgabeblack@google.com */ 3112852Sgabeblack@google.com 3212852Sgabeblack@google.com#include "arch/alpha/faults.hh" 3312852Sgabeblack@google.com#include "arch/alpha/isa_traits.hh" 3412852Sgabeblack@google.com#include "arch/alpha/kernel_stats.hh" 3512852Sgabeblack@google.com#include "arch/alpha/osfpal.hh" 3612852Sgabeblack@google.com#include "arch/alpha/tlb.hh" 3712852Sgabeblack@google.com#include "arch/alpha/kgdb.h" 3812852Sgabeblack@google.com#include "base/remote_gdb.hh" 3912852Sgabeblack@google.com#include "base/stats/events.hh" 4012852Sgabeblack@google.com#include "config/full_system.hh" 4112852Sgabeblack@google.com#include "cpu/base.hh" 4212852Sgabeblack@google.com#include "cpu/simple_thread.hh" 4312852Sgabeblack@google.com#include "cpu/thread_context.hh" 4412852Sgabeblack@google.com#include "sim/debug.hh" 4512852Sgabeblack@google.com#include "sim/sim_exit.hh" 4612852Sgabeblack@google.com 4712852Sgabeblack@google.comnamespace AlphaISA { 4812852Sgabeblack@google.com 4912852Sgabeblack@google.com#if FULL_SYSTEM 5012852Sgabeblack@google.com 5112852Sgabeblack@google.com//////////////////////////////////////////////////////////////////////// 5212852Sgabeblack@google.com// 5312852Sgabeblack@google.com// Machine dependent functions 5412852Sgabeblack@google.com// 5512852Sgabeblack@google.comvoid 5612852Sgabeblack@google.cominitCPU(ThreadContext *tc, int cpuId) 5712852Sgabeblack@google.com{ 5812852Sgabeblack@google.com initIPRs(tc, cpuId); 5912852Sgabeblack@google.com 6012852Sgabeblack@google.com tc->setIntReg(16, cpuId); 6112905Sgabeblack@google.com tc->setIntReg(0, cpuId); 6212905Sgabeblack@google.com 6312905Sgabeblack@google.com AlphaFault *reset = new ResetFault; 6412852Sgabeblack@google.com 6512852Sgabeblack@google.com tc->setPC(tc->readMiscRegNoEffect(IPR_PAL_BASE) + reset->vect()); 6613245Sgabeblack@google.com tc->setNextPC(tc->readPC() + sizeof(MachInst)); 6713245Sgabeblack@google.com 6813245Sgabeblack@google.com delete reset; 6912852Sgabeblack@google.com} 7013245Sgabeblack@google.com 7113245Sgabeblack@google.com 7212852Sgabeblack@google.comtemplate <class CPU> 7312852Sgabeblack@google.comvoid 7412852Sgabeblack@google.comprocessInterrupts(CPU *cpu) 7512852Sgabeblack@google.com{ 7612852Sgabeblack@google.com //Check if there are any outstanding interrupts 7712852Sgabeblack@google.com //Handle the interrupts 7812852Sgabeblack@google.com int ipl = 0; 7912852Sgabeblack@google.com int summary = 0; 8012852Sgabeblack@google.com 8112852Sgabeblack@google.com if (cpu->readMiscRegNoEffect(IPR_ASTRR)) 8212852Sgabeblack@google.com panic("asynchronous traps not implemented\n"); 8312852Sgabeblack@google.com 8412852Sgabeblack@google.com if (cpu->readMiscRegNoEffect(IPR_SIRR)) { 8512852Sgabeblack@google.com for (int i = INTLEVEL_SOFTWARE_MIN; 8612852Sgabeblack@google.com i < INTLEVEL_SOFTWARE_MAX; i++) { 8712852Sgabeblack@google.com if (cpu->readMiscRegNoEffect(IPR_SIRR) & (ULL(1) << i)) { 8812852Sgabeblack@google.com // See table 4-19 of the 21164 hardware reference 8912852Sgabeblack@google.com ipl = (i - INTLEVEL_SOFTWARE_MIN) + 1; 9012852Sgabeblack@google.com summary |= (ULL(1) << i); 9112852Sgabeblack@google.com } 9212852Sgabeblack@google.com } 9312852Sgabeblack@google.com } 9412852Sgabeblack@google.com 9512852Sgabeblack@google.com uint64_t interrupts = cpu->intr_status(); 9612852Sgabeblack@google.com 9712852Sgabeblack@google.com if (interrupts) { 9812852Sgabeblack@google.com for (int i = INTLEVEL_EXTERNAL_MIN; 9912852Sgabeblack@google.com i < INTLEVEL_EXTERNAL_MAX; i++) { 10012852Sgabeblack@google.com if (interrupts & (ULL(1) << i)) { 10112852Sgabeblack@google.com // See table 4-19 of the 21164 hardware reference 10212852Sgabeblack@google.com ipl = i; 10312852Sgabeblack@google.com summary |= (ULL(1) << i); 10412852Sgabeblack@google.com } 10512852Sgabeblack@google.com } 10612852Sgabeblack@google.com } 10712852Sgabeblack@google.com 10812852Sgabeblack@google.com if (ipl && ipl > cpu->readMiscRegNoEffect(IPR_IPLR)) { 10912852Sgabeblack@google.com cpu->setMiscRegNoEffect(IPR_ISR, summary); 11012852Sgabeblack@google.com cpu->setMiscRegNoEffect(IPR_INTID, ipl); 11112852Sgabeblack@google.com cpu->trap(new InterruptFault); 11212852Sgabeblack@google.com DPRINTF(Flow, "Interrupt! IPLR=%d ipl=%d summary=%x\n", 11312852Sgabeblack@google.com cpu->readMiscRegNoEffect(IPR_IPLR), ipl, summary); 11412852Sgabeblack@google.com } 11512852Sgabeblack@google.com 11612852Sgabeblack@google.com} 11712852Sgabeblack@google.com 11812877Sgabeblack@google.comtemplate <class CPU> 11912905Sgabeblack@google.comvoid 12012905Sgabeblack@google.comzeroRegisters(CPU *cpu) 12112905Sgabeblack@google.com{ 12212905Sgabeblack@google.com // Insure ISA semantics 12312905Sgabeblack@google.com // (no longer very clean due to the change in setIntReg() in the 12412905Sgabeblack@google.com // cpu model. Consider changing later.) 12512905Sgabeblack@google.com cpu->thread->setIntReg(ZeroReg, 0); 12612905Sgabeblack@google.com cpu->thread->setFloatReg(ZeroReg, 0.0); 12712877Sgabeblack@google.com} 12812877Sgabeblack@google.com 12912877Sgabeblack@google.comint 13013241Sgabeblack@google.comMiscRegFile::getInstAsid() 13112877Sgabeblack@google.com{ 13213241Sgabeblack@google.com return ITB_ASN_ASN(ipr[IPR_ITB_ASN]); 13312877Sgabeblack@google.com} 13413241Sgabeblack@google.com 13512877Sgabeblack@google.comint 13613241Sgabeblack@google.comMiscRegFile::getDataAsid() 13712877Sgabeblack@google.com{ 13813241Sgabeblack@google.com return DTB_ASN_ASN(ipr[IPR_DTB_ASN]); 13912877Sgabeblack@google.com} 14013241Sgabeblack@google.com 14112877Sgabeblack@google.com#endif 14213241Sgabeblack@google.com 14312877Sgabeblack@google.com//////////////////////////////////////////////////////////////////////// 14413241Sgabeblack@google.com// 14512877Sgabeblack@google.com// 14612852Sgabeblack@google.com// 14712852Sgabeblack@google.comvoid 14812852Sgabeblack@google.cominitIPRs(ThreadContext *tc, int cpuId) 14912852Sgabeblack@google.com{ 15012852Sgabeblack@google.com for (int i = 0; i < NumInternalProcRegs; ++i) { 15113241Sgabeblack@google.com tc->setMiscRegNoEffect(i, 0); 15212852Sgabeblack@google.com } 15313241Sgabeblack@google.com 15412852Sgabeblack@google.com tc->setMiscRegNoEffect(IPR_PAL_BASE, PalBase); 15513241Sgabeblack@google.com tc->setMiscRegNoEffect(IPR_MCSR, 0x6); 15612852Sgabeblack@google.com tc->setMiscRegNoEffect(IPR_PALtemp16, cpuId); 15713241Sgabeblack@google.com} 15812852Sgabeblack@google.com 15913241Sgabeblack@google.comMiscReg 16012852Sgabeblack@google.comMiscRegFile::readIpr(int idx, ThreadContext *tc) 16113241Sgabeblack@google.com{ 16212852Sgabeblack@google.com uint64_t retval = 0; // return value, default 0 16313241Sgabeblack@google.com 16412852Sgabeblack@google.com switch (idx) { 16513241Sgabeblack@google.com case IPR_PALtemp0: 16612852Sgabeblack@google.com case IPR_PALtemp1: 16713241Sgabeblack@google.com case IPR_PALtemp2: 16812852Sgabeblack@google.com case IPR_PALtemp3: 16913241Sgabeblack@google.com case IPR_PALtemp4: 17012852Sgabeblack@google.com case IPR_PALtemp5: 17112877Sgabeblack@google.com case IPR_PALtemp6: 17212877Sgabeblack@google.com case IPR_PALtemp7: 17312877Sgabeblack@google.com case IPR_PALtemp8: 17412877Sgabeblack@google.com case IPR_PALtemp9: 17512913Sgabeblack@google.com case IPR_PALtemp10: 17612913Sgabeblack@google.com case IPR_PALtemp11: 17712913Sgabeblack@google.com case IPR_PALtemp12: 17812852Sgabeblack@google.com case IPR_PALtemp13: 17912852Sgabeblack@google.com case IPR_PALtemp14: 18013241Sgabeblack@google.com case IPR_PALtemp15: 18113241Sgabeblack@google.com case IPR_PALtemp16: 18212852Sgabeblack@google.com case IPR_PALtemp17: 18313241Sgabeblack@google.com case IPR_PALtemp18: 18412852Sgabeblack@google.com case IPR_PALtemp19: 18512852Sgabeblack@google.com case IPR_PALtemp20: 18612852Sgabeblack@google.com case IPR_PALtemp21: 18712852Sgabeblack@google.com case IPR_PALtemp22: 18812852Sgabeblack@google.com case IPR_PALtemp23: 18912852Sgabeblack@google.com case IPR_PAL_BASE: 19012852Sgabeblack@google.com 19112852Sgabeblack@google.com case IPR_IVPTBR: 19212852Sgabeblack@google.com case IPR_DC_MODE: 19312852Sgabeblack@google.com case IPR_MAF_MODE: 19412852Sgabeblack@google.com case IPR_ISR: 19512852Sgabeblack@google.com case IPR_EXC_ADDR: 19612852Sgabeblack@google.com case IPR_IC_PERR_STAT: 19712852Sgabeblack@google.com case IPR_DC_PERR_STAT: 19812852Sgabeblack@google.com case IPR_MCSR: 19912852Sgabeblack@google.com case IPR_ASTRR: 20012852Sgabeblack@google.com case IPR_ASTER: 201 case IPR_SIRR: 202 case IPR_ICSR: 203 case IPR_ICM: 204 case IPR_DTB_CM: 205 case IPR_IPLR: 206 case IPR_INTID: 207 case IPR_PMCTR: 208 // no side-effect 209 retval = ipr[idx]; 210 break; 211 212 case IPR_CC: 213 retval |= ipr[idx] & ULL(0xffffffff00000000); 214 retval |= tc->getCpuPtr()->curCycle() & ULL(0x00000000ffffffff); 215 break; 216 217 case IPR_VA: 218 retval = ipr[idx]; 219 break; 220 221 case IPR_VA_FORM: 222 case IPR_MM_STAT: 223 case IPR_IFAULT_VA_FORM: 224 case IPR_EXC_MASK: 225 case IPR_EXC_SUM: 226 retval = ipr[idx]; 227 break; 228 229 case IPR_DTB_PTE: 230 { 231 TlbEntry &entry 232 = tc->getDTBPtr()->index(!tc->misspeculating()); 233 234 retval |= ((uint64_t)entry.ppn & ULL(0x7ffffff)) << 32; 235 retval |= ((uint64_t)entry.xre & ULL(0xf)) << 8; 236 retval |= ((uint64_t)entry.xwe & ULL(0xf)) << 12; 237 retval |= ((uint64_t)entry.fonr & ULL(0x1)) << 1; 238 retval |= ((uint64_t)entry.fonw & ULL(0x1))<< 2; 239 retval |= ((uint64_t)entry.asma & ULL(0x1)) << 4; 240 retval |= ((uint64_t)entry.asn & ULL(0x7f)) << 57; 241 } 242 break; 243 244 // write only registers 245 case IPR_HWINT_CLR: 246 case IPR_SL_XMIT: 247 case IPR_DC_FLUSH: 248 case IPR_IC_FLUSH: 249 case IPR_ALT_MODE: 250 case IPR_DTB_IA: 251 case IPR_DTB_IAP: 252 case IPR_ITB_IA: 253 case IPR_ITB_IAP: 254 panic("Tried to read write only register %d\n", idx); 255 break; 256 257 default: 258 // invalid IPR 259 panic("Tried to read from invalid ipr %d\n", idx); 260 break; 261 } 262 263 return retval; 264} 265 266#ifdef DEBUG 267// Cause the simulator to break when changing to the following IPL 268int break_ipl = -1; 269#endif 270 271void 272MiscRegFile::setIpr(int idx, uint64_t val, ThreadContext *tc) 273{ 274 uint64_t old; 275 276 if (tc->misspeculating()) 277 return; 278 279 switch (idx) { 280 case IPR_PALtemp0: 281 case IPR_PALtemp1: 282 case IPR_PALtemp2: 283 case IPR_PALtemp3: 284 case IPR_PALtemp4: 285 case IPR_PALtemp5: 286 case IPR_PALtemp6: 287 case IPR_PALtemp7: 288 case IPR_PALtemp8: 289 case IPR_PALtemp9: 290 case IPR_PALtemp10: 291 case IPR_PALtemp11: 292 case IPR_PALtemp12: 293 case IPR_PALtemp13: 294 case IPR_PALtemp14: 295 case IPR_PALtemp15: 296 case IPR_PALtemp16: 297 case IPR_PALtemp17: 298 case IPR_PALtemp18: 299 case IPR_PALtemp19: 300 case IPR_PALtemp20: 301 case IPR_PALtemp21: 302 case IPR_PALtemp22: 303 case IPR_PAL_BASE: 304 case IPR_IC_PERR_STAT: 305 case IPR_DC_PERR_STAT: 306 case IPR_PMCTR: 307 // write entire quad w/ no side-effect 308 ipr[idx] = val; 309 break; 310 311 case IPR_CC_CTL: 312 // This IPR resets the cycle counter. We assume this only 313 // happens once... let's verify that. 314 assert(ipr[idx] == 0); 315 ipr[idx] = 1; 316 break; 317 318 case IPR_CC: 319 // This IPR only writes the upper 64 bits. It's ok to write 320 // all 64 here since we mask out the lower 32 in rpcc (see 321 // isa_desc). 322 ipr[idx] = val; 323 break; 324 325 case IPR_PALtemp23: 326 // write entire quad w/ no side-effect 327 old = ipr[idx]; 328 ipr[idx] = val; 329#if FULL_SYSTEM 330 if (tc->getKernelStats()) 331 tc->getKernelStats()->context(old, val, tc); 332#endif 333 break; 334 335 case IPR_DTB_PTE: 336 // write entire quad w/ no side-effect, tag is forthcoming 337 ipr[idx] = val; 338 break; 339 340 case IPR_EXC_ADDR: 341 // second least significant bit in PC is always zero 342 ipr[idx] = val & ~2; 343 break; 344 345 case IPR_ASTRR: 346 case IPR_ASTER: 347 // only write least significant four bits - privilege mask 348 ipr[idx] = val & 0xf; 349 break; 350 351 case IPR_IPLR: 352#ifdef DEBUG 353 if (break_ipl != -1 && break_ipl == (val & 0x1f)) 354 debug_break(); 355#endif 356 357 // only write least significant five bits - interrupt level 358 ipr[idx] = val & 0x1f; 359#if FULL_SYSTEM 360 if (tc->getKernelStats()) 361 tc->getKernelStats()->swpipl(ipr[idx]); 362#endif 363 break; 364 365 case IPR_DTB_CM: 366#if FULL_SYSTEM 367 if (val & 0x18) { 368 if (tc->getKernelStats()) 369 tc->getKernelStats()->mode(Kernel::user, tc); 370 } else { 371 if (tc->getKernelStats()) 372 tc->getKernelStats()->mode(Kernel::kernel, tc); 373 } 374#endif 375 376 case IPR_ICM: 377 // only write two mode bits - processor mode 378 ipr[idx] = val & 0x18; 379 break; 380 381 case IPR_ALT_MODE: 382 // only write two mode bits - processor mode 383 ipr[idx] = val & 0x18; 384 break; 385 386 case IPR_MCSR: 387 // more here after optimization... 388 ipr[idx] = val; 389 break; 390 391 case IPR_SIRR: 392 // only write software interrupt mask 393 ipr[idx] = val & 0x7fff0; 394 break; 395 396 case IPR_ICSR: 397 ipr[idx] = val & ULL(0xffffff0300); 398 break; 399 400 case IPR_IVPTBR: 401 case IPR_MVPTBR: 402 ipr[idx] = val & ULL(0xffffffffc0000000); 403 break; 404 405 case IPR_DC_TEST_CTL: 406 ipr[idx] = val & 0x1ffb; 407 break; 408 409 case IPR_DC_MODE: 410 case IPR_MAF_MODE: 411 ipr[idx] = val & 0x3f; 412 break; 413 414 case IPR_ITB_ASN: 415 ipr[idx] = val & 0x7f0; 416 break; 417 418 case IPR_DTB_ASN: 419 ipr[idx] = val & ULL(0xfe00000000000000); 420 break; 421 422 case IPR_EXC_SUM: 423 case IPR_EXC_MASK: 424 // any write to this register clears it 425 ipr[idx] = 0; 426 break; 427 428 case IPR_INTID: 429 case IPR_SL_RCV: 430 case IPR_MM_STAT: 431 case IPR_ITB_PTE_TEMP: 432 case IPR_DTB_PTE_TEMP: 433 // read-only registers 434 panic("Tried to write read only ipr %d\n", idx); 435 436 case IPR_HWINT_CLR: 437 case IPR_SL_XMIT: 438 case IPR_DC_FLUSH: 439 case IPR_IC_FLUSH: 440 // the following are write only 441 ipr[idx] = val; 442 break; 443 444 case IPR_DTB_IA: 445 // really a control write 446 ipr[idx] = 0; 447 448 tc->getDTBPtr()->flushAll(); 449 break; 450 451 case IPR_DTB_IAP: 452 // really a control write 453 ipr[idx] = 0; 454 455 tc->getDTBPtr()->flushProcesses(); 456 break; 457 458 case IPR_DTB_IS: 459 // really a control write 460 ipr[idx] = val; 461 462 tc->getDTBPtr()->flushAddr(val, DTB_ASN_ASN(ipr[IPR_DTB_ASN])); 463 break; 464 465 case IPR_DTB_TAG: { 466 struct TlbEntry entry; 467 468 // FIXME: granularity hints NYI... 469 if (DTB_PTE_GH(ipr[IPR_DTB_PTE]) != 0) 470 panic("PTE GH field != 0"); 471 472 // write entire quad 473 ipr[idx] = val; 474 475 // construct PTE for new entry 476 entry.ppn = DTB_PTE_PPN(ipr[IPR_DTB_PTE]); 477 entry.xre = DTB_PTE_XRE(ipr[IPR_DTB_PTE]); 478 entry.xwe = DTB_PTE_XWE(ipr[IPR_DTB_PTE]); 479 entry.fonr = DTB_PTE_FONR(ipr[IPR_DTB_PTE]); 480 entry.fonw = DTB_PTE_FONW(ipr[IPR_DTB_PTE]); 481 entry.asma = DTB_PTE_ASMA(ipr[IPR_DTB_PTE]); 482 entry.asn = DTB_ASN_ASN(ipr[IPR_DTB_ASN]); 483 484 // insert new TAG/PTE value into data TLB 485 tc->getDTBPtr()->insert(val, entry); 486 } 487 break; 488 489 case IPR_ITB_PTE: { 490 struct TlbEntry entry; 491 492 // FIXME: granularity hints NYI... 493 if (ITB_PTE_GH(val) != 0) 494 panic("PTE GH field != 0"); 495 496 // write entire quad 497 ipr[idx] = val; 498 499 // construct PTE for new entry 500 entry.ppn = ITB_PTE_PPN(val); 501 entry.xre = ITB_PTE_XRE(val); 502 entry.xwe = 0; 503 entry.fonr = ITB_PTE_FONR(val); 504 entry.fonw = ITB_PTE_FONW(val); 505 entry.asma = ITB_PTE_ASMA(val); 506 entry.asn = ITB_ASN_ASN(ipr[IPR_ITB_ASN]); 507 508 // insert new TAG/PTE value into data TLB 509 tc->getITBPtr()->insert(ipr[IPR_ITB_TAG], entry); 510 } 511 break; 512 513 case IPR_ITB_IA: 514 // really a control write 515 ipr[idx] = 0; 516 517 tc->getITBPtr()->flushAll(); 518 break; 519 520 case IPR_ITB_IAP: 521 // really a control write 522 ipr[idx] = 0; 523 524 tc->getITBPtr()->flushProcesses(); 525 break; 526 527 case IPR_ITB_IS: 528 // really a control write 529 ipr[idx] = val; 530 531 tc->getITBPtr()->flushAddr(val, ITB_ASN_ASN(ipr[IPR_ITB_ASN])); 532 break; 533 534 default: 535 // invalid IPR 536 panic("Tried to write to invalid ipr %d\n", idx); 537 } 538 539 // no error... 540} 541 542void 543copyIprs(ThreadContext *src, ThreadContext *dest) 544{ 545 for (int i = 0; i < NumInternalProcRegs; ++i) 546 dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i)); 547} 548 549} // namespace AlphaISA 550 551#if FULL_SYSTEM 552 553using namespace AlphaISA; 554 555Fault 556SimpleThread::hwrei() 557{ 558 if (!(readPC() & 0x3)) 559 return new UnimplementedOpcodeFault; 560 561 setNextPC(readMiscRegNoEffect(IPR_EXC_ADDR)); 562 563 if (!misspeculating()) { 564 if (kernelStats) 565 kernelStats->hwrei(); 566 } 567 568 // FIXME: XXX check for interrupts? XXX 569 return NoFault; 570} 571 572/** 573 * Check for special simulator handling of specific PAL calls. 574 * If return value is false, actual PAL call will be suppressed. 575 */ 576bool 577SimpleThread::simPalCheck(int palFunc) 578{ 579 if (kernelStats) 580 kernelStats->callpal(palFunc, tc); 581 582 switch (palFunc) { 583 case PAL::halt: 584 halt(); 585 if (--System::numSystemsRunning == 0) 586 exitSimLoop("all cpus halted"); 587 break; 588 589 case PAL::bpt: 590 case PAL::bugchk: 591 if (system->breakpoint()) 592 return false; 593 break; 594 } 595 596 return true; 597} 598 599#endif // FULL_SYSTEM 600