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/mips/dyn_inst.hh"
34 MipsDynInst<Impl>::MipsDynInst(ExtMachInst inst, Addr PC, Addr Pred_PC,
35 InstSeqNum seq_num, O3CPU *cpu)
36 : BaseDynInst<Impl>(inst, PC, Pred_PC, seq_num, cpu)
42 MipsDynInst<Impl>::MipsDynInst(StaticInstPtr &_staticInst)
43 : BaseDynInst<Impl>(_staticInst)
50 MipsDynInst<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 MipsDynInst<Impl>::execute()
69 // @todo: Pretty convoluted way to avoid squashing from happening
70 // when using the TC 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 MipsDynInst<Impl>::initiateAcc()
87 // @todo: Pretty convoluted way to avoid squashing from happening
88 // when using the TC 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 MipsDynInst<Impl>::completeAcc(PacketPtr pkt)
105 this->fault = this->staticInst->completeAcc(pkt, this, this->traceData);
110 template <class Impl>
112 MipsDynInst<Impl>::syscall(int64_t callnum)
114 this->cpu->syscall(callnum, this->threadNumber);