class Operand:
name: str
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
raise NotImplementedError
@_dataclasses.dataclass(eq=True, frozen=True)
class DynamicOperand(Operand):
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
span = record.fields[self.name]
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
return _SVExtra.NONE
- def disassemble(self, insn, record, verbose=False, prefix="", indent="",
- short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, prefix="", indent=""):
(vector, value, span) = self.spec(insn=insn, record=record)
if verbose:
class StaticOperand(Operand):
value: int
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
span = record.fields[self.name]
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
@_dataclasses.dataclass(eq=True, frozen=True)
class DynamicOperandTargetAddr(DynamicOperandReg):
- def disassemble(self, insn, record, field, verbose=False, indent="",
- short=False):
+ def disassemble(self, insn, record, field,
+ short=False, verbose=False, indent=""):
span = record.fields[field]
if isinstance(insn, SVP64Instruction):
span = tuple(map(lambda bit: (bit + 32), span))
@_dataclasses.dataclass(eq=True, frozen=True)
class DynamicOperandTargetAddrLI(DynamicOperandTargetAddr):
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
return super().disassemble(field="LI",
- insn=insn, record=record, verbose=verbose, indent=indent,
- short=short)
+ insn=insn, record=record,
+ short=short, verbose=verbose, indent=indent)
class DynamicOperandTargetAddrBD(DynamicOperandTargetAddr):
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
return super().disassemble(field="BD",
- insn=insn, record=record, verbose=verbose, indent=indent,
- short=short)
+ insn=insn, record=record,
+ short=short, verbose=verbose, indent=indent)
@_dataclasses.dataclass(eq=True, frozen=True)
class DynamicOperandGPR(DynamicOperandReg):
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
prefix = "" if short else "r"
yield from super().disassemble(prefix=prefix,
- insn=insn, record=record, verbose=verbose, indent=indent,
- short=short)
+ insn=insn, record=record,
+ short=short, verbose=verbose, indent=indent)
@_dataclasses.dataclass(eq=True, frozen=True)
class DynamicOperandFPR(DynamicOperandReg):
- def disassemble(self, insn, record, verbose=False, indent="", short=False):
+ def disassemble(self, insn, record,
+ short=False, verbose=False, indent=""):
prefix = "" if short else "f"
yield from super().disassemble(prefix=prefix,
- insn=insn, record=record, verbose=verbose, indent=indent,
- short=short)
+ insn=insn, record=record,
+ short=short, verbose=verbose, indent=indent)
class Operands(tuple):
imm_value = ""
for operand in record.operands.dynamic:
name = operand.name
- value = " ".join(operand.disassemble(insn=self,
- record=record, verbose=False, short=short))
+ dis = operand.disassemble(insn=self, record=record,
+ short=short, verbose=False)
+ value = " ".join(dis)
if imm:
name = f"{imm_name}({name})"
value = f"{imm_value}({value})"
for operand in record.operands.static:
yield (operand.name, operand.value)
- def disassemble(self, db, byteorder="little", verbose=False, short=False):
+ def disassemble(self, db, byteorder="little",
+ short=False, verbose=False):
raise NotImplementedError
record = self.record(db=db)
return f"0x{record.opcode.mask:08x}"
- def disassemble(self, db, byteorder="little", verbose=False, short=False):
+ def disassemble(self, db, byteorder="little",
+ verbose=False, short=False):
integer = int(self)
if short:
blob = ""
yield f"{indent}mask"
yield f"{indent}{indent}{mask}"
for operand in record.operands:
- yield from operand.disassemble(insn=self,
- record=record, verbose=True, indent=indent, short=short)
+ yield from operand.disassemble(insn=self, record=record,
+ short=short, verbose=True, indent=indent)
yield ""
raise ValueError(self)
- def disassemble(self, db, byteorder="little", verbose=False, short=False):
+ def disassemble(self, db, byteorder="little",
+ short=False, verbose=False):
integer_prefix = int(self.prefix)
blob_prefix = integer_prefix.to_bytes(length=4, byteorder=byteorder)
blob_prefix = " ".join(map(lambda byte: f"{byte:02x}", blob_prefix))
yield f"{indent}mask"
yield f"{indent}{indent}{mask}"
for operand in record.operands:
- yield from operand.disassemble(insn=self,
- record=record, verbose=True, indent=indent, short=short)
+ yield from operand.disassemble(insn=self, record=record,
+ short=short, verbose=True, indent=indent)
yield f"{indent}mode"
yield f"{indent}{indent}{mode_desc}"