2 * Copyright (c) 2004-2006 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "cpu/o3/alpha_dyn_inst.hh"
34 AlphaDynInst<Impl>::AlphaDynInst(ExtMachInst inst, Addr PC, Addr Pred_PC,
35 InstSeqNum seq_num, FullCPU *cpu)
36 : BaseDynInst<Impl>(inst, PC, Pred_PC, seq_num, cpu)
42 AlphaDynInst<Impl>::AlphaDynInst(StaticInstPtr &_staticInst)
43 : BaseDynInst<Impl>(_staticInst)
50 AlphaDynInst<Impl>::initVars()
52 // Make sure to have the renamed register entries set to the same
53 // as the normal register entries. It will allow the IQ to work
54 // without any modifications.
55 for (int i = 0; i < this->staticInst->numDestRegs(); i++) {
56 _destRegIdx[i] = this->staticInst->destRegIdx(i);
59 for (int i = 0; i < this->staticInst->numSrcRegs(); i++) {
60 _srcRegIdx[i] = this->staticInst->srcRegIdx(i);
61 this->_readySrcRegIdx[i] = 0;
67 AlphaDynInst<Impl>::execute()
69 // @todo: Pretty convoluted way to avoid squashing from happening
70 // when using the XC during an instruction's execution
71 // (specifically for instructions that have side-effects that use
73 bool in_syscall = this->thread->inSyscall;
74 this->thread->inSyscall = true;
76 this->fault = this->staticInst->execute(this, this->traceData);
78 this->thread->inSyscall = in_syscall;
85 AlphaDynInst<Impl>::initiateAcc()
87 // @todo: Pretty convoluted way to avoid squashing from happening
88 // when using the XC during an instruction's execution
89 // (specifically for instructions that have side-effects that use
91 bool in_syscall = this->thread->inSyscall;
92 this->thread->inSyscall = true;
94 this->fault = this->staticInst->initiateAcc(this, this->traceData);
96 this->thread->inSyscall = in_syscall;
101 template <class Impl>
103 AlphaDynInst<Impl>::completeAcc(Packet *pkt)
105 if (this->isLoad()) {
106 this->fault = this->staticInst->completeAcc(pkt, this,
108 } else if (this->isStore()) {
109 this->fault = this->staticInst->completeAcc(pkt, this,
112 panic("Unknown type!");
119 template <class Impl>
121 AlphaDynInst<Impl>::hwrei()
123 // Can only do a hwrei when in pal mode.
124 if (!this->cpu->inPalMode(this->readPC()))
125 return new AlphaISA::UnimplementedOpcodeFault;
127 // Set the next PC based on the value of the EXC_ADDR IPR.
128 this->setNextPC(this->cpu->readMiscReg(AlphaISA::IPR_EXC_ADDR,
129 this->threadNumber));
131 // Tell CPU to clear any state it needs to if a hwrei is taken.
132 this->cpu->hwrei(this->threadNumber);
134 // FIXME: XXX check for interrupts? XXX
138 template <class Impl>
140 AlphaDynInst<Impl>::readIntrFlag()
142 return this->cpu->readIntrFlag();
145 template <class Impl>
147 AlphaDynInst<Impl>::setIntrFlag(int val)
149 this->cpu->setIntrFlag(val);
152 template <class Impl>
154 AlphaDynInst<Impl>::inPalMode()
156 return this->cpu->inPalMode(this->PC);
159 template <class Impl>
161 AlphaDynInst<Impl>::trap(Fault fault)
163 this->cpu->trap(fault, this->threadNumber);
166 template <class Impl>
168 AlphaDynInst<Impl>::simPalCheck(int palFunc)
170 return this->cpu->simPalCheck(palFunc, this->threadNumber);
173 template <class Impl>
175 AlphaDynInst<Impl>::syscall(int64_t callnum)
177 this->cpu->syscall(callnum, this->threadNumber);