2 * Copyright (c) 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.
32 #ifndef __CPU_O3_MIPS_CPU_HH__
33 #define __CPU_O3_MIPS_CPU_HH__
35 #include "arch/mips/regfile.hh"
36 #include "arch/mips/syscallreturn.hh"
37 #include "cpu/thread_context.hh"
38 #include "cpu/o3/cpu.hh"
39 #include "sim/byteswap.hh"
40 #include "sim/faults.hh"
42 class EndQuiesceEvent;
47 class TranslatingPort;
50 * MipsO3CPU class. Derives from the FullO3CPU class, and
51 * implements all ISA and implementation specific functions of the
52 * CPU. This is the CPU class that is used for the SimObjects, and is
53 * what is given to the DynInsts. Most of its state exists in the
54 * FullO3CPU; the state is has is mainly for ISA specific
58 class MipsO3CPU : public FullO3CPU<Impl>
61 typedef O3ThreadState<Impl> ImplState;
62 typedef O3ThreadState<Impl> Thread;
63 typedef typename Impl::Params Params;
65 /** Constructs an MipsO3CPU with the given parameters. */
66 MipsO3CPU(Params *params);
68 /** Registers statistics. */
71 /** Translates instruction requestion in syscall emulation mode. */
72 Fault translateInstReq(RequestPtr &req, Thread *thread)
74 return thread->getProcessPtr()->pTable->translate(req);
77 /** Translates data read request in syscall emulation mode. */
78 Fault translateDataReadReq(RequestPtr &req, Thread *thread)
80 return thread->getProcessPtr()->pTable->translate(req);
83 /** Translates data write request in syscall emulation mode. */
84 Fault translateDataWriteReq(RequestPtr &req, Thread *thread)
86 return thread->getProcessPtr()->pTable->translate(req);
89 /** Reads a miscellaneous register. */
90 TheISA::MiscReg readMiscReg(int misc_reg, unsigned tid);
92 /** Reads a misc. register, including any side effects the read
93 * might have as defined by the architecture.
95 TheISA::MiscReg readMiscRegWithEffect(int misc_reg, unsigned tid);
97 /** Sets a miscellaneous register. */
98 void setMiscReg(int misc_reg, const TheISA::MiscReg &val, unsigned tid);
100 /** Sets a misc. register, including any side effects the write
101 * might have as defined by the architecture.
103 void setMiscRegWithEffect(int misc_reg,
104 const TheISA::MiscReg &val, unsigned tid);
106 /** Initiates a squash of all in-flight instructions for a given
107 * thread. The source of the squash is an external update of
108 * state through the TC.
110 void squashFromTC(unsigned tid);
112 /** Traps to handle given fault. */
113 void trap(Fault fault, unsigned tid);
115 /** Executes a syscall.
116 * @todo: Determine if this needs to be virtual.
118 void syscall(int64_t callnum, int tid);
119 /** Gets a syscall argument. */
120 TheISA::IntReg getSyscallArg(int i, int tid);
122 /** Used to shift args for indirect syscall. */
123 void setSyscallArg(int i, TheISA::IntReg val, int tid);
125 /** Sets the return value of a syscall. */
126 void setSyscallReturn(SyscallReturn return_value, int tid);
128 /** CPU read function, forwards read to LSQ. */
130 Fault read(RequestPtr &req, T &data, int load_idx)
132 return this->iew.ldstQueue.read(req, data, load_idx);
135 /** CPU write function, forwards write to LSQ. */
137 Fault write(RequestPtr &req, T &data, int store_idx)
139 return this->iew.ldstQueue.write(req, data, store_idx);
144 /** Temporary fix for the lock flag, works in the UP case. */
148 #endif // __CPU_O3_MIPS_CPU_HH__