From 6a7a5b30050d10a7d9cc9cd5614988871253298d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 29 Jan 2020 15:41:59 -0800 Subject: arch,sim: Merge initCPU and startupCPU. These two functions were called in exactly one place one right after the other, and served similar purposes. This change merges them together, and cleans them up slightly. It also removes checks for FullSystem, since those functions are only called in full system to begin with. Change-Id: I214f7d2d3f88960dccb5895c1241f61cd78716a8 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24904 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/arch/sparc/faults.hh | 3 ++- src/arch/sparc/utility.cc | 9 ++++++--- src/arch/sparc/utility.hh | 8 -------- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src/arch/sparc') diff --git a/src/arch/sparc/faults.hh b/src/arch/sparc/faults.hh index 2c44d51d4..b3827fc77 100644 --- a/src/arch/sparc/faults.hh +++ b/src/arch/sparc/faults.hh @@ -99,7 +99,8 @@ class SparcFault : public SparcFaultBase class PowerOnReset : public SparcFault { - void invoke(ThreadContext * tc, const StaticInstPtr &inst = + public: + void invoke(ThreadContext *tc, const StaticInstPtr &inst = StaticInst::nullStaticInstPtr); }; diff --git a/src/arch/sparc/utility.cc b/src/arch/sparc/utility.cc index 5b05eaf71..245f455e4 100644 --- a/src/arch/sparc/utility.cc +++ b/src/arch/sparc/utility.cc @@ -257,9 +257,12 @@ skipFunction(ThreadContext *tc) void initCPU(ThreadContext *tc, int cpuId) { - static Fault por = std::make_shared(); - if (cpuId == 0) - por->invoke(tc); + // Other CPUs will get activated by IPIs. + if (cpuId != 0) + return; + + PowerOnReset().invoke(tc); + tc->activate(); } } // namespace SPARC_ISA diff --git a/src/arch/sparc/utility.hh b/src/arch/sparc/utility.hh index 48476cb04..74e0c11b8 100644 --- a/src/arch/sparc/utility.hh +++ b/src/arch/sparc/utility.hh @@ -64,14 +64,6 @@ inUserMode(ThreadContext *tc) void initCPU(ThreadContext *tc, int cpuId); -inline void -startupCPU(ThreadContext *tc, int cpuId) -{ - // Other CPUs will get activated by IPIs - if (cpuId == 0 || !FullSystem) - tc->activate(); -} - void copyRegs(ThreadContext *src, ThreadContext *dest); void copyMiscRegs(ThreadContext *src, ThreadContext *dest); -- cgit v1.2.3