29 #ifndef __ARCH_GENERIC_LINUX_THREADINFO_HH__ 30 #define __ARCH_GENERIC_LINUX_THREADINFO_HH__ 50 auto it = symtab->
find(symbol);
51 if (it == symtab->end()) {
52 warn_once(
"Unable to find kernel symbol %s\n", symbol);
53 warn_once(
"Kernel not compiled with task_struct info; can't get " 54 "currently executing task/process/thread name/ids!\n");
65 : tc(_tc), sys(tc->getSystemPtr()), pcbb(_pcbb)
76 panic(
"curThreadInfo() not implemented for this ISA");
87 return sp & ~
ULL(0x3fff);
97 if (!
get_data(
"thread_info_task", offset))
109 if (!
get_data(
"task_struct_pid", offset))
125 if (!
get_data(
"task_struct_tgid", offset))
141 if (!
get_data(
"task_struct_start_time", offset))
161 if (!
get_data(
"task_struct_comm", offset))
162 return "FailureIn_curTaskName";
164 if (!
get_data(
"task_struct_comm_size", size))
165 return "FailureIn_curTaskName";
167 char buffer[size + 1];
183 if (!
get_data(
"task_struct_mm", offset))
198 #endif // __ARCH_GENERIC_LINUX_THREADINFO_HH__ #define panic(...)
This implements a cprintf based panic() function.
Addr curTaskInfo(Addr thread_info=0)
virtual const Loader::SymbolTable * symtab(ThreadContext *tc)=0
const bool CurThreadInfoImplemented
int64_t curTaskStart(Addr thread_info=0)
virtual PortProxy & getVirtProxy()=0
T read(Addr address) const
Read sizeof(T) bytes from address and return as object T.
const int CurThreadInfoReg
std::string curTaskNameFromTaskStruct(Addr task_struct)
int64_t curTaskStartFromTaskStruct(Addr task_struct)
ThreadInfo(ThreadContext *_tc, Addr _pcbb=0)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
int32_t curTaskMmFromTaskStruct(Addr task_struct)
int32_t curTaskPIDFromTaskStruct(Addr task_struct)
virtual PortProxy & getPhysProxy()=0
int32_t curTaskTGIDFromTaskStruct(Addr task_struct)
Workload * workload
OS kernel.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
#define ULL(N)
uint64_t constant
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
This object is a proxy for a port or other object which implements the functional response protocol...
void readString(std::string &str, Addr addr) const
Same as tryReadString, but insists on success.
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
int32_t curTaskPID(Addr thread_info=0)
int32_t curTaskMm(Addr thread_info=0)
const_iterator find(Addr address) const
std::string curTaskName(Addr thread_info=0)
const ByteOrder GuestByteOrder
int32_t curTaskTGID(Addr thread_info=0)
bool get_data(const char *symbol, T &data)