added fallback search in arch/ISA model for ARM instructions with shape/cc suffixes

This commit is contained in:
JanLJL
2023-03-03 15:11:40 +01:00
parent 2884d17971
commit 9f715c0ba3
3 changed files with 71 additions and 3 deletions

View File

@@ -192,11 +192,25 @@ class ArchSemantics(ISASemantics):
instruction_data = self._machine_model.get_instruction(
instruction_form["instruction"], instruction_form["operands"]
)
if not instruction_data and instruction_form["instruction"][-1] in self.GAS_SUFFIXES:
if (
not instruction_data
and self._isa == "x86"
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
):
# check for instruction without GAS suffix
instruction_data = self._machine_model.get_instruction(
instruction_form["instruction"][:-1], instruction_form["operands"]
)
if (
instruction_data is None
and self._isa == "aarch64"
and "." in instruction_form["instruction"]
):
# Check for instruction without shape/cc suffix
suffix_start = instruction_form["instruction"].index(".")
instruction_data = self._machine_model.get_instruction(
instruction_form["instruction"][:suffix_start], instruction_form["operands"]
)
if instruction_data:
# instruction form in DB
(
@@ -223,12 +237,23 @@ class ArchSemantics(ISASemantics):
)
if (
not instruction_data_reg
and self._isa == "x86"
and instruction_form["instruction"][-1] in self.GAS_SUFFIXES
):
# check for instruction without GAS suffix
instruction_data_reg = self._machine_model.get_instruction(
instruction_form["instruction"][:-1], operands
)
if (
instruction_data_reg is None
and self._isa == "aarch64"
and "." in instruction_form["instruction"]
):
# Check for instruction without shape/cc suffix
suffix_start = instruction_form["instruction"].index(".")
instruction_data_reg = self._machine_model.get_instruction(
instruction_form["instruction"][:suffix_start], operands
)
if instruction_data_reg:
assign_unknown = False
reg_type = self._parser.get_reg_type(