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 <noreply+kokoro@google.com>
Reviewed-by: Boris Shingarov <shingarov@labware.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Gabe Black
2021-07-25 01:44:38 -07:00
parent 7d92144e1b
commit 645c6b3ceb
2 changed files with 10 additions and 9 deletions

View File

@@ -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<FpDisabled>();
}
} else {
PSTATE pstate = xc->readMiscReg(MISCREG_PSTATE);
if (pstate.pef && xc->readMiscReg(MISCREG_FPRS) & 0x4) {
return NoFault;
} else {
return std::make_shared<FpDisabled>();
}
}
}};

View File

@@ -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);