arch: Mark FailUnimplemented instructions as Invalid instructions (#1247)

This is a follow-up on the discussion here [1].

The IsInvalid flag was previously defined as an instruction that does
not appear in the ISA. However, a micro-architecture can choose to not
recognize an instruction in and raise illegal instruction fault even if
the instruction is in the ISA.

This change modifies the definition of a Invalid instruction such that,
if a StaticInst instruction is marked as IsInvalid, it means the
instruction is not recognized by the decoder. This means that any
instruction recognized by the decoder are not invalid, even if the
instruction is not in the official ISA spec; e.g., m5
pseudo-instructions.

Note that instructions that are recognized by the decoder but are chosen
to act as a nop are not invalid. This applies to WarnUnimplemented
instructions, e.g. hint instructions.

[1] https://github.com/gem5/gem5/pull/1071

Change-Id: I1371b222d8b06793d47f434d0f148c5571672068

Signed-off-by: Hoa Nguyen <hn@hnpl.org>
This commit is contained in:
Hoa Nguyen
2024-06-17 12:44:05 -07:00
committed by GitHub
parent 2804311f7b
commit 500da4306b
5 changed files with 8 additions and 1 deletions

View File

@@ -116,6 +116,7 @@ FailUnimplemented::FailUnimplemented(const char *_mnemonic,
// don't call execute() (which panics) if we're on a
// speculative path
flags[IsNonSpeculative] = true;
flags[IsInvalid] = true;
}
FailUnimplemented::FailUnimplemented(const char *_mnemonic,
@@ -127,6 +128,7 @@ FailUnimplemented::FailUnimplemented(const char *_mnemonic,
// don't call execute() (which panics) if we're on a
// speculative path
flags[IsNonSpeculative] = true;
flags[IsInvalid] = true;
}
Fault

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

@@ -51,6 +51,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

@@ -59,7 +59,9 @@ class FailUnimplemented : public SparcStaticInst
/// Constructor
FailUnimplemented(const char *_mnemonic, ExtMachInst _machInst) :
SparcStaticInst(_mnemonic, _machInst, No_OpClass)
{}
{
flags[IsInvalid] = true;
}
Fault
execute(ExecContext *xc, trace::InstRecord *traceData) const override

View File

@@ -58,6 +58,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;