From 9764cde7f2961116ac83f020f9c1598b00587ae0 Mon Sep 17 00:00:00 2001 From: Anthony Gutierrez Date: Mon, 11 Jun 2012 11:07:41 -0400 Subject: [PATCH] ARM: implement the ProcessInfo methods --- src/arch/arm/stacktrace.cc | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/arch/arm/stacktrace.cc b/src/arch/arm/stacktrace.cc index 99ebcd7c5..8575e1347 100644 --- a/src/arch/arm/stacktrace.cc +++ b/src/arch/arm/stacktrace.cc @@ -74,19 +74,46 @@ namespace ArmISA Addr ProcessInfo::task(Addr ksp) const { - return 0; + Addr base = ksp & ~0x1fff; + if (base == ULL(0xffffffffc0000000)) + return 0; + + Addr tsk; + + FSTranslatingPortProxy &vp = tc->getVirtProxy(); + tsk = vp.readGtoH(base + task_off); + + return tsk; } int ProcessInfo::pid(Addr ksp) const { - return -1; + Addr task = this->task(ksp); + if (!task) + return -1; + + uint16_t pd; + + FSTranslatingPortProxy &vp = tc->getVirtProxy(); + pd = vp.readGtoH(task + pid_off); + + return pd; } string 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()