simple_thread.hh revision 5358
114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2001-2006 The Regents of The University of Michigan
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
614184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
714184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
814184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
914184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1114184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1214184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1314184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1414184Sgabeblack@google.com * this software without specific prior written permission.
1514184Sgabeblack@google.com *
1614184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1714184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1814184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1914184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2014184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2114184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2214184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2314184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2414184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2514184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2614184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2714184Sgabeblack@google.com *
2814184Sgabeblack@google.com * Authors: Steve Reinhardt
2914184Sgabeblack@google.com *          Nathan Binkert
3014184Sgabeblack@google.com */
3114184Sgabeblack@google.com
3214184Sgabeblack@google.com#ifndef __CPU_SIMPLE_THREAD_HH__
3314184Sgabeblack@google.com#define __CPU_SIMPLE_THREAD_HH__
3414184Sgabeblack@google.com
3514184Sgabeblack@google.com#include "arch/isa_traits.hh"
3614184Sgabeblack@google.com#include "arch/regfile.hh"
3714184Sgabeblack@google.com#include "arch/syscallreturn.hh"
3814184Sgabeblack@google.com#include "arch/tlb.hh"
3914184Sgabeblack@google.com#include "config/full_system.hh"
4014184Sgabeblack@google.com#include "cpu/thread_context.hh"
4114184Sgabeblack@google.com#include "cpu/thread_state.hh"
4214184Sgabeblack@google.com#include "mem/request.hh"
4314184Sgabeblack@google.com#include "sim/byteswap.hh"
4414184Sgabeblack@google.com#include "sim/eventq.hh"
4514184Sgabeblack@google.com#include "sim/host.hh"
4614184Sgabeblack@google.com#include "sim/serialize.hh"
4714184Sgabeblack@google.com
4814184Sgabeblack@google.comclass BaseCPU;
4914184Sgabeblack@google.com
5014184Sgabeblack@google.com#if FULL_SYSTEM
5114184Sgabeblack@google.com
5214184Sgabeblack@google.com#include "sim/system.hh"
5314184Sgabeblack@google.com
5414184Sgabeblack@google.comclass FunctionProfile;
5514184Sgabeblack@google.comclass ProfileNode;
5614184Sgabeblack@google.comclass FunctionalPort;
5714184Sgabeblack@google.comclass PhysicalPort;
5814184Sgabeblack@google.com
5914184Sgabeblack@google.comnamespace TheISA {
6014184Sgabeblack@google.com    namespace Kernel {
6114184Sgabeblack@google.com        class Statistics;
6214184Sgabeblack@google.com    };
6314184Sgabeblack@google.com};
6414184Sgabeblack@google.com
6514184Sgabeblack@google.com#else // !FULL_SYSTEM
6614184Sgabeblack@google.com
6714184Sgabeblack@google.com#include "sim/process.hh"
6814184Sgabeblack@google.com#include "mem/page_table.hh"
6914184Sgabeblack@google.comclass TranslatingPort;
7014184Sgabeblack@google.com
7114184Sgabeblack@google.com#endif // FULL_SYSTEM
7214184Sgabeblack@google.com
7314184Sgabeblack@google.com/**
7414184Sgabeblack@google.com * The SimpleThread object provides a combination of the ThreadState
7514184Sgabeblack@google.com * object and the ThreadContext interface. It implements the
7614184Sgabeblack@google.com * ThreadContext interface so that a ProxyThreadContext class can be
7714184Sgabeblack@google.com * made using SimpleThread as the template parameter (see
7814184Sgabeblack@google.com * thread_context.hh). It adds to the ThreadState object by adding all
7914184Sgabeblack@google.com * the objects needed for simple functional execution, including a
8014184Sgabeblack@google.com * simple architectural register file, and pointers to the ITB and DTB
8114184Sgabeblack@google.com * in full system mode. For CPU models that do not need more advanced
8214184Sgabeblack@google.com * ways to hold state (i.e. a separate physical register file, or
8314184Sgabeblack@google.com * separate fetch and commit PC's), this SimpleThread class provides
8414184Sgabeblack@google.com * all the necessary state for full architecture-level functional
8514184Sgabeblack@google.com * simulation.  See the AtomicSimpleCPU or TimingSimpleCPU for
8614184Sgabeblack@google.com * examples.
8714184Sgabeblack@google.com */
8814184Sgabeblack@google.com
8914184Sgabeblack@google.comclass SimpleThread : public ThreadState
9014184Sgabeblack@google.com{
9114184Sgabeblack@google.com  protected:
9214184Sgabeblack@google.com    typedef TheISA::RegFile RegFile;
9314184Sgabeblack@google.com    typedef TheISA::MachInst MachInst;
9414184Sgabeblack@google.com    typedef TheISA::MiscRegFile MiscRegFile;
9514184Sgabeblack@google.com    typedef TheISA::MiscReg MiscReg;
9614184Sgabeblack@google.com    typedef TheISA::FloatReg FloatReg;
9714184Sgabeblack@google.com    typedef TheISA::FloatRegBits FloatRegBits;
9814184Sgabeblack@google.com  public:
9914184Sgabeblack@google.com    typedef ThreadContext::Status Status;
10014184Sgabeblack@google.com
10114184Sgabeblack@google.com  protected:
10214184Sgabeblack@google.com    RegFile regs;	// correct-path register context
10314184Sgabeblack@google.com
10414184Sgabeblack@google.com  public:
10514184Sgabeblack@google.com    // pointer to CPU associated with this SimpleThread
10614184Sgabeblack@google.com    BaseCPU *cpu;
10714184Sgabeblack@google.com
10814184Sgabeblack@google.com    ProxyThreadContext<SimpleThread> *tc;
10914184Sgabeblack@google.com
11014184Sgabeblack@google.com    System *system;
11114184Sgabeblack@google.com
11214184Sgabeblack@google.com    TheISA::ITB *itb;
11314184Sgabeblack@google.com    TheISA::DTB *dtb;
11414184Sgabeblack@google.com
11514184Sgabeblack@google.com    // constructor: initialize SimpleThread from given process structure
11614184Sgabeblack@google.com#if FULL_SYSTEM
11714184Sgabeblack@google.com    SimpleThread(BaseCPU *_cpu, int _thread_num, System *_system,
11814184Sgabeblack@google.com                 TheISA::ITB *_itb, TheISA::DTB *_dtb,
11914184Sgabeblack@google.com                 bool use_kernel_stats = true);
12014184Sgabeblack@google.com#else
12114184Sgabeblack@google.com    SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
12214184Sgabeblack@google.com                 TheISA::ITB *_itb, TheISA::DTB *_dtb, int _asid);
12314184Sgabeblack@google.com#endif
12414184Sgabeblack@google.com
12514184Sgabeblack@google.com    SimpleThread();
12614184Sgabeblack@google.com
12714184Sgabeblack@google.com    virtual ~SimpleThread();
12814184Sgabeblack@google.com
12914184Sgabeblack@google.com    virtual void takeOverFrom(ThreadContext *oldContext);
13014184Sgabeblack@google.com
13114184Sgabeblack@google.com    void regStats(const std::string &name);
13214184Sgabeblack@google.com
13314184Sgabeblack@google.com    void copyTC(ThreadContext *context);
13414184Sgabeblack@google.com
13514184Sgabeblack@google.com    void copyState(ThreadContext *oldContext);
13614184Sgabeblack@google.com
13714184Sgabeblack@google.com    void serialize(std::ostream &os);
13814184Sgabeblack@google.com    void unserialize(Checkpoint *cp, const std::string &section);
13914184Sgabeblack@google.com
14014184Sgabeblack@google.com    /***************************************************************
14114184Sgabeblack@google.com     *  SimpleThread functions to provide CPU with access to various
14214184Sgabeblack@google.com     *  state, and to provide address translation methods.
14314184Sgabeblack@google.com     **************************************************************/
14414184Sgabeblack@google.com
14514184Sgabeblack@google.com    /** Returns the pointer to this SimpleThread's ThreadContext. Used
14614184Sgabeblack@google.com     *  when a ThreadContext must be passed to objects outside of the
14714184Sgabeblack@google.com     *  CPU.
14814184Sgabeblack@google.com     */
14914184Sgabeblack@google.com    ThreadContext *getTC() { return tc; }
15014184Sgabeblack@google.com
15114184Sgabeblack@google.com    Fault translateInstReq(RequestPtr &req)
15214184Sgabeblack@google.com    {
15314184Sgabeblack@google.com        return itb->translate(req, tc);
15414184Sgabeblack@google.com    }
15514184Sgabeblack@google.com
15614184Sgabeblack@google.com    Fault translateDataReadReq(RequestPtr &req)
15714184Sgabeblack@google.com    {
15814184Sgabeblack@google.com        return dtb->translate(req, tc, false);
15914184Sgabeblack@google.com    }
16014184Sgabeblack@google.com
16114184Sgabeblack@google.com    Fault translateDataWriteReq(RequestPtr &req)
16214184Sgabeblack@google.com    {
16314184Sgabeblack@google.com        return dtb->translate(req, tc, true);
16414184Sgabeblack@google.com    }
16514184Sgabeblack@google.com
16614184Sgabeblack@google.com    void demapPage(Addr vaddr, uint64_t asn)
16714184Sgabeblack@google.com    {
16814184Sgabeblack@google.com        itb->demapPage(vaddr, asn);
16914184Sgabeblack@google.com        dtb->demapPage(vaddr, asn);
17014184Sgabeblack@google.com    }
17114184Sgabeblack@google.com
17214184Sgabeblack@google.com    void demapInstPage(Addr vaddr, uint64_t asn)
17314184Sgabeblack@google.com    {
17414184Sgabeblack@google.com        itb->demapPage(vaddr, asn);
17514184Sgabeblack@google.com    }
17614184Sgabeblack@google.com
17714184Sgabeblack@google.com    void demapDataPage(Addr vaddr, uint64_t asn)
17814184Sgabeblack@google.com    {
17914184Sgabeblack@google.com        dtb->demapPage(vaddr, asn);
18014184Sgabeblack@google.com    }
18114184Sgabeblack@google.com
18214184Sgabeblack@google.com#if FULL_SYSTEM
18314184Sgabeblack@google.com    int getInstAsid() { return regs.instAsid(); }
18414184Sgabeblack@google.com    int getDataAsid() { return regs.dataAsid(); }
18514184Sgabeblack@google.com
18614184Sgabeblack@google.com    void dumpFuncProfile();
18714184Sgabeblack@google.com
18814184Sgabeblack@google.com    Fault hwrei();
18914184Sgabeblack@google.com
19014184Sgabeblack@google.com    bool simPalCheck(int palFunc);
19114184Sgabeblack@google.com
19214184Sgabeblack@google.com#endif
19314184Sgabeblack@google.com
19414184Sgabeblack@google.com    /*******************************************
19514184Sgabeblack@google.com     * ThreadContext interface functions.
19614184Sgabeblack@google.com     ******************************************/
19714184Sgabeblack@google.com
19814184Sgabeblack@google.com    BaseCPU *getCpuPtr() { return cpu; }
19914184Sgabeblack@google.com
20014184Sgabeblack@google.com    int getThreadNum() { return tid; }
20114184Sgabeblack@google.com
20214184Sgabeblack@google.com    TheISA::ITB *getITBPtr() { return itb; }
20314184Sgabeblack@google.com
20414184Sgabeblack@google.com    TheISA::DTB *getDTBPtr() { return dtb; }
20514184Sgabeblack@google.com
20614184Sgabeblack@google.com#if FULL_SYSTEM
20714184Sgabeblack@google.com    System *getSystemPtr() { return system; }
20814184Sgabeblack@google.com
20914184Sgabeblack@google.com    FunctionalPort *getPhysPort() { return physPort; }
21014184Sgabeblack@google.com
21114184Sgabeblack@google.com    /** Return a virtual port. If no thread context is specified then a static
21214184Sgabeblack@google.com     * port is returned. Otherwise a port is created and returned. It must be
21314184Sgabeblack@google.com     * deleted by deleteVirtPort(). */
21414184Sgabeblack@google.com    VirtualPort *getVirtPort(ThreadContext *tc);
21514184Sgabeblack@google.com
21614184Sgabeblack@google.com    void delVirtPort(VirtualPort *vp);
21714184Sgabeblack@google.com#endif
21814184Sgabeblack@google.com
21914184Sgabeblack@google.com    Status status() const { return _status; }
22014184Sgabeblack@google.com
22114184Sgabeblack@google.com    void setStatus(Status newStatus) { _status = newStatus; }
22214184Sgabeblack@google.com
22314184Sgabeblack@google.com    /// Set the status to Active.  Optional delay indicates number of
22414184Sgabeblack@google.com    /// cycles to wait before beginning execution.
22514184Sgabeblack@google.com    void activate(int delay = 1);
22614184Sgabeblack@google.com
22714184Sgabeblack@google.com    /// Set the status to Suspended.
22814184Sgabeblack@google.com    void suspend();
22914184Sgabeblack@google.com
23014184Sgabeblack@google.com    /// Set the status to Unallocated.
23114184Sgabeblack@google.com    void deallocate();
23214184Sgabeblack@google.com
23314184Sgabeblack@google.com    /// Set the status to Halted.
23414184Sgabeblack@google.com    void halt();
23514184Sgabeblack@google.com
23614184Sgabeblack@google.com    virtual bool misspeculating();
23714184Sgabeblack@google.com
23814184Sgabeblack@google.com    Fault instRead(RequestPtr &req)
23914184Sgabeblack@google.com    {
24014184Sgabeblack@google.com        panic("instRead not implemented");
24114184Sgabeblack@google.com        // return funcPhysMem->read(req, inst);
24214184Sgabeblack@google.com        return NoFault;
24314184Sgabeblack@google.com    }
24414184Sgabeblack@google.com
24514184Sgabeblack@google.com    void copyArchRegs(ThreadContext *tc);
24614184Sgabeblack@google.com
24714184Sgabeblack@google.com    void clearArchRegs() { regs.clear(); }
24814184Sgabeblack@google.com
24914184Sgabeblack@google.com    //
25014184Sgabeblack@google.com    // New accessors for new decoder.
25114184Sgabeblack@google.com    //
25214184Sgabeblack@google.com    uint64_t readIntReg(int reg_idx)
25314184Sgabeblack@google.com    {
25414184Sgabeblack@google.com        int flatIndex = TheISA::flattenIntIndex(getTC(), reg_idx);
25514184Sgabeblack@google.com        return regs.readIntReg(flatIndex);
25614184Sgabeblack@google.com    }
25714184Sgabeblack@google.com
25814184Sgabeblack@google.com    FloatReg readFloatReg(int reg_idx, int width)
25914184Sgabeblack@google.com    {
26014184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
26114184Sgabeblack@google.com        return regs.readFloatReg(flatIndex, width);
26214184Sgabeblack@google.com    }
26314184Sgabeblack@google.com
26414184Sgabeblack@google.com    FloatReg readFloatReg(int reg_idx)
26514184Sgabeblack@google.com    {
26614184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
26714184Sgabeblack@google.com        return regs.readFloatReg(flatIndex);
26814184Sgabeblack@google.com    }
26914184Sgabeblack@google.com
27014184Sgabeblack@google.com    FloatRegBits readFloatRegBits(int reg_idx, int width)
27114184Sgabeblack@google.com    {
27214184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
27314184Sgabeblack@google.com        return regs.readFloatRegBits(flatIndex, width);
27414184Sgabeblack@google.com    }
27514184Sgabeblack@google.com
27614184Sgabeblack@google.com    FloatRegBits readFloatRegBits(int reg_idx)
27714184Sgabeblack@google.com    {
27814184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
27914184Sgabeblack@google.com        return regs.readFloatRegBits(flatIndex);
28014184Sgabeblack@google.com    }
28114184Sgabeblack@google.com
28214184Sgabeblack@google.com    void setIntReg(int reg_idx, uint64_t val)
28314184Sgabeblack@google.com    {
28414184Sgabeblack@google.com        int flatIndex = TheISA::flattenIntIndex(getTC(), reg_idx);
28514184Sgabeblack@google.com        regs.setIntReg(flatIndex, val);
28614184Sgabeblack@google.com    }
28714184Sgabeblack@google.com
28814184Sgabeblack@google.com    void setFloatReg(int reg_idx, FloatReg val, int width)
28914184Sgabeblack@google.com    {
29014184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
29114184Sgabeblack@google.com        regs.setFloatReg(flatIndex, val, width);
29214184Sgabeblack@google.com    }
29314184Sgabeblack@google.com
29414184Sgabeblack@google.com    void setFloatReg(int reg_idx, FloatReg val)
29514184Sgabeblack@google.com    {
29614184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
29714184Sgabeblack@google.com        regs.setFloatReg(flatIndex, val);
29814184Sgabeblack@google.com    }
29914184Sgabeblack@google.com
30014184Sgabeblack@google.com    void setFloatRegBits(int reg_idx, FloatRegBits val, int width)
30114184Sgabeblack@google.com    {
30214184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
30314184Sgabeblack@google.com        regs.setFloatRegBits(flatIndex, val, width);
30414184Sgabeblack@google.com    }
30514184Sgabeblack@google.com
30614184Sgabeblack@google.com    void setFloatRegBits(int reg_idx, FloatRegBits val)
30714184Sgabeblack@google.com    {
30814184Sgabeblack@google.com        int flatIndex = TheISA::flattenFloatIndex(getTC(), reg_idx);
30914184Sgabeblack@google.com        regs.setFloatRegBits(flatIndex, val);
31014184Sgabeblack@google.com    }
31114184Sgabeblack@google.com
31214184Sgabeblack@google.com    uint64_t readPC()
31314184Sgabeblack@google.com    {
31414184Sgabeblack@google.com        return regs.readPC();
31514184Sgabeblack@google.com    }
31614184Sgabeblack@google.com
31714184Sgabeblack@google.com    void setPC(uint64_t val)
31814184Sgabeblack@google.com    {
31914184Sgabeblack@google.com        regs.setPC(val);
32014184Sgabeblack@google.com    }
32114184Sgabeblack@google.com
32214184Sgabeblack@google.com    uint64_t readMicroPC()
32314184Sgabeblack@google.com    {
32414184Sgabeblack@google.com        return microPC;
32514184Sgabeblack@google.com    }
32614184Sgabeblack@google.com
32714184Sgabeblack@google.com    void setMicroPC(uint64_t val)
32814184Sgabeblack@google.com    {
32914184Sgabeblack@google.com        microPC = val;
33014184Sgabeblack@google.com    }
33114184Sgabeblack@google.com
33214184Sgabeblack@google.com    uint64_t readNextPC()
33314184Sgabeblack@google.com    {
33414184Sgabeblack@google.com        return regs.readNextPC();
33514184Sgabeblack@google.com    }
33614184Sgabeblack@google.com
33714184Sgabeblack@google.com    void setNextPC(uint64_t val)
33814184Sgabeblack@google.com    {
33914184Sgabeblack@google.com        regs.setNextPC(val);
34014184Sgabeblack@google.com    }
34114184Sgabeblack@google.com
34214184Sgabeblack@google.com    uint64_t readNextMicroPC()
34314184Sgabeblack@google.com    {
34414184Sgabeblack@google.com        return nextMicroPC;
34514184Sgabeblack@google.com    }
34614184Sgabeblack@google.com
34714184Sgabeblack@google.com    void setNextMicroPC(uint64_t val)
34814184Sgabeblack@google.com    {
34914184Sgabeblack@google.com        nextMicroPC = val;
35014184Sgabeblack@google.com    }
35114184Sgabeblack@google.com
35214184Sgabeblack@google.com    uint64_t readNextNPC()
35314184Sgabeblack@google.com    {
35414184Sgabeblack@google.com        return regs.readNextNPC();
35514184Sgabeblack@google.com    }
35614184Sgabeblack@google.com
35714184Sgabeblack@google.com    void setNextNPC(uint64_t val)
35814184Sgabeblack@google.com    {
35914184Sgabeblack@google.com        regs.setNextNPC(val);
36014184Sgabeblack@google.com    }
36114184Sgabeblack@google.com
36214184Sgabeblack@google.com    MiscReg readMiscRegNoEffect(int misc_reg, unsigned tid = 0)
36314184Sgabeblack@google.com    {
36414184Sgabeblack@google.com        return regs.readMiscRegNoEffect(misc_reg);
36514184Sgabeblack@google.com    }
36614184Sgabeblack@google.com
36714184Sgabeblack@google.com    MiscReg readMiscReg(int misc_reg, unsigned tid = 0)
36814184Sgabeblack@google.com    {
36914184Sgabeblack@google.com        return regs.readMiscReg(misc_reg, tc);
37014184Sgabeblack@google.com    }
37114184Sgabeblack@google.com
37214184Sgabeblack@google.com    void setMiscRegNoEffect(int misc_reg, const MiscReg &val, unsigned tid = 0)
37314184Sgabeblack@google.com    {
37414184Sgabeblack@google.com        return regs.setMiscRegNoEffect(misc_reg, val);
37514184Sgabeblack@google.com    }
37614184Sgabeblack@google.com
37714184Sgabeblack@google.com    void setMiscReg(int misc_reg, const MiscReg &val, unsigned tid = 0)
37814184Sgabeblack@google.com    {
37914184Sgabeblack@google.com        return regs.setMiscReg(misc_reg, val, tc);
38014184Sgabeblack@google.com    }
38114184Sgabeblack@google.com
38214184Sgabeblack@google.com    unsigned readStCondFailures() { return storeCondFailures; }
38314184Sgabeblack@google.com
38414184Sgabeblack@google.com    void setStCondFailures(unsigned sc_failures)
38514184Sgabeblack@google.com    { storeCondFailures = sc_failures; }
38614184Sgabeblack@google.com
38714184Sgabeblack@google.com#if !FULL_SYSTEM
38814184Sgabeblack@google.com    TheISA::IntReg getSyscallArg(int i)
38914184Sgabeblack@google.com    {
39014184Sgabeblack@google.com        assert(i < TheISA::NumArgumentRegs);
39114184Sgabeblack@google.com        return regs.readIntReg(TheISA::flattenIntIndex(getTC(),
39214184Sgabeblack@google.com                    TheISA::ArgumentReg[i]));
39314184Sgabeblack@google.com    }
39414184Sgabeblack@google.com
39514184Sgabeblack@google.com    // used to shift args for indirect syscall
39614184Sgabeblack@google.com    void setSyscallArg(int i, TheISA::IntReg val)
39714184Sgabeblack@google.com    {
39814184Sgabeblack@google.com        assert(i < TheISA::NumArgumentRegs);
39914184Sgabeblack@google.com        regs.setIntReg(TheISA::flattenIntIndex(getTC(),
40014184Sgabeblack@google.com                    TheISA::ArgumentReg[i]), val);
40114184Sgabeblack@google.com    }
40214184Sgabeblack@google.com
40314184Sgabeblack@google.com    void setSyscallReturn(SyscallReturn return_value)
40414184Sgabeblack@google.com    {
40514184Sgabeblack@google.com        TheISA::setSyscallReturn(return_value, getTC());
40614184Sgabeblack@google.com    }
40714184Sgabeblack@google.com
40814184Sgabeblack@google.com    void syscall(int64_t callnum)
40914184Sgabeblack@google.com    {
41014184Sgabeblack@google.com        process->syscall(callnum, tc);
41114184Sgabeblack@google.com    }
41214184Sgabeblack@google.com#endif
41314184Sgabeblack@google.com
41414184Sgabeblack@google.com    void changeRegFileContext(TheISA::RegContextParam param,
41514184Sgabeblack@google.com            TheISA::RegContextVal val)
41614184Sgabeblack@google.com    {
41714184Sgabeblack@google.com        regs.changeContext(param, val);
41814184Sgabeblack@google.com    }
41914184Sgabeblack@google.com};
42014184Sgabeblack@google.com
42114184Sgabeblack@google.com
42214184Sgabeblack@google.com// for non-speculative execution context, spec_mode is always false
42314184Sgabeblack@google.cominline bool
42414184Sgabeblack@google.comSimpleThread::misspeculating()
42514184Sgabeblack@google.com{
42614184Sgabeblack@google.com    return false;
42714184Sgabeblack@google.com}
42814184Sgabeblack@google.com
42914184Sgabeblack@google.com#endif // __CPU_CPU_EXEC_CONTEXT_HH__
43014184Sgabeblack@google.com