ARM: implement the ProcessInfo methods

This commit is contained in:
Anthony Gutierrez 2012-06-11 11:07:41 -04:00
parent 12ba92055d
commit 9764cde7f2

View file

@ -74,19 +74,46 @@ namespace ArmISA
Addr Addr
ProcessInfo::task(Addr ksp) const ProcessInfo::task(Addr ksp) const
{ {
Addr base = ksp & ~0x1fff;
if (base == ULL(0xffffffffc0000000))
return 0; return 0;
Addr tsk;
FSTranslatingPortProxy &vp = tc->getVirtProxy();
tsk = vp.readGtoH<Addr>(base + task_off);
return tsk;
} }
int int
ProcessInfo::pid(Addr ksp) const ProcessInfo::pid(Addr ksp) const
{ {
Addr task = this->task(ksp);
if (!task)
return -1; return -1;
uint16_t pd;
FSTranslatingPortProxy &vp = tc->getVirtProxy();
pd = vp.readGtoH<uint16_t>(task + pid_off);
return pd;
} }
string string
ProcessInfo::name(Addr ksp) const ProcessInfo::name(Addr ksp) const
{ {
return "Implement me"; Addr task = this->task(ksp);
if (!task)
return "unknown";
char comm[256];
CopyStringOut(tc, comm, task + name_off, sizeof(comm));
if (!comm[0])
return "startup";
return comm;
} }
StackTrace::StackTrace() StackTrace::StackTrace()