45 #ifndef __CPU_SIMPLE_THREAD_HH__
46 #define __CPU_SIMPLE_THREAD_HH__
48 #include "arch/decoder.hh"
49 #include "arch/isa.hh"
50 #include "arch/isa_traits.hh"
51 #include "arch/registers.hh"
52 #include "arch/tlb.hh"
53 #include "arch/types.hh"
55 #include "config/the_isa.hh"
58 #include "debug/CCRegs.hh"
59 #include "debug/FloatRegs.hh"
60 #include "debug/IntRegs.hh"
114 #ifdef ISA_HAS_CC_REGS
142 TheISA::TLB *_itb, TheISA::TLB *_dtb, TheISA::ISA *_isa,
143 bool use_kernel_stats =
true);
146 Process *_process, TheISA::TLB *_itb, TheISA::TLB *_dtb,
174 itb->demapPage(vaddr, asn);
175 dtb->demapPage(vaddr, asn);
180 itb->demapPage(vaddr, asn);
185 dtb->demapPage(vaddr, asn);
230 #ifdef ISA_HAS_CC_REGS
231 memset(ccRegs, 0,
sizeof(ccRegs));
241 int flatIndex =
isa->flattenIntIndex(reg_idx);
244 DPRINTF(IntRegs,
"Reading int reg %d (%d) as %#x.\n",
245 reg_idx, flatIndex, regVal);
251 int flatIndex =
isa->flattenFloatIndex(reg_idx);
254 DPRINTF(FloatRegs,
"Reading float reg %d (%d) as %f, %#x.\n",
255 reg_idx, flatIndex, regVal,
floatRegs.i[flatIndex]);
261 int flatIndex =
isa->flattenFloatIndex(reg_idx);
264 DPRINTF(FloatRegs,
"Reading float reg %d (%d) bits as %#x, %f.\n",
265 reg_idx, flatIndex, regVal,
floatRegs.f[flatIndex]);
271 #ifdef ISA_HAS_CC_REGS
272 int flatIndex =
isa->flattenCCIndex(reg_idx);
273 assert(0 <= flatIndex);
276 DPRINTF(CCRegs,
"Reading CC reg %d (%d) as %#x.\n",
277 reg_idx, flatIndex, regVal);
280 panic(
"Tried to read a CC register.");
287 int flatIndex =
isa->flattenIntIndex(reg_idx);
289 DPRINTF(IntRegs,
"Setting int reg %d (%d) to %#x.\n",
290 reg_idx, flatIndex, val);
296 int flatIndex =
isa->flattenFloatIndex(reg_idx);
299 DPRINTF(FloatRegs,
"Setting float reg %d (%d) to %f, %#x.\n",
300 reg_idx, flatIndex, val,
floatRegs.i[flatIndex]);
305 int flatIndex =
isa->flattenFloatIndex(reg_idx);
311 DPRINTF(FloatRegs,
"Setting float reg %d (%d) bits to %#x, %#f.\n",
312 reg_idx, flatIndex, val,
floatRegs.f[flatIndex]);
317 #ifdef ISA_HAS_CC_REGS
318 int flatIndex =
isa->flattenCCIndex(reg_idx);
320 DPRINTF(CCRegs,
"Setting CC reg %d (%d) to %#x.\n",
321 reg_idx, flatIndex, val);
324 panic(
"Tried to set a CC register.");
383 return isa->readMiscRegNoEffect(misc_reg);
389 return isa->readMiscReg(misc_reg,
tc);
395 return isa->setMiscRegNoEffect(misc_reg, val);
401 return isa->setMiscReg(misc_reg, val,
tc);
407 return isa->flattenIntIndex(reg);
413 return isa->flattenFloatIndex(reg);
419 return isa->flattenCCIndex(reg);
425 return isa->flattenMiscIndex(reg);
449 #ifdef ISA_HAS_CC_REGS
454 {
panic(
"readCCRegFlat w/no CC regs!\n"); }
457 {
panic(
"setCCRegFlat w/no CC regs!\n"); }
462 #endif // __CPU_CPU_EXEC_CONTEXT_HH__
uint64_t readIntReg(int reg_idx)
int flattenCCIndex(int reg)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
CCReg readCCRegFlat(int idx)
void setMiscReg(int misc_reg, const MiscReg &val, ThreadID tid=0)
Struct for holding general thread state that is needed across CPU models.
void setStatus(Status newStatus)
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
ProxyThreadContext< SimpleThread > * tc
void setFloatRegFlat(int idx, FloatReg val)
TheISA::FloatReg FloatReg
bool simPalCheck(int palFunc)
Check for special simulator handling of specific PAL calls.
void activate()
Set the status to Active.
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
int flattenMiscIndex(int reg)
void setFloatRegBitsFlat(int idx, FloatRegBits val)
void setStCondFailures(unsigned sc_failures)
void pcStateNoRecord(const TheISA::PCState &val)
FloatRegBits i[TheISA::NumFloatRegs]
ThreadContext is the external interface to all thread state for anything outside of the CPU...
FloatReg readFloatRegFlat(int idx)
void setCCReg(int reg_idx, CCReg val)
void syscall(int64_t callnum, Fault *fault)
CheckerCPU * getCheckerCpuPtr()
void suspend()
Set the status to Suspended.
void setIntRegFlat(int idx, uint64_t val)
MiscReg readMiscRegNoEffect(int misc_reg, ThreadID tid=0) const
unsigned readStCondFailures()
TheISA::MachInst MachInst
std::string csprintf(const char *format, const Args &...args)
void setCCRegFlat(int idx, CCReg val)
virtual void takeOverFrom(ThreadContext *oldContext)
union SimpleThread::@38 floatRegs
MiscReg readMiscReg(int misc_reg, ThreadID tid=0)
void setMiscRegNoEffect(int misc_reg, const MiscReg &val, ThreadID tid=0)
void pcState(const TheISA::PCState &val)
TheISA::Decoder * getDecoderPtr()
void demapInstPage(Addr vaddr, uint64_t asn)
void demapDataPage(Addr vaddr, uint64_t asn)
void demapPage(Addr vaddr, uint64_t asn)
void setFloatRegBits(int reg_idx, FloatRegBits val)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
int flattenFloatIndex(int reg)
TheISA::TLB * getDTBPtr()
void setFloatReg(int reg_idx, FloatReg val)
virtual void syscall(int64_t callnum, ThreadContext *tc, Fault *fault)
ThreadContext::Status _status
bool predicate
Did this instruction execute or is it predicated false.
TheISA::PCState pcState()
CCReg readCCReg(int reg_idx)
int16_t ThreadID
Thread index/ID type.
void halt()
Set the status to Halted.
FloatReg readFloatReg(int reg_idx)
void setIntReg(int reg_idx, uint64_t val)
Declarations of a non-full system Page Table.
void regStats(const std::string &name)
std::ostream CheckpointOut
FloatRegBits readFloatRegBits(int reg_idx)
void copyArchRegs(ThreadContext *tc)
void copyState(ThreadContext *oldContext)
GenericISA::SimplePCState< MachInst > PCState
FloatReg f[TheISA::NumFloatRegs]
TheISA::TLB * getITBPtr()
ThreadContext::Status Status
uint64_t readIntRegFlat(int idx)
unsigned storeCondFailures
void serialize(CheckpointOut &cp) const override
Serialize an object.
TheISA::IntReg intRegs[TheISA::NumIntRegs]
std::shared_ptr< FaultBase > Fault
int flattenIntIndex(int reg)
SimpleThread(BaseCPU *_cpu, int _thread_num, System *_system, TheISA::TLB *_itb, TheISA::TLB *_dtb, TheISA::ISA *_isa, bool use_kernel_stats=true)
void setPredicate(bool val)
TheISA::FloatRegBits FloatRegBits
FloatRegBits readFloatRegBitsFlat(int idx)