cpu,arch: Add IsInvalid flag to Unknown insts (#1071)

The IsInvalid flag indicates that the static instruction is not part of
the executing ISA and not part of m5's pseudo-instructions. This flag
provides a way to recognize an illegal instruction at the decode stage.
This commit is contained in:
Jason Lowe-Power
2024-06-13 16:26:35 -07:00
committed by GitHub
9 changed files with 15 additions and 4 deletions

View File

@@ -848,7 +848,8 @@ let {{
'''
unknownIop = ArmInstObjParams("unknown", "Unknown", "UnknownOp", \
{ "code": unknownCode,
"predicate_test": predicateTest })
"predicate_test": predicateTest },
['IsInvalid'])
header_output += BasicDeclare.subst(unknownIop)
decoder_output += BasicConstructor.subst(unknownIop)
exec_output += PredOpExecute.subst(unknownIop)

View File

@@ -183,7 +183,7 @@ let {{
return std::make_shared<UndefinedInstruction>(machInst, true);
'''
unknown64Iop = ArmInstObjParams("unknown", "Unknown64", "UnknownOp64",
unknownCode)
unknownCode, ['IsInvalid'])
header_output += BasicDeclare.subst(unknown64Iop)
decoder_output += BasicConstructor64.subst(unknown64Iop)
exec_output += BasicExecute.subst(unknown64Iop)

View File

@@ -47,6 +47,7 @@ output header {{
// don't call execute() (which panics) if we're on a
// speculative path
flags[IsNonSpeculative] = true;
flags[IsInvalid] = true;
}
Fault execute(ExecContext *, trace::InstRecord *) const override;

View File

@@ -49,6 +49,7 @@ output header {{
// don't call execute() (which panics) if we're on a
// speculative path
flags[IsNonSpeculative] = true;
flags[IsInvalid] = true;
}
Fault execute(ExecContext *, trace::InstRecord *) const override;

View File

@@ -54,7 +54,9 @@ class Unknown : public RiscvStaticInst
public:
Unknown(ExtMachInst _machInst)
: RiscvStaticInst("unknown", _machInst, No_OpClass)
{}
{
flags[IsInvalid] = true;
}
Fault
execute(ExecContext *, trace::InstRecord *) const override

View File

@@ -47,7 +47,9 @@ class Unknown : public SparcStaticInst
// Constructor
Unknown(ExtMachInst _machInst) :
SparcStaticInst("unknown", _machInst, No_OpClass)
{}
{
flags[IsInvalid] = true;
}
Fault
execute(ExecContext *, trace::InstRecord *) const override

View File

@@ -53,6 +53,7 @@ output header {{
Unknown(ExtMachInst _machInst) :
X86ISA::X86StaticInst("unknown", _machInst, No_OpClass)
{
flags[IsInvalid] = true;
}
Fault execute(ExecContext *, trace::InstRecord *) const override;

View File

@@ -99,4 +99,5 @@ class StaticInstFlags(Enum):
"IsHtmStart", # Starts a HTM transaction
"IsHtmStop", # Stops (commits) a HTM transaction
"IsHtmCancel", # Explicitely aborts a HTM transaction
"IsInvalid", # An invalid instruction
]

View File

@@ -196,6 +196,8 @@ class StaticInst : public RefCounted, public StaticInstFlags
bool isHtmStop() const { return flags[IsHtmStop]; }
bool isHtmCancel() const { return flags[IsHtmCancel]; }
bool isInvalid() const { return flags[IsInvalid]; }
bool
isHtmCmd() const
{