faults.cc (8778:fbaf6af0be93) | faults.cc (8806:669e93d79ed9) |
---|---|
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; --- 610 unchanged lines hidden (view full) --- 619 */ 620} 621 622void 623FastInstructionAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst) 624{ 625 if (FullSystem) { 626 SparcFaultBase::invoke(tc, inst); | 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; --- 610 unchanged lines hidden (view full) --- 619 */ 620} 621 622void 623FastInstructionAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst) 624{ 625 if (FullSystem) { 626 SparcFaultBase::invoke(tc, inst); |
627 return; 628 } 629 630 Process *p = tc->getProcessPtr(); 631 TlbEntry entry; 632 bool success = p->pTable->lookup(vaddr, entry); 633 if (!success) { 634 panic("Tried to execute unmapped address %#x.\n", vaddr); |
|
627 } else { | 635 } else { |
628 Process *p = tc->getProcessPtr(); 629 TlbEntry entry; 630 bool success = p->pTable->lookup(vaddr, entry); 631 if (!success) { 632 panic("Tried to execute unmapped address %#x.\n", vaddr); 633 } else { 634 Addr alignedVaddr = p->pTable->pageAlign(vaddr); 635 tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/, 636 p->M5_pid /*context id*/, false, entry.pte); 637 } | 636 Addr alignedVaddr = p->pTable->pageAlign(vaddr); 637 tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/, 638 p->M5_pid /*context id*/, false, entry.pte); |
638 } 639} 640 641void 642FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst) 643{ 644 if (FullSystem) { 645 SparcFaultBase::invoke(tc, inst); | 639 } 640} 641 642void 643FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst) 644{ 645 if (FullSystem) { 646 SparcFaultBase::invoke(tc, inst); |
647 return; 648 } 649 650 Process *p = tc->getProcessPtr(); 651 TlbEntry entry; 652 bool success = p->pTable->lookup(vaddr, entry); 653 if (!success) { 654 if (p->fixupStackFault(vaddr)) 655 success = p->pTable->lookup(vaddr, entry); 656 } 657 if (!success) { 658 panic("Tried to access unmapped address %#x.\n", vaddr); |
|
646 } else { | 659 } else { |
647 Process *p = tc->getProcessPtr(); 648 TlbEntry entry; 649 bool success = p->pTable->lookup(vaddr, entry); 650 if (!success) { 651 if (p->fixupStackFault(vaddr)) 652 success = p->pTable->lookup(vaddr, entry); 653 } 654 if (!success) { 655 panic("Tried to access unmapped address %#x.\n", vaddr); 656 } else { 657 Addr alignedVaddr = p->pTable->pageAlign(vaddr); 658 tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/, 659 p->M5_pid /*context id*/, false, entry.pte); 660 } | 660 Addr alignedVaddr = p->pTable->pageAlign(vaddr); 661 tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/, 662 p->M5_pid /*context id*/, false, entry.pte); |
661 } 662} 663 664void 665SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 666{ 667 if (FullSystem) { 668 SparcFaultBase::invoke(tc, inst); | 663 } 664} 665 666void 667SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 668{ 669 if (FullSystem) { 670 SparcFaultBase::invoke(tc, inst); |
669 } else { 670 doNormalFault(tc, trapType(), false); | 671 return; 672 } |
671 | 673 |
672 Process *p = tc->getProcessPtr(); | 674 doNormalFault(tc, trapType(), false); |
673 | 675 |
674 //XXX This will only work in faults from a SparcLiveProcess 675 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 676 assert(lp); | 676 Process *p = tc->getProcessPtr(); |
677 | 677 |
678 // Then adjust the PC and NPC 679 tc->pcState(lp->readSpillStart()); 680 } | 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 tc->pcState(lp->readSpillStart()); |
681} 682 683void 684FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 685{ 686 if (FullSystem) { 687 SparcFaultBase::invoke(tc, inst); | 684} 685 686void 687FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 688{ 689 if (FullSystem) { 690 SparcFaultBase::invoke(tc, inst); |
688 } else { 689 doNormalFault(tc, trapType(), false); | 691 return; 692 } |
690 | 693 |
691 Process *p = tc->getProcessPtr(); | 694 doNormalFault(tc, trapType(), false); |
692 | 695 |
693 //XXX This will only work in faults from a SparcLiveProcess 694 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 695 assert(lp); | 696 Process *p = tc->getProcessPtr(); |
696 | 697 |
697 // Then adjust the PC and NPC 698 tc->pcState(lp->readFillStart()); 699 } | 698 //XXX This will only work in faults from a SparcLiveProcess 699 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 700 assert(lp); 701 702 // Then adjust the PC and NPC 703 tc->pcState(lp->readFillStart()); |
700} 701 702void 703TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst) 704{ 705 if (FullSystem) { 706 SparcFaultBase::invoke(tc, inst); | 704} 705 706void 707TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst) 708{ 709 if (FullSystem) { 710 SparcFaultBase::invoke(tc, inst); |
707 } else { 708 // In SE, this mechanism is how the process requests a service from 709 // the operating system. We'll get the process object from the thread 710 // context and let it service the request. | 711 return; 712 } |
711 | 713 |
712 Process *p = tc->getProcessPtr(); | 714 // In SE, this mechanism is how the process requests a service from 715 // the operating system. We'll get the process object from the thread 716 // context and let it service the request. |
713 | 717 |
714 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 715 assert(lp); | 718 Process *p = tc->getProcessPtr(); |
716 | 719 |
717 lp->handleTrap(_n, tc); | 720 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 721 assert(lp); |
718 | 722 |
719 // We need to explicitly advance the pc, since that's not done for us 720 // on a faulting instruction 721 PCState pc = tc->pcState(); 722 pc.advance(); 723 tc->pcState(pc); 724 } | 723 lp->handleTrap(_n, tc); 724 725 // We need to explicitly advance the pc, since that's not done for us 726 // on a faulting instruction 727 PCState pc = tc->pcState(); 728 pc.advance(); 729 tc->pcState(pc); |
725} 726 727} // namespace SparcISA 728 | 730} 731 732} // namespace SparcISA 733 |