thread_context.hh revision 13905
12330SN/A/*
213610Sgiacomo.gabrielli@arm.com * Copyright (c) 2011-2012, 2016-2018 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 *
152330SN/A * Copyright (c) 2006 The Regents of The University of Michigan
162330SN/A * All rights reserved.
172330SN/A *
182330SN/A * Redistribution and use in source and binary forms, with or without
192330SN/A * modification, are permitted provided that the following conditions are
202330SN/A * met: redistributions of source code must retain the above copyright
212330SN/A * notice, this list of conditions and the following disclaimer;
222330SN/A * redistributions in binary form must reproduce the above copyright
232330SN/A * notice, this list of conditions and the following disclaimer in the
242330SN/A * documentation and/or other materials provided with the distribution;
252330SN/A * neither the name of the copyright holders nor the names of its
262330SN/A * contributors may be used to endorse or promote products derived from
272330SN/A * this software without specific prior written permission.
282330SN/A *
292330SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
302330SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
312330SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
322330SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
332330SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
342330SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
352330SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
362330SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
372330SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
382330SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
392330SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402689Sktlim@umich.edu *
412689Sktlim@umich.edu * Authors: Kevin Lim
422330SN/A */
432330SN/A
442683Sktlim@umich.edu#ifndef __CPU_CHECKER_THREAD_CONTEXT_HH__
452683Sktlim@umich.edu#define __CPU_CHECKER_THREAD_CONTEXT_HH__
462315SN/A
472972Sgblack@eecs.umich.edu#include "arch/types.hh"
486658Snate@binkert.org#include "config/the_isa.hh"
492315SN/A#include "cpu/checker/cpu.hh"
502683Sktlim@umich.edu#include "cpu/simple_thread.hh"
512680SN/A#include "cpu/thread_context.hh"
528733Sgeoffrey.blake@arm.com#include "debug/Checker.hh"
532315SN/A
542315SN/Aclass EndQuiesceEvent;
5513905Sgabeblack@google.comnamespace Kernel {
5613905Sgabeblack@google.com    class Statistics;
5713905Sgabeblack@google.com};
583548Sgblack@eecs.umich.edunamespace TheISA {
599020Sgblack@eecs.umich.edu    class Decoder;
602330SN/A};
612315SN/A
622350SN/A/**
632680SN/A * Derived ThreadContext class for use with the Checker.  The template
642680SN/A * parameter is the ThreadContext class used by the specific CPU being
652683Sktlim@umich.edu * verified.  This CheckerThreadContext is then used by the main CPU
662683Sktlim@umich.edu * in place of its usual ThreadContext class.  It handles updating the
672683Sktlim@umich.edu * checker's state any time state is updated externally through the
682683Sktlim@umich.edu * ThreadContext.
692350SN/A */
702680SN/Atemplate <class TC>
712680SN/Aclass CheckerThreadContext : public ThreadContext
722315SN/A{
732315SN/A  public:
742680SN/A    CheckerThreadContext(TC *actual_tc,
752683Sktlim@umich.edu                         CheckerCPU *checker_cpu)
762683Sktlim@umich.edu        : actualTC(actual_tc), checkerTC(checker_cpu->thread),
772330SN/A          checkerCPU(checker_cpu)
782315SN/A    { }
792315SN/A
802315SN/A  private:
812683Sktlim@umich.edu    /** The main CPU's ThreadContext, or class that implements the
822683Sktlim@umich.edu     * ThreadContext interface. */
832680SN/A    TC *actualTC;
842683Sktlim@umich.edu    /** The checker's own SimpleThread. Will be updated any time
852683Sktlim@umich.edu     * anything uses this ThreadContext to externally update a
862683Sktlim@umich.edu     * thread's state. */
872683Sktlim@umich.edu    SimpleThread *checkerTC;
882683Sktlim@umich.edu    /** Pointer to the checker CPU. */
892315SN/A    CheckerCPU *checkerCPU;
902315SN/A
912315SN/A  public:
922315SN/A
9313628SAndrea.Mondelli@ucf.edu    BaseCPU *getCpuPtr() override { return actualTC->getCpuPtr(); }
942315SN/A
9513628SAndrea.Mondelli@ucf.edu    uint32_t socketId() const override { return actualTC->socketId(); }
9610190Sakash.bagdia@arm.com
9713628SAndrea.Mondelli@ucf.edu    int cpuId() const override { return actualTC->cpuId(); }
988733Sgeoffrey.blake@arm.com
9913628SAndrea.Mondelli@ucf.edu    ContextID contextId() const override { return actualTC->contextId(); }
1008733Sgeoffrey.blake@arm.com
10113865Sgabeblack@google.com    void
10213865Sgabeblack@google.com    setContextId(ContextID id) override
1032315SN/A    {
1048733Sgeoffrey.blake@arm.com       actualTC->setContextId(id);
1058733Sgeoffrey.blake@arm.com       checkerTC->setContextId(id);
1062315SN/A    }
1072315SN/A
1088733Sgeoffrey.blake@arm.com    /** Returns this thread's ID number. */
10913628SAndrea.Mondelli@ucf.edu    int threadId() const override { return actualTC->threadId(); }
11013865Sgabeblack@google.com    void
11113865Sgabeblack@google.com    setThreadId(int id) override
1128733Sgeoffrey.blake@arm.com    {
1138733Sgeoffrey.blake@arm.com        checkerTC->setThreadId(id);
1148733Sgeoffrey.blake@arm.com        actualTC->setThreadId(id);
1158733Sgeoffrey.blake@arm.com    }
1162315SN/A
11713628SAndrea.Mondelli@ucf.edu    BaseTLB *getITBPtr() override { return actualTC->getITBPtr(); }
1184997Sgblack@eecs.umich.edu
11913628SAndrea.Mondelli@ucf.edu    BaseTLB *getDTBPtr() override { return actualTC->getDTBPtr(); }
1204997Sgblack@eecs.umich.edu
12113865Sgabeblack@google.com    CheckerCPU *
12213865Sgabeblack@google.com    getCheckerCpuPtr() override
1238887Sgeoffrey.blake@arm.com    {
1248887Sgeoffrey.blake@arm.com        return checkerCPU;
1258887Sgeoffrey.blake@arm.com    }
1268733Sgeoffrey.blake@arm.com
12713693Sgiacomo.gabrielli@arm.com    TheISA::ISA *getIsaPtr() override { return actualTC->getIsaPtr(); }
12813693Sgiacomo.gabrielli@arm.com
12913865Sgabeblack@google.com    TheISA::Decoder *
13013865Sgabeblack@google.com    getDecoderPtr() override
13113865Sgabeblack@google.com    {
13213628SAndrea.Mondelli@ucf.edu        return actualTC->getDecoderPtr();
13313628SAndrea.Mondelli@ucf.edu    }
1348733Sgeoffrey.blake@arm.com
13513628SAndrea.Mondelli@ucf.edu    System *getSystemPtr() override { return actualTC->getSystemPtr(); }
1362315SN/A
13713905Sgabeblack@google.com    ::Kernel::Statistics *
13813865Sgabeblack@google.com    getKernelStats() override
13913865Sgabeblack@google.com    {
14013865Sgabeblack@google.com        return actualTC->getKernelStats();
14113865Sgabeblack@google.com    }
1422690Sktlim@umich.edu
14313628SAndrea.Mondelli@ucf.edu    Process *getProcessPtr() override { return actualTC->getProcessPtr(); }
1447679Sgblack@eecs.umich.edu
14513628SAndrea.Mondelli@ucf.edu    void setProcessPtr(Process *p) override { actualTC->setProcessPtr(p); }
14611886Sbrandon.potter@amd.com
14713628SAndrea.Mondelli@ucf.edu    PortProxy &getPhysProxy() override { return actualTC->getPhysProxy(); }
1482690Sktlim@umich.edu
14913865Sgabeblack@google.com    FSTranslatingPortProxy &
15013865Sgabeblack@google.com    getVirtProxy() override
15113865Sgabeblack@google.com    {
15213865Sgabeblack@google.com        return actualTC->getVirtProxy();
15313865Sgabeblack@google.com    }
1548733Sgeoffrey.blake@arm.com
15513865Sgabeblack@google.com    void
15613865Sgabeblack@google.com    initMemProxies(ThreadContext *tc) override
15713865Sgabeblack@google.com    {
15813865Sgabeblack@google.com        actualTC->initMemProxies(tc);
15913865Sgabeblack@google.com    }
1608733Sgeoffrey.blake@arm.com
16113865Sgabeblack@google.com    void
16213865Sgabeblack@google.com    connectMemPorts(ThreadContext *tc)
1638733Sgeoffrey.blake@arm.com    {
1648733Sgeoffrey.blake@arm.com        actualTC->connectMemPorts(tc);
1658733Sgeoffrey.blake@arm.com    }
1668809Sgblack@eecs.umich.edu
16713865Sgabeblack@google.com    SETranslatingPortProxy &
16813865Sgabeblack@google.com    getMemProxy() override
16913865Sgabeblack@google.com    {
17013628SAndrea.Mondelli@ucf.edu        return actualTC->getMemProxy();
17113628SAndrea.Mondelli@ucf.edu    }
1722690Sktlim@umich.edu
1738733Sgeoffrey.blake@arm.com    /** Executes a syscall in SE mode. */
17413865Sgabeblack@google.com    void
17513865Sgabeblack@google.com    syscall(int64_t callnum, Fault *fault) override
17613865Sgabeblack@google.com    {
17713865Sgabeblack@google.com        return actualTC->syscall(callnum, fault);
17813865Sgabeblack@google.com    }
1792315SN/A
18013628SAndrea.Mondelli@ucf.edu    Status status() const override { return actualTC->status(); }
1812315SN/A
18213865Sgabeblack@google.com    void
18313865Sgabeblack@google.com    setStatus(Status new_status) override
1842330SN/A    {
1852680SN/A        actualTC->setStatus(new_status);
1862680SN/A        checkerTC->setStatus(new_status);
1872330SN/A    }
1882315SN/A
18910407Smitch.hayenga@arm.com    /// Set the status to Active.
19013628SAndrea.Mondelli@ucf.edu    void activate() override { actualTC->activate(); }
1912315SN/A
1922315SN/A    /// Set the status to Suspended.
19313865Sgabeblack@google.com    void suspend() override { actualTC->suspend(); }
1942315SN/A
1952315SN/A    /// Set the status to Halted.
19613865Sgabeblack@google.com    void halt() override { actualTC->halt(); }
1972315SN/A
19813865Sgabeblack@google.com    void dumpFuncProfile() override { actualTC->dumpFuncProfile(); }
1992315SN/A
20013865Sgabeblack@google.com    void
20113865Sgabeblack@google.com    takeOverFrom(ThreadContext *oldContext) override
2022315SN/A    {
2032680SN/A        actualTC->takeOverFrom(oldContext);
2043225Sktlim@umich.edu        checkerTC->copyState(oldContext);
2052315SN/A    }
2062315SN/A
20713865Sgabeblack@google.com    void
20813865Sgabeblack@google.com    regStats(const std::string &name) override
2098733Sgeoffrey.blake@arm.com    {
2108733Sgeoffrey.blake@arm.com        actualTC->regStats(name);
2118733Sgeoffrey.blake@arm.com        checkerTC->regStats(name);
2128733Sgeoffrey.blake@arm.com    }
2132315SN/A
21413865Sgabeblack@google.com    EndQuiesceEvent *
21513865Sgabeblack@google.com    getQuiesceEvent() override
21613865Sgabeblack@google.com    {
21713628SAndrea.Mondelli@ucf.edu        return actualTC->getQuiesceEvent();
21813628SAndrea.Mondelli@ucf.edu    }
2192315SN/A
22013865Sgabeblack@google.com    Tick readLastActivate() override { return actualTC->readLastActivate(); }
22113865Sgabeblack@google.com    Tick readLastSuspend() override { return actualTC->readLastSuspend(); }
2222315SN/A
22313865Sgabeblack@google.com    void profileClear() override { return actualTC->profileClear(); }
22413865Sgabeblack@google.com    void profileSample() override { return actualTC->profileSample(); }
2252315SN/A
2262315SN/A    // @todo: Do I need this?
22713865Sgabeblack@google.com    void
22813865Sgabeblack@google.com    copyArchRegs(ThreadContext *tc) override
2292315SN/A    {
2302680SN/A        actualTC->copyArchRegs(tc);
2312680SN/A        checkerTC->copyArchRegs(tc);
2322315SN/A    }
2332315SN/A
23413865Sgabeblack@google.com    void
23513865Sgabeblack@google.com    clearArchRegs() override
2362315SN/A    {
2372680SN/A        actualTC->clearArchRegs();
2382680SN/A        checkerTC->clearArchRegs();
2392315SN/A    }
2402315SN/A
2412315SN/A    //
2422315SN/A    // New accessors for new decoder.
2432315SN/A    //
24413865Sgabeblack@google.com    RegVal
24513865Sgabeblack@google.com    readIntReg(RegIndex reg_idx) const override
24613865Sgabeblack@google.com    {
24713628SAndrea.Mondelli@ucf.edu        return actualTC->readIntReg(reg_idx);
24813628SAndrea.Mondelli@ucf.edu    }
2492315SN/A
25013557Sgabeblack@google.com    RegVal
25113865Sgabeblack@google.com    readFloatReg(RegIndex reg_idx) const override
25213557Sgabeblack@google.com    {
25313611Sgabeblack@google.com        return actualTC->readFloatReg(reg_idx);
25413557Sgabeblack@google.com    }
2552315SN/A
25613865Sgabeblack@google.com    const VecRegContainer &
25713865Sgabeblack@google.com    readVecReg (const RegId &reg) const override
25813865Sgabeblack@google.com    {
25913865Sgabeblack@google.com        return actualTC->readVecReg(reg);
26013865Sgabeblack@google.com    }
26112109SRekai.GonzalezAlberquilla@arm.com
26212109SRekai.GonzalezAlberquilla@arm.com    /**
26312109SRekai.GonzalezAlberquilla@arm.com     * Read vector register for modification, hierarchical indexing.
26412109SRekai.GonzalezAlberquilla@arm.com     */
26513865Sgabeblack@google.com    VecRegContainer &
26613865Sgabeblack@google.com    getWritableVecReg (const RegId &reg) override
26713865Sgabeblack@google.com    {
26813865Sgabeblack@google.com        return actualTC->getWritableVecReg(reg);
26913865Sgabeblack@google.com    }
27012109SRekai.GonzalezAlberquilla@arm.com
27112109SRekai.GonzalezAlberquilla@arm.com    /** Vector Register Lane Interfaces. */
27212109SRekai.GonzalezAlberquilla@arm.com    /** @{ */
27312109SRekai.GonzalezAlberquilla@arm.com    /** Reads source vector 8bit operand. */
27412109SRekai.GonzalezAlberquilla@arm.com    ConstVecLane8
27513865Sgabeblack@google.com    readVec8BitLaneReg(const RegId &reg) const override
27613865Sgabeblack@google.com    {
27713865Sgabeblack@google.com        return actualTC->readVec8BitLaneReg(reg);
27813865Sgabeblack@google.com    }
27912109SRekai.GonzalezAlberquilla@arm.com
28012109SRekai.GonzalezAlberquilla@arm.com    /** Reads source vector 16bit operand. */
28112109SRekai.GonzalezAlberquilla@arm.com    ConstVecLane16
28213865Sgabeblack@google.com    readVec16BitLaneReg(const RegId &reg) const override
28313865Sgabeblack@google.com    {
28413865Sgabeblack@google.com        return actualTC->readVec16BitLaneReg(reg);
28513865Sgabeblack@google.com    }
28612109SRekai.GonzalezAlberquilla@arm.com
28712109SRekai.GonzalezAlberquilla@arm.com    /** Reads source vector 32bit operand. */
28812109SRekai.GonzalezAlberquilla@arm.com    ConstVecLane32
28913865Sgabeblack@google.com    readVec32BitLaneReg(const RegId &reg) const override
29013865Sgabeblack@google.com    {
29113865Sgabeblack@google.com        return actualTC->readVec32BitLaneReg(reg);
29213865Sgabeblack@google.com    }
29312109SRekai.GonzalezAlberquilla@arm.com
29412109SRekai.GonzalezAlberquilla@arm.com    /** Reads source vector 64bit operand. */
29512109SRekai.GonzalezAlberquilla@arm.com    ConstVecLane64
29613865Sgabeblack@google.com    readVec64BitLaneReg(const RegId &reg) const override
29713865Sgabeblack@google.com    {
29813865Sgabeblack@google.com        return actualTC->readVec64BitLaneReg(reg);
29913865Sgabeblack@google.com    }
30012109SRekai.GonzalezAlberquilla@arm.com
30112109SRekai.GonzalezAlberquilla@arm.com    /** Write a lane of the destination vector register. */
30213865Sgabeblack@google.com    virtual void
30313865Sgabeblack@google.com    setVecLane(const RegId &reg,
30413865Sgabeblack@google.com               const LaneData<LaneSize::Byte> &val) override
30513865Sgabeblack@google.com    {
30613865Sgabeblack@google.com        return actualTC->setVecLane(reg, val);
30713865Sgabeblack@google.com    }
30813865Sgabeblack@google.com    virtual void
30913865Sgabeblack@google.com    setVecLane(const RegId &reg,
31013865Sgabeblack@google.com               const LaneData<LaneSize::TwoByte> &val) override
31113865Sgabeblack@google.com    {
31213865Sgabeblack@google.com        return actualTC->setVecLane(reg, val);
31313865Sgabeblack@google.com    }
31413865Sgabeblack@google.com    virtual void
31513865Sgabeblack@google.com    setVecLane(const RegId &reg,
31613865Sgabeblack@google.com               const LaneData<LaneSize::FourByte> &val) override
31713865Sgabeblack@google.com    {
31813865Sgabeblack@google.com        return actualTC->setVecLane(reg, val);
31913865Sgabeblack@google.com    }
32013865Sgabeblack@google.com    virtual void
32113865Sgabeblack@google.com    setVecLane(const RegId &reg,
32213865Sgabeblack@google.com               const LaneData<LaneSize::EightByte> &val) override
32313865Sgabeblack@google.com    {
32413865Sgabeblack@google.com        return actualTC->setVecLane(reg, val);
32513865Sgabeblack@google.com    }
32612109SRekai.GonzalezAlberquilla@arm.com    /** @} */
32712109SRekai.GonzalezAlberquilla@arm.com
32813865Sgabeblack@google.com    const VecElem &
32913865Sgabeblack@google.com    readVecElem(const RegId& reg) const override
33013865Sgabeblack@google.com    {
33113865Sgabeblack@google.com        return actualTC->readVecElem(reg);
33213865Sgabeblack@google.com    }
33312109SRekai.GonzalezAlberquilla@arm.com
33413865Sgabeblack@google.com    const VecPredRegContainer &
33513865Sgabeblack@google.com    readVecPredReg(const RegId& reg) const override
33613865Sgabeblack@google.com    {
33713865Sgabeblack@google.com        return actualTC->readVecPredReg(reg);
33813865Sgabeblack@google.com    }
33913610Sgiacomo.gabrielli@arm.com
34013865Sgabeblack@google.com    VecPredRegContainer &
34113865Sgabeblack@google.com    getWritableVecPredReg(const RegId& reg) override
34213865Sgabeblack@google.com    {
34313865Sgabeblack@google.com        return actualTC->getWritableVecPredReg(reg);
34413865Sgabeblack@google.com    }
34513610Sgiacomo.gabrielli@arm.com
34613865Sgabeblack@google.com    RegVal
34713865Sgabeblack@google.com    readCCReg(RegIndex reg_idx) const override
34813865Sgabeblack@google.com    {
34913865Sgabeblack@google.com        return actualTC->readCCReg(reg_idx);
35013865Sgabeblack@google.com    }
3519920Syasuko.eckert@amd.com
35213557Sgabeblack@google.com    void
35313865Sgabeblack@google.com    setIntReg(RegIndex reg_idx, RegVal val) override
3542315SN/A    {
3552680SN/A        actualTC->setIntReg(reg_idx, val);
3562680SN/A        checkerTC->setIntReg(reg_idx, val);
3572315SN/A    }
3582315SN/A
35913557Sgabeblack@google.com    void
36013865Sgabeblack@google.com    setFloatReg(RegIndex reg_idx, RegVal val) override
3612669SN/A    {
36213611Sgabeblack@google.com        actualTC->setFloatReg(reg_idx, val);
36313611Sgabeblack@google.com        checkerTC->setFloatReg(reg_idx, val);
3642315SN/A    }
3652315SN/A
36613557Sgabeblack@google.com    void
36713628SAndrea.Mondelli@ucf.edu    setVecReg(const RegId& reg, const VecRegContainer& val) override
36812109SRekai.GonzalezAlberquilla@arm.com    {
36912109SRekai.GonzalezAlberquilla@arm.com        actualTC->setVecReg(reg, val);
37012109SRekai.GonzalezAlberquilla@arm.com        checkerTC->setVecReg(reg, val);
37112109SRekai.GonzalezAlberquilla@arm.com    }
37212109SRekai.GonzalezAlberquilla@arm.com
37313557Sgabeblack@google.com    void
37413628SAndrea.Mondelli@ucf.edu    setVecElem(const RegId& reg, const VecElem& val) override
37512109SRekai.GonzalezAlberquilla@arm.com    {
37612109SRekai.GonzalezAlberquilla@arm.com        actualTC->setVecElem(reg, val);
37712109SRekai.GonzalezAlberquilla@arm.com        checkerTC->setVecElem(reg, val);
37812109SRekai.GonzalezAlberquilla@arm.com    }
37912109SRekai.GonzalezAlberquilla@arm.com
38013557Sgabeblack@google.com    void
38113628SAndrea.Mondelli@ucf.edu    setVecPredReg(const RegId& reg, const VecPredRegContainer& val) override
38213610Sgiacomo.gabrielli@arm.com    {
38313610Sgiacomo.gabrielli@arm.com        actualTC->setVecPredReg(reg, val);
38413610Sgiacomo.gabrielli@arm.com        checkerTC->setVecPredReg(reg, val);
38513610Sgiacomo.gabrielli@arm.com    }
38613610Sgiacomo.gabrielli@arm.com
38713610Sgiacomo.gabrielli@arm.com    void
38813865Sgabeblack@google.com    setCCReg(RegIndex reg_idx, RegVal val) override
3899920Syasuko.eckert@amd.com    {
3909920Syasuko.eckert@amd.com        actualTC->setCCReg(reg_idx, val);
3919920Syasuko.eckert@amd.com        checkerTC->setCCReg(reg_idx, val);
3929920Syasuko.eckert@amd.com    }
3939920Syasuko.eckert@amd.com
3948733Sgeoffrey.blake@arm.com    /** Reads this thread's PC state. */
39513865Sgabeblack@google.com    TheISA::PCState pcState() const override { return actualTC->pcState(); }
3962315SN/A
3978733Sgeoffrey.blake@arm.com    /** Sets this thread's PC state. */
39813557Sgabeblack@google.com    void
39913628SAndrea.Mondelli@ucf.edu    pcState(const TheISA::PCState &val) override
4002315SN/A    {
4018733Sgeoffrey.blake@arm.com        DPRINTF(Checker, "Changing PC to %s, old PC %s\n",
4028733Sgeoffrey.blake@arm.com                         val, checkerTC->pcState());
4038733Sgeoffrey.blake@arm.com        checkerTC->pcState(val);
4042315SN/A        checkerCPU->recordPCChange(val);
4058733Sgeoffrey.blake@arm.com        return actualTC->pcState(val);
4062315SN/A    }
4072315SN/A
40813557Sgabeblack@google.com    void
40913557Sgabeblack@google.com    setNPC(Addr val)
41011886Sbrandon.potter@amd.com    {
41111886Sbrandon.potter@amd.com        checkerTC->setNPC(val);
41211886Sbrandon.potter@amd.com        actualTC->setNPC(val);
41311886Sbrandon.potter@amd.com    }
41411886Sbrandon.potter@amd.com
41513557Sgabeblack@google.com    void
41613628SAndrea.Mondelli@ucf.edu    pcStateNoRecord(const TheISA::PCState &val) override
4172315SN/A    {
4188733Sgeoffrey.blake@arm.com        return actualTC->pcState(val);
4192315SN/A    }
4202315SN/A
4218733Sgeoffrey.blake@arm.com    /** Reads this thread's PC. */
42213865Sgabeblack@google.com    Addr instAddr() const override { return actualTC->instAddr(); }
4232669SN/A
4248733Sgeoffrey.blake@arm.com    /** Reads this thread's next PC. */
42513865Sgabeblack@google.com    Addr nextInstAddr() const override { return actualTC->nextInstAddr(); }
4268733Sgeoffrey.blake@arm.com
4278733Sgeoffrey.blake@arm.com    /** Reads this thread's next PC. */
42813865Sgabeblack@google.com    MicroPC microPC() const override { return actualTC->microPC(); }
4292669SN/A
43013865Sgabeblack@google.com    RegVal
43113865Sgabeblack@google.com    readMiscRegNoEffect(RegIndex misc_reg) const override
43213865Sgabeblack@google.com    {
43313865Sgabeblack@google.com        return actualTC->readMiscRegNoEffect(misc_reg);
43413865Sgabeblack@google.com    }
4354172Ssaidi@eecs.umich.edu
43613865Sgabeblack@google.com    RegVal
43713865Sgabeblack@google.com    readMiscReg(RegIndex misc_reg) override
43813865Sgabeblack@google.com    {
43913865Sgabeblack@google.com        return actualTC->readMiscReg(misc_reg);
44013865Sgabeblack@google.com    }
4412315SN/A
44213557Sgabeblack@google.com    void
44313865Sgabeblack@google.com    setMiscRegNoEffect(RegIndex misc_reg, RegVal val) override
4444172Ssaidi@eecs.umich.edu    {
4458733Sgeoffrey.blake@arm.com        DPRINTF(Checker, "Setting misc reg with no effect: %d to both Checker"
4468733Sgeoffrey.blake@arm.com                         " and O3..\n", misc_reg);
4474172Ssaidi@eecs.umich.edu        checkerTC->setMiscRegNoEffect(misc_reg, val);
4484172Ssaidi@eecs.umich.edu        actualTC->setMiscRegNoEffect(misc_reg, val);
4494172Ssaidi@eecs.umich.edu    }
4502315SN/A
45113557Sgabeblack@google.com    void
45213865Sgabeblack@google.com    setMiscReg(RegIndex misc_reg, RegVal val) override
4532315SN/A    {
4548733Sgeoffrey.blake@arm.com        DPRINTF(Checker, "Setting misc reg with effect: %d to both Checker"
4558733Sgeoffrey.blake@arm.com                         " and O3..\n", misc_reg);
4562680SN/A        checkerTC->setMiscReg(misc_reg, val);
4573468Sgblack@eecs.umich.edu        actualTC->setMiscReg(misc_reg, val);
4582315SN/A    }
4592315SN/A
46013557Sgabeblack@google.com    RegId
46113628SAndrea.Mondelli@ucf.edu    flattenRegId(const RegId& regId) const override
46213557Sgabeblack@google.com    {
46312106SRekai.GonzalezAlberquilla@arm.com        return actualTC->flattenRegId(regId);
46412106SRekai.GonzalezAlberquilla@arm.com    }
4658733Sgeoffrey.blake@arm.com
46613865Sgabeblack@google.com    unsigned
46713865Sgabeblack@google.com    readStCondFailures() const override
46813865Sgabeblack@google.com    {
46913865Sgabeblack@google.com        return actualTC->readStCondFailures();
47013865Sgabeblack@google.com    }
4712315SN/A
47213557Sgabeblack@google.com    void
47313628SAndrea.Mondelli@ucf.edu    setStCondFailures(unsigned sc_failures) override
4742315SN/A    {
4752680SN/A        actualTC->setStCondFailures(sc_failures);
4762315SN/A    }
4772315SN/A
47813865Sgabeblack@google.com    Counter
47913865Sgabeblack@google.com    readFuncExeInst() const override
48013865Sgabeblack@google.com    {
48113865Sgabeblack@google.com        return actualTC->readFuncExeInst();
48213865Sgabeblack@google.com    }
4839426SAndreas.Sandberg@ARM.com
48413865Sgabeblack@google.com    RegVal
48513865Sgabeblack@google.com    readIntRegFlat(RegIndex idx) const override
48613865Sgabeblack@google.com    {
48713628SAndrea.Mondelli@ucf.edu        return actualTC->readIntRegFlat(idx);
48813628SAndrea.Mondelli@ucf.edu    }
4899426SAndreas.Sandberg@ARM.com
49013557Sgabeblack@google.com    void
49113865Sgabeblack@google.com    setIntRegFlat(RegIndex idx, RegVal val) override
49213557Sgabeblack@google.com    {
49313557Sgabeblack@google.com        actualTC->setIntRegFlat(idx, val);
49413557Sgabeblack@google.com    }
4959426SAndreas.Sandberg@ARM.com
49613557Sgabeblack@google.com    RegVal
49713865Sgabeblack@google.com    readFloatRegFlat(RegIndex idx) const override
49813557Sgabeblack@google.com    {
49913611Sgabeblack@google.com        return actualTC->readFloatRegFlat(idx);
50013557Sgabeblack@google.com    }
5019426SAndreas.Sandberg@ARM.com
50213557Sgabeblack@google.com    void
50313865Sgabeblack@google.com    setFloatRegFlat(RegIndex idx, RegVal val) override
50413557Sgabeblack@google.com    {
50513611Sgabeblack@google.com        actualTC->setFloatRegFlat(idx, val);
50613557Sgabeblack@google.com    }
5079920Syasuko.eckert@amd.com
50813557Sgabeblack@google.com    const VecRegContainer &
50913865Sgabeblack@google.com    readVecRegFlat(RegIndex idx) const override
51013557Sgabeblack@google.com    {
51113557Sgabeblack@google.com        return actualTC->readVecRegFlat(idx);
51213557Sgabeblack@google.com    }
51312109SRekai.GonzalezAlberquilla@arm.com
51412109SRekai.GonzalezAlberquilla@arm.com    /**
51512109SRekai.GonzalezAlberquilla@arm.com     * Read vector register for modification, flat indexing.
51612109SRekai.GonzalezAlberquilla@arm.com     */
51713557Sgabeblack@google.com    VecRegContainer &
51813865Sgabeblack@google.com    getWritableVecRegFlat(RegIndex idx) override
51913557Sgabeblack@google.com    {
52013557Sgabeblack@google.com        return actualTC->getWritableVecRegFlat(idx);
52113557Sgabeblack@google.com    }
52212109SRekai.GonzalezAlberquilla@arm.com
52313865Sgabeblack@google.com    void
52413865Sgabeblack@google.com    setVecRegFlat(RegIndex idx, const VecRegContainer& val) override
52513865Sgabeblack@google.com    {
52613865Sgabeblack@google.com        actualTC->setVecRegFlat(idx, val);
52713865Sgabeblack@google.com    }
52812109SRekai.GonzalezAlberquilla@arm.com
52913865Sgabeblack@google.com    const VecElem &
53013865Sgabeblack@google.com    readVecElemFlat(RegIndex idx, const ElemIndex& elem_idx) const override
53113865Sgabeblack@google.com    {
53213865Sgabeblack@google.com        return actualTC->readVecElemFlat(idx, elem_idx);
53313865Sgabeblack@google.com    }
53412109SRekai.GonzalezAlberquilla@arm.com
53513865Sgabeblack@google.com    void
53613865Sgabeblack@google.com    setVecElemFlat(RegIndex idx,
53713865Sgabeblack@google.com                   const ElemIndex& elem_idx, const VecElem& val) override
53813865Sgabeblack@google.com    {
53913865Sgabeblack@google.com        actualTC->setVecElemFlat(idx, elem_idx, val);
54013865Sgabeblack@google.com    }
54112109SRekai.GonzalezAlberquilla@arm.com
54213865Sgabeblack@google.com    const VecPredRegContainer &
54313865Sgabeblack@google.com    readVecPredRegFlat(RegIndex idx) const override
54413865Sgabeblack@google.com    {
54513865Sgabeblack@google.com        return actualTC->readVecPredRegFlat(idx);
54613865Sgabeblack@google.com    }
54713610Sgiacomo.gabrielli@arm.com
54813865Sgabeblack@google.com    VecPredRegContainer &
54913865Sgabeblack@google.com    getWritableVecPredRegFlat(RegIndex idx) override
55013865Sgabeblack@google.com    {
55113865Sgabeblack@google.com        return actualTC->getWritableVecPredRegFlat(idx);
55213865Sgabeblack@google.com    }
55313610Sgiacomo.gabrielli@arm.com
55413865Sgabeblack@google.com    void
55513865Sgabeblack@google.com    setVecPredRegFlat(RegIndex idx, const VecPredRegContainer& val) override
55613865Sgabeblack@google.com    {
55713865Sgabeblack@google.com        actualTC->setVecPredRegFlat(idx, val);
55813865Sgabeblack@google.com    }
55913610Sgiacomo.gabrielli@arm.com
56013865Sgabeblack@google.com    RegVal
56113865Sgabeblack@google.com    readCCRegFlat(RegIndex idx) const override
56213865Sgabeblack@google.com    {
56313865Sgabeblack@google.com        return actualTC->readCCRegFlat(idx);
56413865Sgabeblack@google.com    }
5659920Syasuko.eckert@amd.com
56613865Sgabeblack@google.com    void
56713865Sgabeblack@google.com    setCCRegFlat(RegIndex idx, RegVal val) override
56813865Sgabeblack@google.com    {
56913865Sgabeblack@google.com        actualTC->setCCRegFlat(idx, val);
57013865Sgabeblack@google.com    }
5712315SN/A};
5722315SN/A
5732315SN/A#endif // __CPU_CHECKER_EXEC_CONTEXT_HH__
574