thread_context.hh revision 11005
12SN/A/*
29428SAndreas.Sandberg@ARM.com * Copyright (c) 2011-2012 ARM Limited
39920Syasuko.eckert@amd.com * Copyright (c) 2013 Advanced Micro Devices, Inc.
48733Sgeoffrey.blake@arm.com * All rights reserved
58733Sgeoffrey.blake@arm.com *
68733Sgeoffrey.blake@arm.com * The license below extends only to copyright in the software and shall
78733Sgeoffrey.blake@arm.com * not be construed as granting a license to any other intellectual
88733Sgeoffrey.blake@arm.com * property including but not limited to intellectual property relating
98733Sgeoffrey.blake@arm.com * to a hardware implementation of the functionality of the software
108733Sgeoffrey.blake@arm.com * licensed hereunder.  You may use the software subject to the license
118733Sgeoffrey.blake@arm.com * terms below provided that you ensure that this notice is replicated
128733Sgeoffrey.blake@arm.com * unmodified and in its entirety in all distributions of the software,
138733Sgeoffrey.blake@arm.com * modified or unmodified, in source code or in binary form.
148733Sgeoffrey.blake@arm.com *
152190SN/A * Copyright (c) 2006 The Regents of The University of Michigan
162SN/A * All rights reserved.
172SN/A *
182SN/A * Redistribution and use in source and binary forms, with or without
192SN/A * modification, are permitted provided that the following conditions are
202SN/A * met: redistributions of source code must retain the above copyright
212SN/A * notice, this list of conditions and the following disclaimer;
222SN/A * redistributions in binary form must reproduce the above copyright
232SN/A * notice, this list of conditions and the following disclaimer in the
242SN/A * documentation and/or other materials provided with the distribution;
252SN/A * neither the name of the copyright holders nor the names of its
262SN/A * contributors may be used to endorse or promote products derived from
272SN/A * this software without specific prior written permission.
282SN/A *
292SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
302SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
312SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
322SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
332SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
342SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
352SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
362SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
372SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
382SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
392SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402665SN/A *
412665SN/A * Authors: Kevin Lim
422SN/A */
432SN/A
442680Sktlim@umich.edu#ifndef __CPU_THREAD_CONTEXT_HH__
452680Sktlim@umich.edu#define __CPU_THREAD_CONTEXT_HH__
462SN/A
478229Snate@binkert.org#include <iostream>
487680Sgblack@eecs.umich.edu#include <string>
497680Sgblack@eecs.umich.edu
506329Sgblack@eecs.umich.edu#include "arch/registers.hh"
513453Sgblack@eecs.umich.edu#include "arch/types.hh"
526216Snate@binkert.org#include "base/types.hh"
536658Snate@binkert.org#include "config/the_isa.hh"
542SN/A
552190SN/A// @todo: Figure out a more architecture independent way to obtain the ITB and
562190SN/A// DTB pointers.
573453Sgblack@eecs.umich.edunamespace TheISA
583453Sgblack@eecs.umich.edu{
599020Sgblack@eecs.umich.edu    class Decoder;
606022Sgblack@eecs.umich.edu    class TLB;
613453Sgblack@eecs.umich.edu}
622190SN/Aclass BaseCPU;
638887Sgeoffrey.blake@arm.comclass CheckerCPU;
647680Sgblack@eecs.umich.educlass Checkpoint;
652313SN/Aclass EndQuiesceEvent;
668706Sandreas.hansson@arm.comclass SETranslatingPortProxy;
678706Sandreas.hansson@arm.comclass FSTranslatingPortProxy;
688706Sandreas.hansson@arm.comclass PortProxy;
692190SN/Aclass Process;
702190SN/Aclass System;
713548Sgblack@eecs.umich.edunamespace TheISA {
723548Sgblack@eecs.umich.edu    namespace Kernel {
733548Sgblack@eecs.umich.edu        class Statistics;
748902Sandreas.hansson@arm.com    }
758902Sandreas.hansson@arm.com}
762SN/A
772680Sktlim@umich.edu/**
782680Sktlim@umich.edu * ThreadContext is the external interface to all thread state for
792680Sktlim@umich.edu * anything outside of the CPU. It provides all accessor methods to
802680Sktlim@umich.edu * state that might be needed by external objects, ranging from
812680Sktlim@umich.edu * register values to things such as kernel stats. It is an abstract
822680Sktlim@umich.edu * base class; the CPU can create its own ThreadContext by either
832680Sktlim@umich.edu * deriving from it, or using the templated ProxyThreadContext.
842680Sktlim@umich.edu *
852680Sktlim@umich.edu * The ThreadContext is slightly different than the ExecContext.  The
862680Sktlim@umich.edu * ThreadContext provides access to an individual thread's state; an
872680Sktlim@umich.edu * ExecContext provides ISA access to the CPU (meaning it is
882682Sktlim@umich.edu * implicitly multithreaded on SMT systems).  Additionally the
892680Sktlim@umich.edu * ThreadState is an abstract class that exactly defines the
902680Sktlim@umich.edu * interface; the ExecContext is a more implicit interface that must
912680Sktlim@umich.edu * be implemented so that the ISA can access whatever state it needs.
922680Sktlim@umich.edu */
932680Sktlim@umich.educlass ThreadContext
942SN/A{
952107SN/A  protected:
962107SN/A    typedef TheISA::MachInst MachInst;
972190SN/A    typedef TheISA::IntReg IntReg;
982455SN/A    typedef TheISA::FloatReg FloatReg;
992455SN/A    typedef TheISA::FloatRegBits FloatRegBits;
1009920Syasuko.eckert@amd.com    typedef TheISA::CCReg CCReg;
1012159SN/A    typedef TheISA::MiscReg MiscReg;
1022SN/A  public:
1036029Ssteve.reinhardt@amd.com
104246SN/A    enum Status
105246SN/A    {
106246SN/A        /// Running.  Instructions should be executed only when
107246SN/A        /// the context is in this state.
108246SN/A        Active,
109246SN/A
110246SN/A        /// Temporarily inactive.  Entered while waiting for
1112190SN/A        /// synchronization, etc.
112246SN/A        Suspended,
113246SN/A
114246SN/A        /// Permanently shut down.  Entered when target executes
115246SN/A        /// m5exit pseudo-instruction.  When all contexts enter
116246SN/A        /// this state, the simulation will terminate.
117246SN/A        Halted
118246SN/A    };
1192SN/A
1202680Sktlim@umich.edu    virtual ~ThreadContext() { };
1212423SN/A
1222190SN/A    virtual BaseCPU *getCpuPtr() = 0;
123180SN/A
12410110Sandreas.hansson@arm.com    virtual int cpuId() const = 0;
1252190SN/A
12610190Sakash.bagdia@arm.com    virtual uint32_t socketId() const = 0;
12710190Sakash.bagdia@arm.com
12810110Sandreas.hansson@arm.com    virtual int threadId() const = 0;
1295715Shsul@eecs.umich.edu
1305715Shsul@eecs.umich.edu    virtual void setThreadId(int id) = 0;
1315714Shsul@eecs.umich.edu
13210110Sandreas.hansson@arm.com    virtual int contextId() const = 0;
1335714Shsul@eecs.umich.edu
1345714Shsul@eecs.umich.edu    virtual void setContextId(int id) = 0;
1355714Shsul@eecs.umich.edu
1366022Sgblack@eecs.umich.edu    virtual TheISA::TLB *getITBPtr() = 0;
1372190SN/A
1386022Sgblack@eecs.umich.edu    virtual TheISA::TLB *getDTBPtr() = 0;
1392521SN/A
1408887Sgeoffrey.blake@arm.com    virtual CheckerCPU *getCheckerCpuPtr() = 0;
1418733Sgeoffrey.blake@arm.com
1429020Sgblack@eecs.umich.edu    virtual TheISA::Decoder *getDecoderPtr() = 0;
1438541Sgblack@eecs.umich.edu
1444997Sgblack@eecs.umich.edu    virtual System *getSystemPtr() = 0;
1454997Sgblack@eecs.umich.edu
1463548Sgblack@eecs.umich.edu    virtual TheISA::Kernel::Statistics *getKernelStats() = 0;
1472654SN/A
1488852Sandreas.hansson@arm.com    virtual PortProxy &getPhysProxy() = 0;
1492521SN/A
1508852Sandreas.hansson@arm.com    virtual FSTranslatingPortProxy &getVirtProxy() = 0;
1513673Srdreslin@umich.edu
1528706Sandreas.hansson@arm.com    /**
1538706Sandreas.hansson@arm.com     * Initialise the physical and virtual port proxies and tie them to
1548706Sandreas.hansson@arm.com     * the data port of the CPU.
1558706Sandreas.hansson@arm.com     *
1568706Sandreas.hansson@arm.com     * tc ThreadContext for the virtual-to-physical translation
1578706Sandreas.hansson@arm.com     */
1588706Sandreas.hansson@arm.com    virtual void initMemProxies(ThreadContext *tc) = 0;
1598799Sgblack@eecs.umich.edu
1608852Sandreas.hansson@arm.com    virtual SETranslatingPortProxy &getMemProxy() = 0;
1612518SN/A
1622190SN/A    virtual Process *getProcessPtr() = 0;
1632190SN/A
1642190SN/A    virtual Status status() const = 0;
1652159SN/A
1662235SN/A    virtual void setStatus(Status new_status) = 0;
1672103SN/A
16810407Smitch.hayenga@arm.com    /// Set the status to Active.
16910407Smitch.hayenga@arm.com    virtual void activate() = 0;
170393SN/A
171393SN/A    /// Set the status to Suspended.
17210407Smitch.hayenga@arm.com    virtual void suspend() = 0;
173393SN/A
174393SN/A    /// Set the status to Halted.
17510407Smitch.hayenga@arm.com    virtual void halt() = 0;
1762159SN/A
1772190SN/A    virtual void dumpFuncProfile() = 0;
1782159SN/A
1792680Sktlim@umich.edu    virtual void takeOverFrom(ThreadContext *old_context) = 0;
1802159SN/A
1812190SN/A    virtual void regStats(const std::string &name) = 0;
1822159SN/A
1832313SN/A    virtual EndQuiesceEvent *getQuiesceEvent() = 0;
1842235SN/A
1852235SN/A    // Not necessarily the best location for these...
1862235SN/A    // Having an extra function just to read these is obnoxious
1872235SN/A    virtual Tick readLastActivate() = 0;
1882235SN/A    virtual Tick readLastSuspend() = 0;
1892254SN/A
1902254SN/A    virtual void profileClear() = 0;
1912254SN/A    virtual void profileSample() = 0;
1922235SN/A
1932680Sktlim@umich.edu    virtual void copyArchRegs(ThreadContext *tc) = 0;
1942159SN/A
1952190SN/A    virtual void clearArchRegs() = 0;
1962159SN/A
1972159SN/A    //
1982159SN/A    // New accessors for new decoder.
1992159SN/A    //
2002190SN/A    virtual uint64_t readIntReg(int reg_idx) = 0;
2012159SN/A
2022455SN/A    virtual FloatReg readFloatReg(int reg_idx) = 0;
2032159SN/A
2042455SN/A    virtual FloatRegBits readFloatRegBits(int reg_idx) = 0;
2052159SN/A
2069920Syasuko.eckert@amd.com    virtual CCReg readCCReg(int reg_idx) = 0;
2079920Syasuko.eckert@amd.com
2082190SN/A    virtual void setIntReg(int reg_idx, uint64_t val) = 0;
2092159SN/A
2102455SN/A    virtual void setFloatReg(int reg_idx, FloatReg val) = 0;
2112159SN/A
2122455SN/A    virtual void setFloatRegBits(int reg_idx, FloatRegBits val) = 0;
2132455SN/A
2149920Syasuko.eckert@amd.com    virtual void setCCReg(int reg_idx, CCReg val) = 0;
2159920Syasuko.eckert@amd.com
2167720Sgblack@eecs.umich.edu    virtual TheISA::PCState pcState() = 0;
2172159SN/A
2187720Sgblack@eecs.umich.edu    virtual void pcState(const TheISA::PCState &val) = 0;
2192159SN/A
2208733Sgeoffrey.blake@arm.com    virtual void pcStateNoRecord(const TheISA::PCState &val) = 0;
2218733Sgeoffrey.blake@arm.com
2227720Sgblack@eecs.umich.edu    virtual Addr instAddr() = 0;
2232159SN/A
2247720Sgblack@eecs.umich.edu    virtual Addr nextInstAddr() = 0;
2252159SN/A
2267720Sgblack@eecs.umich.edu    virtual MicroPC microPC() = 0;
2275260Sksewell@umich.edu
22810698Sandreas.hansson@arm.com    virtual MiscReg readMiscRegNoEffect(int misc_reg) const = 0;
2294172Ssaidi@eecs.umich.edu
2302190SN/A    virtual MiscReg readMiscReg(int misc_reg) = 0;
2312159SN/A
2324172Ssaidi@eecs.umich.edu    virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val) = 0;
2332190SN/A
2343468Sgblack@eecs.umich.edu    virtual void setMiscReg(int misc_reg, const MiscReg &val) = 0;
2352190SN/A
2366313Sgblack@eecs.umich.edu    virtual int flattenIntIndex(int reg) = 0;
2376313Sgblack@eecs.umich.edu    virtual int flattenFloatIndex(int reg) = 0;
2389920Syasuko.eckert@amd.com    virtual int flattenCCIndex(int reg) = 0;
23910033SAli.Saidi@ARM.com    virtual int flattenMiscIndex(int reg) = 0;
2406313Sgblack@eecs.umich.edu
2416221Snate@binkert.org    virtual uint64_t
2426221Snate@binkert.org    readRegOtherThread(int misc_reg, ThreadID tid)
2436221Snate@binkert.org    {
2446221Snate@binkert.org        return 0;
2456221Snate@binkert.org    }
2464661Sksewell@umich.edu
2476221Snate@binkert.org    virtual void
2486221Snate@binkert.org    setRegOtherThread(int misc_reg, const MiscReg &val, ThreadID tid)
2496221Snate@binkert.org    {
2506221Snate@binkert.org    }
2514661Sksewell@umich.edu
2522235SN/A    // Also not necessarily the best location for these two.  Hopefully will go
2532235SN/A    // away once we decide upon where st cond failures goes.
2542190SN/A    virtual unsigned readStCondFailures() = 0;
2552190SN/A
2562190SN/A    virtual void setStCondFailures(unsigned sc_failures) = 0;
2572159SN/A
2582235SN/A    // Same with st cond failures.
2592190SN/A    virtual Counter readFuncExeInst() = 0;
2602834Sksewell@umich.edu
2614111Sgblack@eecs.umich.edu    virtual void syscall(int64_t callnum) = 0;
2624111Sgblack@eecs.umich.edu
2632834Sksewell@umich.edu    // This function exits the thread context in the CPU and returns
2642834Sksewell@umich.edu    // 1 if the CPU has no more active threads (meaning it's OK to exit);
2652834Sksewell@umich.edu    // Used in syscall-emulation mode when a  thread calls the exit syscall.
2662834Sksewell@umich.edu    virtual int exit() { return 1; };
2672525SN/A
2685217Ssaidi@eecs.umich.edu    /** function to compare two thread contexts (for debugging) */
2695217Ssaidi@eecs.umich.edu    static void compare(ThreadContext *one, ThreadContext *two);
2709426SAndreas.Sandberg@ARM.com
2719426SAndreas.Sandberg@ARM.com    /** @{ */
2729426SAndreas.Sandberg@ARM.com    /**
2739426SAndreas.Sandberg@ARM.com     * Flat register interfaces
2749426SAndreas.Sandberg@ARM.com     *
2759426SAndreas.Sandberg@ARM.com     * Some architectures have different registers visible in
2769426SAndreas.Sandberg@ARM.com     * different modes. Such architectures "flatten" a register (see
2779426SAndreas.Sandberg@ARM.com     * flattenIntIndex() and flattenFloatIndex()) to map it into the
2789426SAndreas.Sandberg@ARM.com     * gem5 register file. This interface provides a flat interface to
2799426SAndreas.Sandberg@ARM.com     * the underlying register file, which allows for example
2809426SAndreas.Sandberg@ARM.com     * serialization code to access all registers.
2819426SAndreas.Sandberg@ARM.com     */
2829426SAndreas.Sandberg@ARM.com
2839426SAndreas.Sandberg@ARM.com    virtual uint64_t readIntRegFlat(int idx) = 0;
2849426SAndreas.Sandberg@ARM.com    virtual void setIntRegFlat(int idx, uint64_t val) = 0;
2859426SAndreas.Sandberg@ARM.com
2869426SAndreas.Sandberg@ARM.com    virtual FloatReg readFloatRegFlat(int idx) = 0;
2879426SAndreas.Sandberg@ARM.com    virtual void setFloatRegFlat(int idx, FloatReg val) = 0;
2889426SAndreas.Sandberg@ARM.com
2899426SAndreas.Sandberg@ARM.com    virtual FloatRegBits readFloatRegBitsFlat(int idx) = 0;
2909426SAndreas.Sandberg@ARM.com    virtual void setFloatRegBitsFlat(int idx, FloatRegBits val) = 0;
2919426SAndreas.Sandberg@ARM.com
2929920Syasuko.eckert@amd.com    virtual CCReg readCCRegFlat(int idx) = 0;
2939920Syasuko.eckert@amd.com    virtual void setCCRegFlat(int idx, CCReg val) = 0;
2949426SAndreas.Sandberg@ARM.com    /** @} */
2959426SAndreas.Sandberg@ARM.com
2962159SN/A};
2972159SN/A
2982682Sktlim@umich.edu/**
2992682Sktlim@umich.edu * ProxyThreadContext class that provides a way to implement a
3002682Sktlim@umich.edu * ThreadContext without having to derive from it. ThreadContext is an
3012682Sktlim@umich.edu * abstract class, so anything that derives from it and uses its
3022682Sktlim@umich.edu * interface will pay the overhead of virtual function calls.  This
3032682Sktlim@umich.edu * class is created to enable a user-defined Thread object to be used
3042682Sktlim@umich.edu * wherever ThreadContexts are used, without paying the overhead of
3052682Sktlim@umich.edu * virtual function calls when it is used by itself.  See
3062682Sktlim@umich.edu * simple_thread.hh for an example of this.
3072682Sktlim@umich.edu */
3082680Sktlim@umich.edutemplate <class TC>
3092680Sktlim@umich.educlass ProxyThreadContext : public ThreadContext
3102190SN/A{
3112190SN/A  public:
3122680Sktlim@umich.edu    ProxyThreadContext(TC *actual_tc)
3132680Sktlim@umich.edu    { actualTC = actual_tc; }
3142159SN/A
3152190SN/A  private:
3162680Sktlim@umich.edu    TC *actualTC;
3172SN/A
3182SN/A  public:
3192SN/A
3202680Sktlim@umich.edu    BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
3212SN/A
32210110Sandreas.hansson@arm.com    int cpuId() const { return actualTC->cpuId(); }
3232SN/A
32410190Sakash.bagdia@arm.com    uint32_t socketId() const { return actualTC->socketId(); }
32510190Sakash.bagdia@arm.com
32610110Sandreas.hansson@arm.com    int threadId() const { return actualTC->threadId(); }
3275715Shsul@eecs.umich.edu
32810110Sandreas.hansson@arm.com    void setThreadId(int id) { actualTC->setThreadId(id); }
3295714Shsul@eecs.umich.edu
33010110Sandreas.hansson@arm.com    int contextId() const { return actualTC->contextId(); }
3315714Shsul@eecs.umich.edu
3325714Shsul@eecs.umich.edu    void setContextId(int id) { actualTC->setContextId(id); }
3335714Shsul@eecs.umich.edu
3346022Sgblack@eecs.umich.edu    TheISA::TLB *getITBPtr() { return actualTC->getITBPtr(); }
3351917SN/A
3366022Sgblack@eecs.umich.edu    TheISA::TLB *getDTBPtr() { return actualTC->getDTBPtr(); }
3372521SN/A
3388887Sgeoffrey.blake@arm.com    CheckerCPU *getCheckerCpuPtr() { return actualTC->getCheckerCpuPtr(); }
3398733Sgeoffrey.blake@arm.com
3409020Sgblack@eecs.umich.edu    TheISA::Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); }
3418541Sgblack@eecs.umich.edu
3424997Sgblack@eecs.umich.edu    System *getSystemPtr() { return actualTC->getSystemPtr(); }
3434997Sgblack@eecs.umich.edu
3443548Sgblack@eecs.umich.edu    TheISA::Kernel::Statistics *getKernelStats()
3453548Sgblack@eecs.umich.edu    { return actualTC->getKernelStats(); }
3462654SN/A
3478852Sandreas.hansson@arm.com    PortProxy &getPhysProxy() { return actualTC->getPhysProxy(); }
3482521SN/A
3498852Sandreas.hansson@arm.com    FSTranslatingPortProxy &getVirtProxy() { return actualTC->getVirtProxy(); }
3503673Srdreslin@umich.edu
3518706Sandreas.hansson@arm.com    void initMemProxies(ThreadContext *tc) { actualTC->initMemProxies(tc); }
3528799Sgblack@eecs.umich.edu
3538852Sandreas.hansson@arm.com    SETranslatingPortProxy &getMemProxy() { return actualTC->getMemProxy(); }
3542518SN/A
3552680Sktlim@umich.edu    Process *getProcessPtr() { return actualTC->getProcessPtr(); }
3562SN/A
3572680Sktlim@umich.edu    Status status() const { return actualTC->status(); }
358595SN/A
3592680Sktlim@umich.edu    void setStatus(Status new_status) { actualTC->setStatus(new_status); }
3602SN/A
36110407Smitch.hayenga@arm.com    /// Set the status to Active.
36210407Smitch.hayenga@arm.com    void activate() { actualTC->activate(); }
3632SN/A
3642190SN/A    /// Set the status to Suspended.
36510407Smitch.hayenga@arm.com    void suspend() { actualTC->suspend(); }
3662SN/A
3672190SN/A    /// Set the status to Halted.
36810407Smitch.hayenga@arm.com    void halt() { actualTC->halt(); }
369217SN/A
3702680Sktlim@umich.edu    void dumpFuncProfile() { actualTC->dumpFuncProfile(); }
3712190SN/A
3722680Sktlim@umich.edu    void takeOverFrom(ThreadContext *oldContext)
3732680Sktlim@umich.edu    { actualTC->takeOverFrom(oldContext); }
3742190SN/A
3752680Sktlim@umich.edu    void regStats(const std::string &name) { actualTC->regStats(name); }
3762190SN/A
3772680Sktlim@umich.edu    EndQuiesceEvent *getQuiesceEvent() { return actualTC->getQuiesceEvent(); }
3782235SN/A
3792680Sktlim@umich.edu    Tick readLastActivate() { return actualTC->readLastActivate(); }
3802680Sktlim@umich.edu    Tick readLastSuspend() { return actualTC->readLastSuspend(); }
3812254SN/A
3822680Sktlim@umich.edu    void profileClear() { return actualTC->profileClear(); }
3832680Sktlim@umich.edu    void profileSample() { return actualTC->profileSample(); }
3842SN/A
3852190SN/A    // @todo: Do I need this?
3862680Sktlim@umich.edu    void copyArchRegs(ThreadContext *tc) { actualTC->copyArchRegs(tc); }
3872SN/A
3882680Sktlim@umich.edu    void clearArchRegs() { actualTC->clearArchRegs(); }
389716SN/A
3902SN/A    //
3912SN/A    // New accessors for new decoder.
3922SN/A    //
3932SN/A    uint64_t readIntReg(int reg_idx)
3942680Sktlim@umich.edu    { return actualTC->readIntReg(reg_idx); }
3952SN/A
3962455SN/A    FloatReg readFloatReg(int reg_idx)
3972680Sktlim@umich.edu    { return actualTC->readFloatReg(reg_idx); }
3982SN/A
3992455SN/A    FloatRegBits readFloatRegBits(int reg_idx)
4002680Sktlim@umich.edu    { return actualTC->readFloatRegBits(reg_idx); }
4012SN/A
4029920Syasuko.eckert@amd.com    CCReg readCCReg(int reg_idx)
4039920Syasuko.eckert@amd.com    { return actualTC->readCCReg(reg_idx); }
4049920Syasuko.eckert@amd.com
4052SN/A    void setIntReg(int reg_idx, uint64_t val)
4062680Sktlim@umich.edu    { actualTC->setIntReg(reg_idx, val); }
4072SN/A
4082455SN/A    void setFloatReg(int reg_idx, FloatReg val)
4092680Sktlim@umich.edu    { actualTC->setFloatReg(reg_idx, val); }
4102SN/A
4112455SN/A    void setFloatRegBits(int reg_idx, FloatRegBits val)
4122680Sktlim@umich.edu    { actualTC->setFloatRegBits(reg_idx, val); }
4132SN/A
4149920Syasuko.eckert@amd.com    void setCCReg(int reg_idx, CCReg val)
4159920Syasuko.eckert@amd.com    { actualTC->setCCReg(reg_idx, val); }
4169920Syasuko.eckert@amd.com
4177720Sgblack@eecs.umich.edu    TheISA::PCState pcState() { return actualTC->pcState(); }
4182SN/A
4197720Sgblack@eecs.umich.edu    void pcState(const TheISA::PCState &val) { actualTC->pcState(val); }
4202206SN/A
4218733Sgeoffrey.blake@arm.com    void pcStateNoRecord(const TheISA::PCState &val) { actualTC->pcState(val); }
4228733Sgeoffrey.blake@arm.com
4237720Sgblack@eecs.umich.edu    Addr instAddr() { return actualTC->instAddr(); }
4247720Sgblack@eecs.umich.edu    Addr nextInstAddr() { return actualTC->nextInstAddr(); }
4257720Sgblack@eecs.umich.edu    MicroPC microPC() { return actualTC->microPC(); }
4265260Sksewell@umich.edu
4277597Sminkyu.jeong@arm.com    bool readPredicate() { return actualTC->readPredicate(); }
4287597Sminkyu.jeong@arm.com
4297597Sminkyu.jeong@arm.com    void setPredicate(bool val)
4307597Sminkyu.jeong@arm.com    { actualTC->setPredicate(val); }
4317597Sminkyu.jeong@arm.com
43210698Sandreas.hansson@arm.com    MiscReg readMiscRegNoEffect(int misc_reg) const
4334172Ssaidi@eecs.umich.edu    { return actualTC->readMiscRegNoEffect(misc_reg); }
4344172Ssaidi@eecs.umich.edu
4352159SN/A    MiscReg readMiscReg(int misc_reg)
4362680Sktlim@umich.edu    { return actualTC->readMiscReg(misc_reg); }
4372SN/A
4384172Ssaidi@eecs.umich.edu    void setMiscRegNoEffect(int misc_reg, const MiscReg &val)
4394172Ssaidi@eecs.umich.edu    { return actualTC->setMiscRegNoEffect(misc_reg, val); }
4402SN/A
4413468Sgblack@eecs.umich.edu    void setMiscReg(int misc_reg, const MiscReg &val)
4422680Sktlim@umich.edu    { return actualTC->setMiscReg(misc_reg, val); }
4432SN/A
4446313Sgblack@eecs.umich.edu    int flattenIntIndex(int reg)
4456313Sgblack@eecs.umich.edu    { return actualTC->flattenIntIndex(reg); }
4466313Sgblack@eecs.umich.edu
4476313Sgblack@eecs.umich.edu    int flattenFloatIndex(int reg)
4486313Sgblack@eecs.umich.edu    { return actualTC->flattenFloatIndex(reg); }
4496313Sgblack@eecs.umich.edu
4509920Syasuko.eckert@amd.com    int flattenCCIndex(int reg)
4519920Syasuko.eckert@amd.com    { return actualTC->flattenCCIndex(reg); }
4529920Syasuko.eckert@amd.com
45310033SAli.Saidi@ARM.com    int flattenMiscIndex(int reg)
45410033SAli.Saidi@ARM.com    { return actualTC->flattenMiscIndex(reg); }
45510033SAli.Saidi@ARM.com
4562190SN/A    unsigned readStCondFailures()
4572680Sktlim@umich.edu    { return actualTC->readStCondFailures(); }
4582190SN/A
4592190SN/A    void setStCondFailures(unsigned sc_failures)
4602680Sktlim@umich.edu    { actualTC->setStCondFailures(sc_failures); }
4612SN/A
4624111Sgblack@eecs.umich.edu    void syscall(int64_t callnum)
4634111Sgblack@eecs.umich.edu    { actualTC->syscall(callnum); }
4644111Sgblack@eecs.umich.edu
4652680Sktlim@umich.edu    Counter readFuncExeInst() { return actualTC->readFuncExeInst(); }
4669426SAndreas.Sandberg@ARM.com
4679426SAndreas.Sandberg@ARM.com    uint64_t readIntRegFlat(int idx)
4689426SAndreas.Sandberg@ARM.com    { return actualTC->readIntRegFlat(idx); }
4699426SAndreas.Sandberg@ARM.com
4709426SAndreas.Sandberg@ARM.com    void setIntRegFlat(int idx, uint64_t val)
4719426SAndreas.Sandberg@ARM.com    { actualTC->setIntRegFlat(idx, val); }
4729426SAndreas.Sandberg@ARM.com
4739426SAndreas.Sandberg@ARM.com    FloatReg readFloatRegFlat(int idx)
4749426SAndreas.Sandberg@ARM.com    { return actualTC->readFloatRegFlat(idx); }
4759426SAndreas.Sandberg@ARM.com
4769426SAndreas.Sandberg@ARM.com    void setFloatRegFlat(int idx, FloatReg val)
4779426SAndreas.Sandberg@ARM.com    { actualTC->setFloatRegFlat(idx, val); }
4789426SAndreas.Sandberg@ARM.com
4799426SAndreas.Sandberg@ARM.com    FloatRegBits readFloatRegBitsFlat(int idx)
4809426SAndreas.Sandberg@ARM.com    { return actualTC->readFloatRegBitsFlat(idx); }
4819426SAndreas.Sandberg@ARM.com
4829426SAndreas.Sandberg@ARM.com    void setFloatRegBitsFlat(int idx, FloatRegBits val)
4839426SAndreas.Sandberg@ARM.com    { actualTC->setFloatRegBitsFlat(idx, val); }
4849920Syasuko.eckert@amd.com
4859920Syasuko.eckert@amd.com    CCReg readCCRegFlat(int idx)
4869920Syasuko.eckert@amd.com    { return actualTC->readCCRegFlat(idx); }
4879920Syasuko.eckert@amd.com
4889920Syasuko.eckert@amd.com    void setCCRegFlat(int idx, CCReg val)
4899920Syasuko.eckert@amd.com    { actualTC->setCCRegFlat(idx, val); }
4902SN/A};
4912SN/A
4929428SAndreas.Sandberg@ARM.com/** @{ */
4939428SAndreas.Sandberg@ARM.com/**
4949428SAndreas.Sandberg@ARM.com * Thread context serialization helpers
4959428SAndreas.Sandberg@ARM.com *
4969428SAndreas.Sandberg@ARM.com * These helper functions provide a way to the data in a
4979428SAndreas.Sandberg@ARM.com * ThreadContext. They are provided as separate helper function since
4989428SAndreas.Sandberg@ARM.com * implementing them as members of the ThreadContext interface would
4999428SAndreas.Sandberg@ARM.com * be confusing when the ThreadContext is exported via a proxy.
5009428SAndreas.Sandberg@ARM.com */
5019428SAndreas.Sandberg@ARM.com
50210905Sandreas.sandberg@arm.comvoid serialize(ThreadContext &tc, CheckpointOut &cp);
50310905Sandreas.sandberg@arm.comvoid unserialize(ThreadContext &tc, CheckpointIn &cp);
5049428SAndreas.Sandberg@ARM.com
5059428SAndreas.Sandberg@ARM.com/** @} */
5069428SAndreas.Sandberg@ARM.com
5079441SAndreas.Sandberg@ARM.com
5089441SAndreas.Sandberg@ARM.com/**
5099441SAndreas.Sandberg@ARM.com * Copy state between thread contexts in preparation for CPU handover.
5109441SAndreas.Sandberg@ARM.com *
5119441SAndreas.Sandberg@ARM.com * @note This method modifies the old thread contexts as well as the
5129441SAndreas.Sandberg@ARM.com * new thread context. The old thread context will have its quiesce
5139441SAndreas.Sandberg@ARM.com * event descheduled if it is scheduled and its status set to halted.
5149441SAndreas.Sandberg@ARM.com *
5159441SAndreas.Sandberg@ARM.com * @param new_tc Destination ThreadContext.
5169441SAndreas.Sandberg@ARM.com * @param old_tc Source ThreadContext.
5179441SAndreas.Sandberg@ARM.com */
5189441SAndreas.Sandberg@ARM.comvoid takeOverFrom(ThreadContext &new_tc, ThreadContext &old_tc);
5199441SAndreas.Sandberg@ARM.com
5202190SN/A#endif
521