From 645c6b3ceb20d20197e94eb26b4ede5dcd1a4a6f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 25 Jul 2021 01:44:38 -0700 Subject: [PATCH] sparc: Stop special casing FP enable checks for full system. Set the actual state which gets checked in full system, and then do that all the time. Change-Id: I27ea0939ad71f7399b676e22ec2e73e3e0dd6476 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48716 Tested-by: kokoro Reviewed-by: Boris Shingarov Maintainer: Gabe Black --- src/arch/sparc/isa/base.isa | 14 +++++--------- src/arch/sparc/process.cc | 5 +++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/arch/sparc/isa/base.isa b/src/arch/sparc/isa/base.isa index 89e48f03a4..9adc5ee9de 100644 --- a/src/arch/sparc/isa/base.isa +++ b/src/arch/sparc/isa/base.isa @@ -121,19 +121,15 @@ output exec {{ /// Check "FP enabled" machine status bit. Called when executing any FP /// instruction. /// @retval Full-system mode: NoFault if FP is enabled, FpDisabled - /// if not. Non-full-system mode: always returns NoFault. + /// if not. static inline Fault checkFpEnableFault(ExecContext *xc) { - if (FullSystem) { - PSTATE pstate = xc->readMiscReg(MISCREG_PSTATE); - if (pstate.pef && xc->readMiscReg(MISCREG_FPRS) & 0x4) { - return NoFault; - } else { - return std::make_shared(); - } - } else { + PSTATE pstate = xc->readMiscReg(MISCREG_PSTATE); + if (pstate.pef && xc->readMiscReg(MISCREG_FPRS) & 0x4) { return NoFault; + } else { + return std::make_shared(); } } }}; diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index e774b95809..2ae9d4aa1b 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -102,6 +102,9 @@ SparcProcess::initState() // Set the MMU Primary Context Register to hold the process' pid tc->setMiscReg(MISCREG_MMU_P_CONTEXT, _pid); + // Enable floating point. + tc->setMiscReg(MISCREG_FPRS, 0x4); + /* * T1 specific registers */ @@ -117,6 +120,7 @@ Sparc32Process::initState() ThreadContext *tc = system->threads[contextIds[0]]; // The process runs in user mode with 32 bit addresses PSTATE pstate = 0; + pstate.pef = 1; pstate.ie = 1; pstate.am = 1; tc->setMiscReg(MISCREG_PSTATE, pstate); @@ -132,6 +136,7 @@ Sparc64Process::initState() ThreadContext *tc = system->threads[contextIds[0]]; // The process runs in user mode PSTATE pstate = 0; + pstate.pef = 1; pstate.ie = 1; tc->setMiscReg(MISCREG_PSTATE, pstate);