50#include "debug/Context.hh"
51#include "debug/Quiesce.hh"
53#include "params/BaseCPU.hh"
62 const auto ®Classes = one->getIsaPtr()->regClasses();
64 DPRINTF(Context,
"Comparing thread contexts\n");
71 panic(
"Int reg idx %d doesn't match, one: %#x, two: %#x",
80 panic(
"Float reg idx %d doesn't match, one: %#x, two: %#x",
89 one->getReg(
id, vec1.data());
90 two->
getReg(
id, vec2.data());
92 panic(
"Vec reg idx %d doesn't match, one: %#x, two: %#x",
93 id.
index(), vec_class->valString(vec1.data()),
94 vec_class->valString(vec2.data()));
103 one->getReg(
id, pred1.data());
104 two->
getReg(
id, pred2.data());
105 if (pred1 != pred2) {
106 panic(
"Pred reg idx %d doesn't match, one: %s, two: %s",
107 id.
index(), vec_pred_class->valString(pred1.data()),
108 vec_pred_class->valString(pred2.data()));
113 const auto *mat_class = regClasses.at(
MatRegClass);
117 one->getReg(
id, mat1.data());
118 two->
getReg(
id, mat2.data());
120 panic(
"Mat reg idx %d doesn't match, one: %#x, two: %#x",
121 id.
index(), mat_class->valString(mat1.data()),
122 mat_class->valString(mat2.data()));
130 panic(
"Misc reg idx %d doesn't match, one: %#x, two: %#x",
139 panic(
"CC reg idx %d doesn't match, one: %#x, two: %#x",
142 if (one->pcState() != two->
pcState())
143 panic(
"PC state doesn't match.");
144 int id1 = one->cpuId();
145 int id2 = two->
cpuId();
147 panic(
"CPU ids don't match, one: %d, two: %d", id1, id2);
152 panic(
"Context ids don't match, one: %d, two: %d", id1, id2);
163 port->sendFunctional(pkt);
201 const size_t reg_bytes = reg_class->regBytes();
202 const size_t reg_count = reg_class->numRegs();
203 const size_t array_bytes = reg_bytes * reg_count;
205 uint8_t regs[array_bytes];
206 auto *reg_ptr = regs;
207 for (
const auto &
id: *reg_class) {
209 reg_ptr += reg_bytes;
212 arrayParamOut(cp, std::string(
"regs.") + reg_class->name(), regs,
229 const size_t reg_bytes = reg_class->regBytes();
230 const size_t reg_count = reg_class->numRegs();
231 const size_t array_bytes = reg_bytes * reg_count;
233 uint8_t regs[array_bytes];
234 arrayParamIn(cp, std::string(
"regs.") + reg_class->name(), regs,
237 auto *reg_ptr = regs;
238 for (
const auto &
id: *reg_class) {
240 reg_ptr += reg_bytes;
244 std::unique_ptr<PCStateBase> pc_state(tc.
pcState().
clone());
245 pc_state->unserialize(cp);
virtual Port & getDataPort()=0
Purely virtual method that returns a reference to the data port.
const RegClasses & regClasses() const
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual PCStateBase * clone() const =0
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Register ID: describe an architectural register with its class and index.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
void quiesceTick(ContextID id, Tick when)
void quiesce(ContextID id)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setStatus(Status new_status)=0
virtual RegVal getReg(const RegId ®) const
virtual System * getSystemPtr()=0
virtual void copyArchRegs(ThreadContext *tc)=0
static void compare(ThreadContext *one, ThreadContext *two)
function to compare two thread contexts (for debugging)
virtual BaseISA * getIsaPtr() const =0
virtual BaseCPU * getCpuPtr()=0
void quiesceTick(Tick resume)
Quiesce, suspend, and schedule activate at resume.
virtual void setReg(const RegId ®, RegVal val)
void quiesce()
Quiesce thread context.
@ Halted
Permanently shut down.
virtual const PCStateBase & pcState() const =0
virtual int threadId() const =0
virtual Status status() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual Process * getProcessPtr()=0
virtual ContextID contextId() const =0
virtual void sendFunctional(PacketPtr pkt)
virtual void setThreadId(int id)=0
virtual void setContextId(ContextID id)=0
virtual int cpuId() const =0
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
void unserialize(ThreadContext &tc, CheckpointIn &cp)
void arrayParamOut(CheckpointOut &cp, const std::string &name, const CircleBuf< T > ¶m)
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
uint64_t Tick
Tick count type.
void takeOverFrom(ThreadContext &ntc, ThreadContext &otc)
Copy state between thread contexts in preparation for CPU handover.
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
int ContextID
Globally unique thread context ID.
void arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf< T > ¶m)
@ MatRegClass
Matrix Register.
@ FloatRegClass
Floating-point register.
@ CCRegClass
Condition-code register.
@ VecRegClass
Vector Register.
@ IntRegClass
Integer register.
@ MiscRegClass
Control (misc) register.