thread_context.hh revision 11627
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 17711627Smichael.lebeane@amd.com /// Quiesce thread context 17811627Smichael.lebeane@amd.com void quiesce(); 17911627Smichael.lebeane@amd.com 18011627Smichael.lebeane@amd.com /// Quiesce, suspend, and schedule activate at resume 18111627Smichael.lebeane@amd.com void quiesceTick(Tick resume); 18211627Smichael.lebeane@amd.com 1832190SN/A virtual void dumpFuncProfile() = 0; 1842159SN/A 1852680Sktlim@umich.edu virtual void takeOverFrom(ThreadContext *old_context) = 0; 1862159SN/A 1872190SN/A virtual void regStats(const std::string &name) = 0; 1882159SN/A 1892313SN/A virtual EndQuiesceEvent *getQuiesceEvent() = 0; 1902235SN/A 1912235SN/A // Not necessarily the best location for these... 1922235SN/A // Having an extra function just to read these is obnoxious 1932235SN/A virtual Tick readLastActivate() = 0; 1942235SN/A virtual Tick readLastSuspend() = 0; 1952254SN/A 1962254SN/A virtual void profileClear() = 0; 1972254SN/A virtual void profileSample() = 0; 1982235SN/A 1992680Sktlim@umich.edu virtual void copyArchRegs(ThreadContext *tc) = 0; 2002159SN/A 2012190SN/A virtual void clearArchRegs() = 0; 2022159SN/A 2032159SN/A // 2042159SN/A // New accessors for new decoder. 2052159SN/A // 2062190SN/A virtual uint64_t readIntReg(int reg_idx) = 0; 2072159SN/A 2082455SN/A virtual FloatReg readFloatReg(int reg_idx) = 0; 2092159SN/A 2102455SN/A virtual FloatRegBits readFloatRegBits(int reg_idx) = 0; 2112159SN/A 2129920Syasuko.eckert@amd.com virtual CCReg readCCReg(int reg_idx) = 0; 2139920Syasuko.eckert@amd.com 2142190SN/A virtual void setIntReg(int reg_idx, uint64_t val) = 0; 2152159SN/A 2162455SN/A virtual void setFloatReg(int reg_idx, FloatReg val) = 0; 2172159SN/A 2182455SN/A virtual void setFloatRegBits(int reg_idx, FloatRegBits val) = 0; 2192455SN/A 2209920Syasuko.eckert@amd.com virtual void setCCReg(int reg_idx, CCReg val) = 0; 2219920Syasuko.eckert@amd.com 2227720Sgblack@eecs.umich.edu virtual TheISA::PCState pcState() = 0; 2232159SN/A 2247720Sgblack@eecs.umich.edu virtual void pcState(const TheISA::PCState &val) = 0; 2252159SN/A 2268733Sgeoffrey.blake@arm.com virtual void pcStateNoRecord(const TheISA::PCState &val) = 0; 2278733Sgeoffrey.blake@arm.com 2287720Sgblack@eecs.umich.edu virtual Addr instAddr() = 0; 2292159SN/A 2307720Sgblack@eecs.umich.edu virtual Addr nextInstAddr() = 0; 2312159SN/A 2327720Sgblack@eecs.umich.edu virtual MicroPC microPC() = 0; 2335260Sksewell@umich.edu 23410698Sandreas.hansson@arm.com virtual MiscReg readMiscRegNoEffect(int misc_reg) const = 0; 2354172Ssaidi@eecs.umich.edu 2362190SN/A virtual MiscReg readMiscReg(int misc_reg) = 0; 2372159SN/A 2384172Ssaidi@eecs.umich.edu virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val) = 0; 2392190SN/A 2403468Sgblack@eecs.umich.edu virtual void setMiscReg(int misc_reg, const MiscReg &val) = 0; 2412190SN/A 2426313Sgblack@eecs.umich.edu virtual int flattenIntIndex(int reg) = 0; 2436313Sgblack@eecs.umich.edu virtual int flattenFloatIndex(int reg) = 0; 2449920Syasuko.eckert@amd.com virtual int flattenCCIndex(int reg) = 0; 24510033SAli.Saidi@ARM.com virtual int flattenMiscIndex(int reg) = 0; 2466313Sgblack@eecs.umich.edu 2476221Snate@binkert.org virtual uint64_t 2486221Snate@binkert.org readRegOtherThread(int misc_reg, ThreadID tid) 2496221Snate@binkert.org { 2506221Snate@binkert.org return 0; 2516221Snate@binkert.org } 2524661Sksewell@umich.edu 2536221Snate@binkert.org virtual void 2546221Snate@binkert.org setRegOtherThread(int misc_reg, const MiscReg &val, ThreadID tid) 2556221Snate@binkert.org { 2566221Snate@binkert.org } 2574661Sksewell@umich.edu 2582235SN/A // Also not necessarily the best location for these two. Hopefully will go 2592235SN/A // away once we decide upon where st cond failures goes. 2602190SN/A virtual unsigned readStCondFailures() = 0; 2612190SN/A 2622190SN/A virtual void setStCondFailures(unsigned sc_failures) = 0; 2632159SN/A 2642235SN/A // Same with st cond failures. 2652190SN/A virtual Counter readFuncExeInst() = 0; 2662834Sksewell@umich.edu 2674111Sgblack@eecs.umich.edu virtual void syscall(int64_t callnum) = 0; 2684111Sgblack@eecs.umich.edu 2692834Sksewell@umich.edu // This function exits the thread context in the CPU and returns 2702834Sksewell@umich.edu // 1 if the CPU has no more active threads (meaning it's OK to exit); 2712834Sksewell@umich.edu // Used in syscall-emulation mode when a thread calls the exit syscall. 2722834Sksewell@umich.edu virtual int exit() { return 1; }; 2732525SN/A 2745217Ssaidi@eecs.umich.edu /** function to compare two thread contexts (for debugging) */ 2755217Ssaidi@eecs.umich.edu static void compare(ThreadContext *one, ThreadContext *two); 2769426SAndreas.Sandberg@ARM.com 2779426SAndreas.Sandberg@ARM.com /** @{ */ 2789426SAndreas.Sandberg@ARM.com /** 2799426SAndreas.Sandberg@ARM.com * Flat register interfaces 2809426SAndreas.Sandberg@ARM.com * 2819426SAndreas.Sandberg@ARM.com * Some architectures have different registers visible in 2829426SAndreas.Sandberg@ARM.com * different modes. Such architectures "flatten" a register (see 2839426SAndreas.Sandberg@ARM.com * flattenIntIndex() and flattenFloatIndex()) to map it into the 2849426SAndreas.Sandberg@ARM.com * gem5 register file. This interface provides a flat interface to 2859426SAndreas.Sandberg@ARM.com * the underlying register file, which allows for example 2869426SAndreas.Sandberg@ARM.com * serialization code to access all registers. 2879426SAndreas.Sandberg@ARM.com */ 2889426SAndreas.Sandberg@ARM.com 2899426SAndreas.Sandberg@ARM.com virtual uint64_t readIntRegFlat(int idx) = 0; 2909426SAndreas.Sandberg@ARM.com virtual void setIntRegFlat(int idx, uint64_t val) = 0; 2919426SAndreas.Sandberg@ARM.com 2929426SAndreas.Sandberg@ARM.com virtual FloatReg readFloatRegFlat(int idx) = 0; 2939426SAndreas.Sandberg@ARM.com virtual void setFloatRegFlat(int idx, FloatReg val) = 0; 2949426SAndreas.Sandberg@ARM.com 2959426SAndreas.Sandberg@ARM.com virtual FloatRegBits readFloatRegBitsFlat(int idx) = 0; 2969426SAndreas.Sandberg@ARM.com virtual void setFloatRegBitsFlat(int idx, FloatRegBits val) = 0; 2979426SAndreas.Sandberg@ARM.com 2989920Syasuko.eckert@amd.com virtual CCReg readCCRegFlat(int idx) = 0; 2999920Syasuko.eckert@amd.com virtual void setCCRegFlat(int idx, CCReg val) = 0; 3009426SAndreas.Sandberg@ARM.com /** @} */ 3019426SAndreas.Sandberg@ARM.com 3022159SN/A}; 3032159SN/A 3042682Sktlim@umich.edu/** 3052682Sktlim@umich.edu * ProxyThreadContext class that provides a way to implement a 3062682Sktlim@umich.edu * ThreadContext without having to derive from it. ThreadContext is an 3072682Sktlim@umich.edu * abstract class, so anything that derives from it and uses its 3082682Sktlim@umich.edu * interface will pay the overhead of virtual function calls. This 3092682Sktlim@umich.edu * class is created to enable a user-defined Thread object to be used 3102682Sktlim@umich.edu * wherever ThreadContexts are used, without paying the overhead of 3112682Sktlim@umich.edu * virtual function calls when it is used by itself. See 3122682Sktlim@umich.edu * simple_thread.hh for an example of this. 3132682Sktlim@umich.edu */ 3142680Sktlim@umich.edutemplate <class TC> 3152680Sktlim@umich.educlass ProxyThreadContext : public ThreadContext 3162190SN/A{ 3172190SN/A public: 3182680Sktlim@umich.edu ProxyThreadContext(TC *actual_tc) 3192680Sktlim@umich.edu { actualTC = actual_tc; } 3202159SN/A 3212190SN/A private: 3222680Sktlim@umich.edu TC *actualTC; 3232SN/A 3242SN/A public: 3252SN/A 3262680Sktlim@umich.edu BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); } 3272SN/A 32810110Sandreas.hansson@arm.com int cpuId() const { return actualTC->cpuId(); } 3292SN/A 33010190Sakash.bagdia@arm.com uint32_t socketId() const { return actualTC->socketId(); } 33110190Sakash.bagdia@arm.com 33210110Sandreas.hansson@arm.com int threadId() const { return actualTC->threadId(); } 3335715Shsul@eecs.umich.edu 33410110Sandreas.hansson@arm.com void setThreadId(int id) { actualTC->setThreadId(id); } 3355714Shsul@eecs.umich.edu 33610110Sandreas.hansson@arm.com int contextId() const { return actualTC->contextId(); } 3375714Shsul@eecs.umich.edu 3385714Shsul@eecs.umich.edu void setContextId(int id) { actualTC->setContextId(id); } 3395714Shsul@eecs.umich.edu 3406022Sgblack@eecs.umich.edu TheISA::TLB *getITBPtr() { return actualTC->getITBPtr(); } 3411917SN/A 3426022Sgblack@eecs.umich.edu TheISA::TLB *getDTBPtr() { return actualTC->getDTBPtr(); } 3432521SN/A 3448887Sgeoffrey.blake@arm.com CheckerCPU *getCheckerCpuPtr() { return actualTC->getCheckerCpuPtr(); } 3458733Sgeoffrey.blake@arm.com 3469020Sgblack@eecs.umich.edu TheISA::Decoder *getDecoderPtr() { return actualTC->getDecoderPtr(); } 3478541Sgblack@eecs.umich.edu 3484997Sgblack@eecs.umich.edu System *getSystemPtr() { return actualTC->getSystemPtr(); } 3494997Sgblack@eecs.umich.edu 3503548Sgblack@eecs.umich.edu TheISA::Kernel::Statistics *getKernelStats() 3513548Sgblack@eecs.umich.edu { return actualTC->getKernelStats(); } 3522654SN/A 3538852Sandreas.hansson@arm.com PortProxy &getPhysProxy() { return actualTC->getPhysProxy(); } 3542521SN/A 3558852Sandreas.hansson@arm.com FSTranslatingPortProxy &getVirtProxy() { return actualTC->getVirtProxy(); } 3563673Srdreslin@umich.edu 3578706Sandreas.hansson@arm.com void initMemProxies(ThreadContext *tc) { actualTC->initMemProxies(tc); } 3588799Sgblack@eecs.umich.edu 3598852Sandreas.hansson@arm.com SETranslatingPortProxy &getMemProxy() { return actualTC->getMemProxy(); } 3602518SN/A 3612680Sktlim@umich.edu Process *getProcessPtr() { return actualTC->getProcessPtr(); } 3622SN/A 3632680Sktlim@umich.edu Status status() const { return actualTC->status(); } 364595SN/A 3652680Sktlim@umich.edu void setStatus(Status new_status) { actualTC->setStatus(new_status); } 3662SN/A 36710407Smitch.hayenga@arm.com /// Set the status to Active. 36810407Smitch.hayenga@arm.com void activate() { actualTC->activate(); } 3692SN/A 3702190SN/A /// Set the status to Suspended. 37110407Smitch.hayenga@arm.com void suspend() { actualTC->suspend(); } 3722SN/A 3732190SN/A /// Set the status to Halted. 37410407Smitch.hayenga@arm.com void halt() { actualTC->halt(); } 375217SN/A 37611627Smichael.lebeane@amd.com /// Quiesce thread context 37711627Smichael.lebeane@amd.com void quiesce() { actualTC->quiesce(); } 37811627Smichael.lebeane@amd.com 37911627Smichael.lebeane@amd.com /// Quiesce, suspend, and schedule activate at resume 38011627Smichael.lebeane@amd.com void quiesceTick(Tick resume) { actualTC->quiesceTick(resume); } 38111627Smichael.lebeane@amd.com 3822680Sktlim@umich.edu void dumpFuncProfile() { actualTC->dumpFuncProfile(); } 3832190SN/A 3842680Sktlim@umich.edu void takeOverFrom(ThreadContext *oldContext) 3852680Sktlim@umich.edu { actualTC->takeOverFrom(oldContext); } 3862190SN/A 3872680Sktlim@umich.edu void regStats(const std::string &name) { actualTC->regStats(name); } 3882190SN/A 3892680Sktlim@umich.edu EndQuiesceEvent *getQuiesceEvent() { return actualTC->getQuiesceEvent(); } 3902235SN/A 3912680Sktlim@umich.edu Tick readLastActivate() { return actualTC->readLastActivate(); } 3922680Sktlim@umich.edu Tick readLastSuspend() { return actualTC->readLastSuspend(); } 3932254SN/A 3942680Sktlim@umich.edu void profileClear() { return actualTC->profileClear(); } 3952680Sktlim@umich.edu void profileSample() { return actualTC->profileSample(); } 3962SN/A 3972190SN/A // @todo: Do I need this? 3982680Sktlim@umich.edu void copyArchRegs(ThreadContext *tc) { actualTC->copyArchRegs(tc); } 3992SN/A 4002680Sktlim@umich.edu void clearArchRegs() { actualTC->clearArchRegs(); } 401716SN/A 4022SN/A // 4032SN/A // New accessors for new decoder. 4042SN/A // 4052SN/A uint64_t readIntReg(int reg_idx) 4062680Sktlim@umich.edu { return actualTC->readIntReg(reg_idx); } 4072SN/A 4082455SN/A FloatReg readFloatReg(int reg_idx) 4092680Sktlim@umich.edu { return actualTC->readFloatReg(reg_idx); } 4102SN/A 4112455SN/A FloatRegBits readFloatRegBits(int reg_idx) 4122680Sktlim@umich.edu { return actualTC->readFloatRegBits(reg_idx); } 4132SN/A 4149920Syasuko.eckert@amd.com CCReg readCCReg(int reg_idx) 4159920Syasuko.eckert@amd.com { return actualTC->readCCReg(reg_idx); } 4169920Syasuko.eckert@amd.com 4172SN/A void setIntReg(int reg_idx, uint64_t val) 4182680Sktlim@umich.edu { actualTC->setIntReg(reg_idx, val); } 4192SN/A 4202455SN/A void setFloatReg(int reg_idx, FloatReg val) 4212680Sktlim@umich.edu { actualTC->setFloatReg(reg_idx, val); } 4222SN/A 4232455SN/A void setFloatRegBits(int reg_idx, FloatRegBits val) 4242680Sktlim@umich.edu { actualTC->setFloatRegBits(reg_idx, val); } 4252SN/A 4269920Syasuko.eckert@amd.com void setCCReg(int reg_idx, CCReg val) 4279920Syasuko.eckert@amd.com { actualTC->setCCReg(reg_idx, val); } 4289920Syasuko.eckert@amd.com 4297720Sgblack@eecs.umich.edu TheISA::PCState pcState() { return actualTC->pcState(); } 4302SN/A 4317720Sgblack@eecs.umich.edu void pcState(const TheISA::PCState &val) { actualTC->pcState(val); } 4322206SN/A 4338733Sgeoffrey.blake@arm.com void pcStateNoRecord(const TheISA::PCState &val) { actualTC->pcState(val); } 4348733Sgeoffrey.blake@arm.com 4357720Sgblack@eecs.umich.edu Addr instAddr() { return actualTC->instAddr(); } 4367720Sgblack@eecs.umich.edu Addr nextInstAddr() { return actualTC->nextInstAddr(); } 4377720Sgblack@eecs.umich.edu MicroPC microPC() { return actualTC->microPC(); } 4385260Sksewell@umich.edu 4397597Sminkyu.jeong@arm.com bool readPredicate() { return actualTC->readPredicate(); } 4407597Sminkyu.jeong@arm.com 4417597Sminkyu.jeong@arm.com void setPredicate(bool val) 4427597Sminkyu.jeong@arm.com { actualTC->setPredicate(val); } 4437597Sminkyu.jeong@arm.com 44410698Sandreas.hansson@arm.com MiscReg readMiscRegNoEffect(int misc_reg) const 4454172Ssaidi@eecs.umich.edu { return actualTC->readMiscRegNoEffect(misc_reg); } 4464172Ssaidi@eecs.umich.edu 4472159SN/A MiscReg readMiscReg(int misc_reg) 4482680Sktlim@umich.edu { return actualTC->readMiscReg(misc_reg); } 4492SN/A 4504172Ssaidi@eecs.umich.edu void setMiscRegNoEffect(int misc_reg, const MiscReg &val) 4514172Ssaidi@eecs.umich.edu { return actualTC->setMiscRegNoEffect(misc_reg, val); } 4522SN/A 4533468Sgblack@eecs.umich.edu void setMiscReg(int misc_reg, const MiscReg &val) 4542680Sktlim@umich.edu { return actualTC->setMiscReg(misc_reg, val); } 4552SN/A 4566313Sgblack@eecs.umich.edu int flattenIntIndex(int reg) 4576313Sgblack@eecs.umich.edu { return actualTC->flattenIntIndex(reg); } 4586313Sgblack@eecs.umich.edu 4596313Sgblack@eecs.umich.edu int flattenFloatIndex(int reg) 4606313Sgblack@eecs.umich.edu { return actualTC->flattenFloatIndex(reg); } 4616313Sgblack@eecs.umich.edu 4629920Syasuko.eckert@amd.com int flattenCCIndex(int reg) 4639920Syasuko.eckert@amd.com { return actualTC->flattenCCIndex(reg); } 4649920Syasuko.eckert@amd.com 46510033SAli.Saidi@ARM.com int flattenMiscIndex(int reg) 46610033SAli.Saidi@ARM.com { return actualTC->flattenMiscIndex(reg); } 46710033SAli.Saidi@ARM.com 4682190SN/A unsigned readStCondFailures() 4692680Sktlim@umich.edu { return actualTC->readStCondFailures(); } 4702190SN/A 4712190SN/A void setStCondFailures(unsigned sc_failures) 4722680Sktlim@umich.edu { actualTC->setStCondFailures(sc_failures); } 4732SN/A 4744111Sgblack@eecs.umich.edu void syscall(int64_t callnum) 4754111Sgblack@eecs.umich.edu { actualTC->syscall(callnum); } 4764111Sgblack@eecs.umich.edu 4772680Sktlim@umich.edu Counter readFuncExeInst() { return actualTC->readFuncExeInst(); } 4789426SAndreas.Sandberg@ARM.com 4799426SAndreas.Sandberg@ARM.com uint64_t readIntRegFlat(int idx) 4809426SAndreas.Sandberg@ARM.com { return actualTC->readIntRegFlat(idx); } 4819426SAndreas.Sandberg@ARM.com 4829426SAndreas.Sandberg@ARM.com void setIntRegFlat(int idx, uint64_t val) 4839426SAndreas.Sandberg@ARM.com { actualTC->setIntRegFlat(idx, val); } 4849426SAndreas.Sandberg@ARM.com 4859426SAndreas.Sandberg@ARM.com FloatReg readFloatRegFlat(int idx) 4869426SAndreas.Sandberg@ARM.com { return actualTC->readFloatRegFlat(idx); } 4879426SAndreas.Sandberg@ARM.com 4889426SAndreas.Sandberg@ARM.com void setFloatRegFlat(int idx, FloatReg val) 4899426SAndreas.Sandberg@ARM.com { actualTC->setFloatRegFlat(idx, val); } 4909426SAndreas.Sandberg@ARM.com 4919426SAndreas.Sandberg@ARM.com FloatRegBits readFloatRegBitsFlat(int idx) 4929426SAndreas.Sandberg@ARM.com { return actualTC->readFloatRegBitsFlat(idx); } 4939426SAndreas.Sandberg@ARM.com 4949426SAndreas.Sandberg@ARM.com void setFloatRegBitsFlat(int idx, FloatRegBits val) 4959426SAndreas.Sandberg@ARM.com { actualTC->setFloatRegBitsFlat(idx, val); } 4969920Syasuko.eckert@amd.com 4979920Syasuko.eckert@amd.com CCReg readCCRegFlat(int idx) 4989920Syasuko.eckert@amd.com { return actualTC->readCCRegFlat(idx); } 4999920Syasuko.eckert@amd.com 5009920Syasuko.eckert@amd.com void setCCRegFlat(int idx, CCReg val) 5019920Syasuko.eckert@amd.com { actualTC->setCCRegFlat(idx, val); } 5022SN/A}; 5032SN/A 5049428SAndreas.Sandberg@ARM.com/** @{ */ 5059428SAndreas.Sandberg@ARM.com/** 5069428SAndreas.Sandberg@ARM.com * Thread context serialization helpers 5079428SAndreas.Sandberg@ARM.com * 5089428SAndreas.Sandberg@ARM.com * These helper functions provide a way to the data in a 5099428SAndreas.Sandberg@ARM.com * ThreadContext. They are provided as separate helper function since 5109428SAndreas.Sandberg@ARM.com * implementing them as members of the ThreadContext interface would 5119428SAndreas.Sandberg@ARM.com * be confusing when the ThreadContext is exported via a proxy. 5129428SAndreas.Sandberg@ARM.com */ 5139428SAndreas.Sandberg@ARM.com 51410905Sandreas.sandberg@arm.comvoid serialize(ThreadContext &tc, CheckpointOut &cp); 51510905Sandreas.sandberg@arm.comvoid unserialize(ThreadContext &tc, CheckpointIn &cp); 5169428SAndreas.Sandberg@ARM.com 5179428SAndreas.Sandberg@ARM.com/** @} */ 5189428SAndreas.Sandberg@ARM.com 5199441SAndreas.Sandberg@ARM.com 5209441SAndreas.Sandberg@ARM.com/** 5219441SAndreas.Sandberg@ARM.com * Copy state between thread contexts in preparation for CPU handover. 5229441SAndreas.Sandberg@ARM.com * 5239441SAndreas.Sandberg@ARM.com * @note This method modifies the old thread contexts as well as the 5249441SAndreas.Sandberg@ARM.com * new thread context. The old thread context will have its quiesce 5259441SAndreas.Sandberg@ARM.com * event descheduled if it is scheduled and its status set to halted. 5269441SAndreas.Sandberg@ARM.com * 5279441SAndreas.Sandberg@ARM.com * @param new_tc Destination ThreadContext. 5289441SAndreas.Sandberg@ARM.com * @param old_tc Source ThreadContext. 5299441SAndreas.Sandberg@ARM.com */ 5309441SAndreas.Sandberg@ARM.comvoid takeOverFrom(ThreadContext &new_tc, ThreadContext &old_tc); 5319441SAndreas.Sandberg@ARM.com 5322190SN/A#endif 533