42 #ifndef __CPU_THREAD_CONTEXT_HH__ 43 #define __CPU_THREAD_CONTEXT_HH__ 49 #include "arch/registers.hh" 50 #include "arch/types.hh" 52 #include "config/the_isa.hh" 123 virtual BaseCPU *getCpuPtr() = 0;
125 virtual int cpuId()
const = 0;
127 virtual uint32_t socketId()
const = 0;
129 virtual int threadId()
const = 0;
131 virtual void setThreadId(
int id) = 0;
135 virtual void setContextId(
ContextID id) = 0;
143 virtual BaseISA *getIsaPtr() = 0;
145 virtual TheISA::Decoder *getDecoderPtr() = 0;
147 virtual System *getSystemPtr() = 0;
149 virtual ::Kernel::Statistics *getKernelStats() = 0;
163 virtual Process *getProcessPtr() = 0;
165 virtual void setProcessPtr(
Process *
p) = 0;
169 virtual void setStatus(
Status new_status) = 0;
172 virtual void activate() = 0;
175 virtual void suspend() = 0;
178 virtual void halt() = 0;
184 void quiesceTick(
Tick resume);
186 virtual void dumpFuncProfile() = 0;
190 virtual void regStats(
const std::string &
name) = 0;
195 virtual void descheduleInstCountEvent(
Event *event) = 0;
196 virtual Tick getCurrentInstCount() = 0;
200 virtual Tick readLastActivate() = 0;
201 virtual Tick readLastSuspend() = 0;
203 virtual void profileClear() = 0;
204 virtual void profileSample() = 0;
208 virtual void clearArchRegs() = 0;
224 readVec8BitLaneReg(
const RegId& reg)
const = 0;
228 readVec16BitLaneReg(
const RegId& reg)
const = 0;
232 readVec32BitLaneReg(
const RegId& reg)
const = 0;
236 readVec64BitLaneReg(
const RegId& reg)
const = 0;
239 virtual void setVecLane(
const RegId& reg,
241 virtual void setVecLane(
const RegId& reg,
243 virtual void setVecLane(
const RegId& reg,
245 virtual void setVecLane(
const RegId& reg,
263 virtual void setVecElem(
const RegId& reg,
const VecElem& val) = 0;
265 virtual void setVecPredReg(
const RegId& reg,
278 pc_state.setNPC(val);
284 virtual Addr instAddr()
const = 0;
286 virtual Addr nextInstAddr()
const = 0;
288 virtual MicroPC microPC()
const = 0;
294 virtual void setMiscRegNoEffect(
RegIndex misc_reg,
RegVal val) = 0;
298 virtual RegId flattenRegId(
const RegId& regId)
const = 0;
302 virtual unsigned readStCondFailures()
const = 0;
304 virtual void setStCondFailures(
unsigned sc_failures) = 0;
307 virtual Counter readFuncExeInst()
const = 0;
309 virtual void syscall(
Fault *fault) = 0;
314 virtual int exit() {
return 1; };
347 readVecPredRegFlat(
RegIndex idx)
const = 0;
349 virtual void setVecPredRegFlat(
RegIndex idx,
struct IsAapcs64Hfa< E[N], typename std::enable_if< std::is_floating_point< E >::value &&N<=4 >::type > :public std::true_type{};template< typename T, typename Enabled=void >struct IsAapcs64Hva :public std::false_type {};template< typename E, size_t N >struct IsAapcs64Hva< E[N], typename std::enable_if< IsAapcs64ShortVector< E >::value &&N<=4 >::type > :public std::true_type{};template< typename T, typename Enabled=void >struct IsAapcs64Hxa :public std::false_type {};template< typename T >struct IsAapcs64Hxa< T, typename std::enable_if< IsAapcs64Hfa< T >::value||IsAapcs64Hva< T >::value >::type > :public std::true_type{};struct Aapcs64ArgumentBase{ template< typename T > static T loadFromStack(ThreadContext *tc, Aapcs64::State &state) { size_t align=std::max< size_t >(8, alignof(T));size_t size=roundUp(sizeof(T), 8);state.nsaa=roundUp(state.nsaa, align);TypedBufferArg< T > val(state.nsaa);val.copyIn(tc->getVirtProxy());state.nsaa+=size;return gtoh(*val, ArmISA::byteOrder(tc));}};template< typename Float >struct Argument< Aapcs64, Float, typename std::enable_if< std::is_floating_point< Float >::value||IsAapcs64ShortVector< Float >::value >::type > :public Aapcs64ArgumentBase{ static Float get(ThreadContext *tc, Aapcs64::State &state) { if(state.nsrn<=state.MAX_SRN) { RegId id(VecRegClass, state.nsrn++);return tc->readVecReg(id).laneView< Float, 0 >();} return loadFromStack< Float >(tc, state);}};template< typename Float >struct Result< Aapcs64, Float, typename std::enable_if< std::is_floating_point< Float >::value||IsAapcs64ShortVector< Float >::value >::type >{ static void store(ThreadContext *tc, const Float &f) { RegId id(VecRegClass, 0);auto reg=tc-> readVecReg(id)
const std::string & name()
Trying to exit and waiting for an event to completely exit.
Vector Register Abstraction This generic class is the model in a particularization of MVC...
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Event for timing out quiesce instruction.
void unserialize(ThreadContext &tc, CheckpointIn &cp)
LaneSize is an abstraction of a LS byte value for the execution and thread contexts to handle values ...
void quiesce(ThreadContext *tc)
uint64_t Tick
Tick count type.
VecPredReg::Container VecPredRegContainer
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.
int64_t Counter
Statistics counter type.
void takeOverFrom(ThreadContext &new_tc, ThreadContext &old_tc)
Copy state between thread contexts in preparation for CPU handover.
This object is a proxy for a port or other object which implements the functional response protocol...
std::ostream CheckpointOut
VecReg::Container VecRegContainer
uint16_t ElemIndex
Logical vector register elem index type.
XReg readVecElem(VReg src, int index, int eSize)
Read a single NEON vector element.
Generic predicate register container.
bool compare(T src0, T src1, Brig::BrigCompareOperation cmpOp)
Register ID: describe an architectural register with its class and index.
Vector Lane abstraction Another view of a container.
TheISA::MachInst MachInst
GenericISA::DelaySlotPCState< MachInst > PCState
std::shared_ptr< FaultBase > Fault
int ContextID
Globally unique thread context ID.