faults.cc (5570:13592d41f290) faults.cc (7678:f19b6a3a8cec)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

500 PC = (TBA & ~mask(15)) |
501 (TL > 1 ? (1 << 14) : 0) |
502 ((TT << 5) & mask(14));
503 NPC = PC + sizeof(MachInst);
504}
505
506#if FULL_SYSTEM
507
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

500 PC = (TBA & ~mask(15)) |
501 (TL > 1 ? (1 << 14) : 0) |
502 ((TT << 5) & mask(14));
503 NPC = PC + sizeof(MachInst);
504}
505
506#if FULL_SYSTEM
507
508void SparcFaultBase::invoke(ThreadContext * tc)
508void SparcFaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
509{
510 //panic("Invoking a second fault!\n");
511 FaultBase::invoke(tc);
512 countStat()++;
513
514 //We can refer to this to see what the trap level -was-, but something
515 //in the middle could change it in the regfile out from under us.
516 MiscReg tl = tc->readMiscRegNoEffect(MISCREG_TL);

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

554 getPrivVector(tc, PC, NPC, trapType(), tl+1);
555 }
556
557 tc->setPC(PC);
558 tc->setNextPC(NPC);
559 tc->setNextNPC(NPC + sizeof(MachInst));
560}
561
509{
510 //panic("Invoking a second fault!\n");
511 FaultBase::invoke(tc);
512 countStat()++;
513
514 //We can refer to this to see what the trap level -was-, but something
515 //in the middle could change it in the regfile out from under us.
516 MiscReg tl = tc->readMiscRegNoEffect(MISCREG_TL);

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

554 getPrivVector(tc, PC, NPC, trapType(), tl+1);
555 }
556
557 tc->setPC(PC);
558 tc->setNextPC(NPC);
559 tc->setNextNPC(NPC + sizeof(MachInst));
560}
561
562void PowerOnReset::invoke(ThreadContext * tc)
562void PowerOnReset::invoke(ThreadContext * tc, StaticInstPtr inst)
563{
564 //For SPARC, when a system is first started, there is a power
565 //on reset Trap which sets the processor into the following state.
566 //Bits that aren't set aren't defined on startup.
567
568 tc->setMiscRegNoEffect(MISCREG_TL, MaxTL);
569 tc->setMiscRegNoEffect(MISCREG_TT, trapType());
570 tc->setMiscReg(MISCREG_GL, MaxGL);

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

615 hintp = 0; // no interrupts pending
616 hstick_cmprFields.int_dis = 1; // disable timer compare interrupts
617 hstick_cmprFields.tick_cmpr = 0; // Reset to 0 for pretty printing
618 */
619}
620
621#else // !FULL_SYSTEM
622
563{
564 //For SPARC, when a system is first started, there is a power
565 //on reset Trap which sets the processor into the following state.
566 //Bits that aren't set aren't defined on startup.
567
568 tc->setMiscRegNoEffect(MISCREG_TL, MaxTL);
569 tc->setMiscRegNoEffect(MISCREG_TT, trapType());
570 tc->setMiscReg(MISCREG_GL, MaxGL);

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

615 hintp = 0; // no interrupts pending
616 hstick_cmprFields.int_dis = 1; // disable timer compare interrupts
617 hstick_cmprFields.tick_cmpr = 0; // Reset to 0 for pretty printing
618 */
619}
620
621#else // !FULL_SYSTEM
622
623void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc)
623void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
624 StaticInstPtr inst)
624{
625 Process *p = tc->getProcessPtr();
626 TlbEntry entry;
627 bool success = p->pTable->lookup(vaddr, entry);
628 if(!success) {
629 panic("Tried to execute unmapped address %#x.\n", vaddr);
630 } else {
631 Addr alignedVaddr = p->pTable->pageAlign(vaddr);
632 tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/,
633 p->M5_pid /*context id*/, false, entry.pte);
634 }
635}
636
625{
626 Process *p = tc->getProcessPtr();
627 TlbEntry entry;
628 bool success = p->pTable->lookup(vaddr, entry);
629 if(!success) {
630 panic("Tried to execute unmapped address %#x.\n", vaddr);
631 } else {
632 Addr alignedVaddr = p->pTable->pageAlign(vaddr);
633 tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/,
634 p->M5_pid /*context id*/, false, entry.pte);
635 }
636}
637
637void FastDataAccessMMUMiss::invoke(ThreadContext *tc)
638void FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
638{
639 Process *p = tc->getProcessPtr();
640 TlbEntry entry;
641 bool success = p->pTable->lookup(vaddr, entry);
642 if(!success) {
643 p->checkAndAllocNextPage(vaddr);
644 success = p->pTable->lookup(vaddr, entry);
645 }
646 if(!success) {
647 panic("Tried to access unmapped address %#x.\n", vaddr);
648 } else {
649 Addr alignedVaddr = p->pTable->pageAlign(vaddr);
650 tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
651 p->M5_pid /*context id*/, false, entry.pte);
652 }
653}
654
639{
640 Process *p = tc->getProcessPtr();
641 TlbEntry entry;
642 bool success = p->pTable->lookup(vaddr, entry);
643 if(!success) {
644 p->checkAndAllocNextPage(vaddr);
645 success = p->pTable->lookup(vaddr, entry);
646 }
647 if(!success) {
648 panic("Tried to access unmapped address %#x.\n", vaddr);
649 } else {
650 Addr alignedVaddr = p->pTable->pageAlign(vaddr);
651 tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
652 p->M5_pid /*context id*/, false, entry.pte);
653 }
654}
655
655void SpillNNormal::invoke(ThreadContext *tc)
656void SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
656{
657 doNormalFault(tc, trapType(), false);
658
659 Process *p = tc->getProcessPtr();
660
661 //XXX This will only work in faults from a SparcLiveProcess
662 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
663 assert(lp);
664
665 //Then adjust the PC and NPC
666 Addr spillStart = lp->readSpillStart();
667 tc->setPC(spillStart);
668 tc->setNextPC(spillStart + sizeof(MachInst));
669 tc->setNextNPC(spillStart + 2*sizeof(MachInst));
670}
671
657{
658 doNormalFault(tc, trapType(), false);
659
660 Process *p = tc->getProcessPtr();
661
662 //XXX This will only work in faults from a SparcLiveProcess
663 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
664 assert(lp);
665
666 //Then adjust the PC and NPC
667 Addr spillStart = lp->readSpillStart();
668 tc->setPC(spillStart);
669 tc->setNextPC(spillStart + sizeof(MachInst));
670 tc->setNextNPC(spillStart + 2*sizeof(MachInst));
671}
672
672void FillNNormal::invoke(ThreadContext *tc)
673void FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
673{
674 doNormalFault(tc, trapType(), false);
675
676 Process * p = tc->getProcessPtr();
677
678 //XXX This will only work in faults from a SparcLiveProcess
679 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
680 assert(lp);
681
682 //Then adjust the PC and NPC
683 Addr fillStart = lp->readFillStart();
684 tc->setPC(fillStart);
685 tc->setNextPC(fillStart + sizeof(MachInst));
686 tc->setNextNPC(fillStart + 2*sizeof(MachInst));
687}
688
674{
675 doNormalFault(tc, trapType(), false);
676
677 Process * p = tc->getProcessPtr();
678
679 //XXX This will only work in faults from a SparcLiveProcess
680 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
681 assert(lp);
682
683 //Then adjust the PC and NPC
684 Addr fillStart = lp->readFillStart();
685 tc->setPC(fillStart);
686 tc->setNextPC(fillStart + sizeof(MachInst));
687 tc->setNextNPC(fillStart + 2*sizeof(MachInst));
688}
689
689void TrapInstruction::invoke(ThreadContext *tc)
690void TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst)
690{
691 //In SE, this mechanism is how the process requests a service from the
692 //operating system. We'll get the process object from the thread context
693 //and let it service the request.
694
695 Process *p = tc->getProcessPtr();
696
697 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);

--- 15 unchanged lines hidden ---
691{
692 //In SE, this mechanism is how the process requests a service from the
693 //operating system. We'll get the process object from the thread context
694 //and let it service the request.
695
696 Process *p = tc->getProcessPtr();
697
698 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);

--- 15 unchanged lines hidden ---