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; --- 19 unchanged lines hidden (view full) --- 28 * Authors: Gabe Black 29 * Kevin Lim 30 */ 31 32#include <algorithm> 33 34#include "arch/sparc/faults.hh" 35#include "arch/sparc/isa_traits.hh" |
36#include "arch/sparc/process.hh" |
37#include "arch/sparc/types.hh" 38#include "base/bitfield.hh" 39#include "base/trace.hh" 40#include "sim/full_system.hh" 41#include "cpu/base.hh" 42#include "cpu/thread_context.hh" |
43#include "mem/page_table.hh" 44#include "sim/process.hh" 45#include "sim/full_system.hh" 46 47using namespace std; 48 49namespace SparcISA 50{ --- 608 unchanged lines hidden (view full) --- 659 p->M5_pid /*context id*/, false, entry.pte); 660 } 661 } 662} 663 664void 665SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 666{ |
667 if (FullSystem) { 668 SparcFaultBase::invoke(tc, inst); 669 } else { 670 doNormalFault(tc, trapType(), false); |
671 |
672 Process *p = tc->getProcessPtr(); |
673 |
674 //XXX This will only work in faults from a SparcLiveProcess 675 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 676 assert(lp); |
677 |
678 // Then adjust the PC and NPC 679 tc->pcState(lp->readSpillStart()); 680 } |
681} 682 683void 684FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst) 685{ |
686 if (FullSystem) { 687 SparcFaultBase::invoke(tc, inst); 688 } else { 689 doNormalFault(tc, trapType(), false); |
690 |
691 Process *p = tc->getProcessPtr(); |
692 |
693 //XXX This will only work in faults from a SparcLiveProcess 694 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 695 assert(lp); |
696 |
697 // Then adjust the PC and NPC 698 tc->pcState(lp->readFillStart()); 699 } |
700} 701 702void 703TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst) 704{ |
705 if (FullSystem) { 706 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 |
712 Process *p = tc->getProcessPtr(); |
713 |
714 SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p); 715 assert(lp); |
716 |
717 lp->handleTrap(_n, tc); |
718 |
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 } |
725} 726 727} // namespace SparcISA 728 |