From bd72ce227333a1dd43ad112871e5a68359aaf510 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 4 Jul 2020 14:04:55 -0700 Subject: [PATCH] arch: Delete the unused ProcessInfo class. Change-Id: Ie67f696005fa60e117e1e4e4e985aee5e767ccec Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30958 Reviewed-by: Andreas Sandberg Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/arch/arm/stacktrace.cc | 66 ------------------------------------ src/arch/arm/stacktrace.hh | 21 ------------ src/arch/mips/stacktrace.cc | 48 -------------------------- src/arch/mips/stacktrace.hh | 17 ---------- src/arch/power/stacktrace.cc | 26 -------------- src/arch/power/stacktrace.hh | 10 ------ src/arch/riscv/stacktrace.cc | 26 -------------- src/arch/riscv/stacktrace.hh | 10 ------ src/arch/x86/stacktrace.cc | 66 ------------------------------------ src/arch/x86/stacktrace.hh | 21 ------------ 10 files changed, 311 deletions(-) diff --git a/src/arch/arm/stacktrace.cc b/src/arch/arm/stacktrace.cc index 2c3957685..a9f79e864 100644 --- a/src/arch/arm/stacktrace.cc +++ b/src/arch/arm/stacktrace.cc @@ -41,72 +41,6 @@ namespace ArmISA { -static int32_t -readSymbol(ThreadContext *tc, const std::string name) -{ - PortProxy &vp = tc->getVirtProxy(); - const auto &symtab = tc->getSystemPtr()->workload->symtab(tc); - - auto it = symtab.find(name); - panic_if(it == symtab.end(), "Thread info not compiled into kernel."); - - return vp.read(it->address, GuestByteOrder); -} - -ProcessInfo::ProcessInfo(ThreadContext *_tc) : tc(_tc) -{ - thread_info_size = readSymbol(tc, "thread_info_size"); - task_struct_size = readSymbol(tc, "task_struct_size"); - task_off = readSymbol(tc, "thread_info_task"); - pid_off = readSymbol(tc, "task_struct_pid"); - name_off = readSymbol(tc, "task_struct_comm"); -} - -Addr -ProcessInfo::task(Addr ksp) const -{ - Addr base = ksp & ~0x1fff; - if (base == ULL(0xffffffffc0000000)) - return 0; - - Addr tsk; - - PortProxy &vp = tc->getVirtProxy(); - tsk = vp.read(base + task_off, GuestByteOrder); - - return tsk; -} - -int -ProcessInfo::pid(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return -1; - - uint16_t pd; - - PortProxy &vp = tc->getVirtProxy(); - pd = vp.read(task + pid_off, GuestByteOrder); - - return pd; -} - -std::string -ProcessInfo::name(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return "unknown"; - - char comm[256]; - tc->getVirtProxy().readString(comm, task + name_off, sizeof(comm)); - if (!comm[0]) - return "startup"; - - return comm; -} - StackTrace::StackTrace() : tc(0), stack(64) { diff --git a/src/arch/arm/stacktrace.hh b/src/arch/arm/stacktrace.hh index fd0ec1b7a..61bea299c 100644 --- a/src/arch/arm/stacktrace.hh +++ b/src/arch/arm/stacktrace.hh @@ -37,27 +37,6 @@ class ThreadContext; namespace ArmISA { -class StackTrace; - -class ProcessInfo -{ - private: - ThreadContext *tc; - - int thread_info_size; - int task_struct_size; - int task_off; - int pid_off; - int name_off; - - public: - ProcessInfo(ThreadContext *_tc); - - Addr task(Addr ksp) const; - int pid(Addr ksp) const; - std::string name(Addr ksp) const; -}; - class StackTrace { protected: diff --git a/src/arch/mips/stacktrace.cc b/src/arch/mips/stacktrace.cc index ec5597c55..0384e2bd0 100644 --- a/src/arch/mips/stacktrace.cc +++ b/src/arch/mips/stacktrace.cc @@ -40,54 +40,6 @@ using namespace MipsISA; -ProcessInfo::ProcessInfo(ThreadContext *_tc) : tc(_tc) -{} - -Addr -ProcessInfo::task(Addr ksp) const -{ - Addr base = ksp & ~0x3fff; - if (base == ULL(0xfffffc0000000000)) - return 0; - - Addr tsk; - - PortProxy &vp = tc->getVirtProxy(); - tsk = vp.read(base + task_off, GuestByteOrder); - - return tsk; -} - -int -ProcessInfo::pid(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return -1; - - uint16_t pd; - - PortProxy &vp = tc->getVirtProxy(); - pd = vp.read(task + pid_off, GuestByteOrder); - - return pd; -} - -std::string -ProcessInfo::name(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return "console"; - - char comm[256]; - tc->getVirtProxy().readString(comm, task + name_off, sizeof(comm)); - if (!comm[0]) - return "startup"; - - return comm; -} - StackTrace::StackTrace() : tc(0), stack(64) { diff --git a/src/arch/mips/stacktrace.hh b/src/arch/mips/stacktrace.hh index eb3a95a23..9c0217055 100644 --- a/src/arch/mips/stacktrace.hh +++ b/src/arch/mips/stacktrace.hh @@ -38,23 +38,6 @@ class ThreadContext; namespace MipsISA { -class ProcessInfo -{ - private: - ThreadContext *tc; - - int task_off; - int pid_off; - int name_off; - - public: - ProcessInfo(ThreadContext *_tc); - - Addr task(Addr ksp) const; - int pid(Addr ksp) const; - std::string name(Addr ksp) const; -}; - class StackTrace { protected: diff --git a/src/arch/power/stacktrace.cc b/src/arch/power/stacktrace.cc index 64ea9264a..84f1b6547 100644 --- a/src/arch/power/stacktrace.cc +++ b/src/arch/power/stacktrace.cc @@ -36,32 +36,6 @@ using namespace std; namespace PowerISA { -ProcessInfo::ProcessInfo(ThreadContext *_tc) -{ - panic("ProcessInfo constructor not implemented.\n"); -} - -Addr -ProcessInfo::task(Addr ksp) const -{ - panic("ProcessInfo::task not implemented.\n"); - return 0; -} - -int -ProcessInfo::pid(Addr ksp) const -{ - panic("ProcessInfo::pid not implemented.\n"); - return 0; -} - -string -ProcessInfo::name(Addr ksp) const -{ - panic("ProcessInfo::name not implemented.\n"); - return ""; -} - StackTrace::StackTrace() : tc(0), stack(64) { diff --git a/src/arch/power/stacktrace.hh b/src/arch/power/stacktrace.hh index bf43cc298..d67569ff9 100644 --- a/src/arch/power/stacktrace.hh +++ b/src/arch/power/stacktrace.hh @@ -41,16 +41,6 @@ class StackTrace; namespace PowerISA { -class ProcessInfo -{ - public: - ProcessInfo(ThreadContext *_tc); - - Addr task(Addr ksp) const; - int pid(Addr ksp) const; - std::string name(Addr ksp) const; -}; - class StackTrace { private: diff --git a/src/arch/riscv/stacktrace.cc b/src/arch/riscv/stacktrace.cc index 69159b95f..f495b60ee 100644 --- a/src/arch/riscv/stacktrace.cc +++ b/src/arch/riscv/stacktrace.cc @@ -36,32 +36,6 @@ using namespace std; namespace RiscvISA { -ProcessInfo::ProcessInfo(ThreadContext *_tc) -{ - panic("ProcessInfo constructor not implemented.\n"); -} - -Addr -ProcessInfo::task(Addr ksp) const -{ - panic("ProcessInfo::task not implemented.\n"); - return 0; -} - -int -ProcessInfo::pid(Addr ksp) const -{ - panic("ProcessInfo::pid not implemented.\n"); - return 0; -} - -string -ProcessInfo::name(Addr ksp) const -{ - panic("ProcessInfo::name not implemented.\n"); - return ""; -} - StackTrace::StackTrace() : tc(0), stack(64) { diff --git a/src/arch/riscv/stacktrace.hh b/src/arch/riscv/stacktrace.hh index b88db6926..28134126b 100644 --- a/src/arch/riscv/stacktrace.hh +++ b/src/arch/riscv/stacktrace.hh @@ -41,16 +41,6 @@ class StackTrace; namespace RiscvISA { -class ProcessInfo -{ - public: - ProcessInfo(ThreadContext *_tc); - - Addr task(Addr ksp) const; - int pid(Addr ksp) const; - std::string name(Addr ksp) const; -}; - class StackTrace { private: diff --git a/src/arch/x86/stacktrace.cc b/src/arch/x86/stacktrace.cc index cb9e529ad..2d4e8fbe0 100644 --- a/src/arch/x86/stacktrace.cc +++ b/src/arch/x86/stacktrace.cc @@ -41,72 +41,6 @@ namespace X86ISA { -static int32_t -readSymbol(ThreadContext *tc, const std::string name) -{ - PortProxy &vp = tc->getVirtProxy(); - const auto &symtab = tc->getSystemPtr()->workload->symtab(tc); - - auto it = symtab.find(name); - panic_if(it == symtab.end(), "Thread info not compiled into kernel."); - - return vp.read(it->address, GuestByteOrder); -} - -ProcessInfo::ProcessInfo(ThreadContext *_tc) : tc(_tc) -{ - thread_info_size = readSymbol(tc, "thread_info_size"); - task_struct_size = readSymbol(tc, "task_struct_size"); - task_off = readSymbol(tc, "thread_info_task"); - pid_off = readSymbol(tc, "task_struct_pid"); - name_off = readSymbol(tc, "task_struct_comm"); -} - -Addr -ProcessInfo::task(Addr ksp) const -{ - Addr base = ksp & ~0x3fff; - if (base == ULL(0xfffffc0000000000)) - return 0; - - Addr tsk; - - PortProxy &vp = tc->getVirtProxy(); - tsk = vp.read(base + task_off, GuestByteOrder); - - return tsk; -} - -int -ProcessInfo::pid(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return -1; - - uint16_t pd; - - PortProxy &vp = tc->getVirtProxy(); - pd = vp.read(task + pid_off, GuestByteOrder); - - return pd; -} - -std::string -ProcessInfo::name(Addr ksp) const -{ - Addr task = this->task(ksp); - if (!task) - return "console"; - - char comm[256]; - tc->getVirtProxy().readString(comm, task + name_off, sizeof(comm)); - if (!comm[0]) - return "startup"; - - return comm; -} - StackTrace::StackTrace() : tc(0), stack(64) { diff --git a/src/arch/x86/stacktrace.hh b/src/arch/x86/stacktrace.hh index bd0a4b7ad..8ed89ec5f 100644 --- a/src/arch/x86/stacktrace.hh +++ b/src/arch/x86/stacktrace.hh @@ -36,27 +36,6 @@ class ThreadContext; namespace X86ISA { - class StackTrace; - - class ProcessInfo - { - private: - ThreadContext *tc; - - int thread_info_size; - int task_struct_size; - int task_off; - int pid_off; - int name_off; - - public: - ProcessInfo(ThreadContext *_tc); - - Addr task(Addr ksp) const; - int pid(Addr ksp) const; - std::string name(Addr ksp) const; - }; - class StackTrace { private: -- 2.30.2