1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 23 unchanged lines hidden (view full) --- 32#define __CPU_THREAD_STATE_HH__ 33 34#include "arch/types.hh" 35#include "cpu/profile.hh" 36#include "cpu/thread_context.hh" 37 38#if !FULL_SYSTEM 39#include "mem/mem_object.hh" |
40#include "sim/process.hh" 41#endif 42 43#if FULL_SYSTEM 44class EndQuiesceEvent; 45class FunctionProfile; 46class ProfileNode; 47namespace Kernel { 48 class Statistics; 49}; 50#endif 51 |
52class BaseCPU; |
53class Checkpoint; |
54class TranslatingPort; |
55 56/** 57 * Struct for holding general thread state that is needed across CPU 58 * models. This includes things such as pointers to the process, 59 * memory, quiesce events, and certain stats. This can be expanded 60 * to hold more thread-specific stats within it. 61 */ 62struct ThreadState { 63 typedef ThreadContext::Status Status; 64 65#if FULL_SYSTEM |
66 ThreadState(BaseCPU *cpu, int _cpuId, int _tid); |
67#else |
68 ThreadState(BaseCPU *cpu, int _cpuId, int _tid, Process *_process, 69 short _asid); |
70#endif 71 72 void serialize(std::ostream &os); 73 74 void unserialize(Checkpoint *cp, const std::string §ion); 75 76 void setCpuId(int id) { cpuId = id; } 77 --- 23 unchanged lines hidden (view full) --- 101 void setPhysPort(FunctionalPort *port) { physPort = port; } 102 103 VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return virtPort; } 104 105 void setVirtPort(VirtualPort *port) { virtPort = port; } 106#else 107 Process *getProcessPtr() { return process; } 108 |
109 TranslatingPort *getMemPort(); |
110 111 void setMemPort(TranslatingPort *_port) { port = _port; } 112 113 int getInstAsid() { return asid; } 114 int getDataAsid() { return asid; } 115#endif 116 117 /** Sets the current instruction being committed. */ --- 31 unchanged lines hidden (view full) --- 149 Counter numLoad; 150 151 /** The number of simulated loads committed prior to this run. */ 152 Counter startNumLoad; 153 154 protected: 155 ThreadContext::Status _status; 156 |
157 // Pointer to the base CPU. 158 BaseCPU *baseCpu; 159 |
160 // ID of this context w.r.t. the System or Process object to which 161 // it belongs. For full-system mode, this is the system CPU ID. 162 int cpuId; 163 164 // Index of hardware thread context on the CPU that this represents. 165 int tid; 166 167 public: --- 75 unchanged lines hidden --- |