diff options
| author | Mark Rowe <mark@vector35.com> | 2026-06-03 21:25:55 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-06-04 14:31:09 -0700 |
| commit | d592ed6dafbb134553bf3a0b8ee70ff7f2049aba (patch) | |
| tree | 1bfe7e335e5b4e21371cde4bf8858c6439bc3f18 /python | |
| parent | 9987102015875991813200116558306851763009 (diff) | |
Add bswap, popcnt, clz, ctz, cls, and rbit instructions
Diffstat (limited to 'python')
| -rw-r--r-- | python/highlevelil.py | 44 | ||||
| -rw-r--r-- | python/lowlevelil.py | 44 | ||||
| -rw-r--r-- | python/mediumlevelil.py | 44 |
3 files changed, 129 insertions, 3 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py index 4c81f687..bbeb0186 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -248,7 +248,13 @@ class HighLevelILInstruction(BaseILInstruction): ("left", "expr"), ("right", "expr") ], HighLevelILOperation.HLIL_MODS_DP: [("left", "expr"), ("right", "expr")], HighLevelILOperation.HLIL_NEG: [ ("src", "expr") - ], HighLevelILOperation.HLIL_NOT: [("src", "expr")], HighLevelILOperation.HLIL_SX: [ + ], HighLevelILOperation.HLIL_NOT: [("src", "expr")], HighLevelILOperation.HLIL_BSWAP: [ + ("src", "expr") + ], HighLevelILOperation.HLIL_POPCNT: [("src", "expr")], HighLevelILOperation.HLIL_CLZ: [ + ("src", "expr") + ], HighLevelILOperation.HLIL_CTZ: [("src", "expr")], HighLevelILOperation.HLIL_RBIT: [ + ("src", "expr") + ], HighLevelILOperation.HLIL_CLS: [("src", "expr")], HighLevelILOperation.HLIL_SX: [ ("src", "expr") ], HighLevelILOperation.HLIL_ZX: [("src", "expr")], HighLevelILOperation.HLIL_LOW_PART: [ ("src", "expr") @@ -1984,6 +1990,36 @@ class HighLevelILNot(HighLevelILUnaryBase, Arithmetic): @dataclass(frozen=True, repr=False, eq=False) +class HighLevelILBswap(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class HighLevelILPopcnt(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class HighLevelILClz(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class HighLevelILCtz(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class HighLevelILRbit(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class HighLevelILCls(HighLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) class HighLevelILSx(HighLevelILUnaryBase, Arithmetic): pass @@ -2478,6 +2514,12 @@ ILInstruction = { HighLevelILOperation.HLIL_MODS_DP: HighLevelILModsDp, # ("left", "expr"), ("right", "expr"), HighLevelILOperation.HLIL_NEG: HighLevelILNeg, # ("src", "expr"), HighLevelILOperation.HLIL_NOT: HighLevelILNot, # ("src", "expr"), + HighLevelILOperation.HLIL_BSWAP: HighLevelILBswap, # ("src", "expr"), + HighLevelILOperation.HLIL_POPCNT: HighLevelILPopcnt, # ("src", "expr"), + HighLevelILOperation.HLIL_CLZ: HighLevelILClz, # ("src", "expr"), + HighLevelILOperation.HLIL_CTZ: HighLevelILCtz, # ("src", "expr"), + HighLevelILOperation.HLIL_RBIT: HighLevelILRbit, # ("src", "expr"), + HighLevelILOperation.HLIL_CLS: HighLevelILCls, # ("src", "expr"), HighLevelILOperation.HLIL_SX: HighLevelILSx, # ("src", "expr"), HighLevelILOperation.HLIL_ZX: HighLevelILZx, # ("src", "expr"), HighLevelILOperation.HLIL_LOW_PART: HighLevelILLowPart, # ("src", "expr"), diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 714b663d..ce9770f2 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -377,7 +377,13 @@ class LowLevelILInstruction(BaseILInstruction): ("left", "expr"), ("right", "expr") ], LowLevelILOperation.LLIL_MODS_DP: [("left", "expr"), ("right", "expr")], LowLevelILOperation.LLIL_NEG: [ ("src", "expr") - ], LowLevelILOperation.LLIL_NOT: [("src", "expr")], LowLevelILOperation.LLIL_SX: [ + ], LowLevelILOperation.LLIL_NOT: [("src", "expr")], LowLevelILOperation.LLIL_BSWAP: [ + ("src", "expr") + ], LowLevelILOperation.LLIL_POPCNT: [("src", "expr")], LowLevelILOperation.LLIL_CLZ: [ + ("src", "expr") + ], LowLevelILOperation.LLIL_CTZ: [("src", "expr")], LowLevelILOperation.LLIL_RBIT: [ + ("src", "expr") + ], LowLevelILOperation.LLIL_CLS: [("src", "expr")], LowLevelILOperation.LLIL_SX: [ ("src", "expr") ], LowLevelILOperation.LLIL_ZX: [("src", "expr")], LowLevelILOperation.LLIL_LOW_PART: [ ("src", "expr") @@ -1363,6 +1369,36 @@ class LowLevelILNot(LowLevelILUnaryBase, Arithmetic): @dataclass(frozen=True, repr=False, eq=False) +class LowLevelILBswap(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class LowLevelILPopcnt(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class LowLevelILClz(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class LowLevelILCtz(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class LowLevelILRbit(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class LowLevelILCls(LowLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) class LowLevelILSx(LowLevelILUnaryBase, Arithmetic): pass @@ -3132,6 +3168,12 @@ ILInstruction:Dict[LowLevelILOperation, LowLevelILInstruction] = { # type: igno LowLevelILOperation.LLIL_MODS_DP: LowLevelILModsDp, # [("left", "expr"), ("right", "expr")], LowLevelILOperation.LLIL_NEG: LowLevelILNeg, # [("src", "expr")], LowLevelILOperation.LLIL_NOT: LowLevelILNot, # [("src", "expr")], + LowLevelILOperation.LLIL_BSWAP: LowLevelILBswap, # [("src", "expr")], + LowLevelILOperation.LLIL_POPCNT: LowLevelILPopcnt, # [("src", "expr")], + LowLevelILOperation.LLIL_CLZ: LowLevelILClz, # [("src", "expr")], + LowLevelILOperation.LLIL_CTZ: LowLevelILCtz, # [("src", "expr")], + LowLevelILOperation.LLIL_RBIT: LowLevelILRbit, # [("src", "expr")], + LowLevelILOperation.LLIL_CLS: LowLevelILCls, # [("src", "expr")], LowLevelILOperation.LLIL_SX: LowLevelILSx, # [("src", "expr")], LowLevelILOperation.LLIL_ZX: LowLevelILZx, # [("src", "expr")], LowLevelILOperation.LLIL_LOW_PART: LowLevelILLowPart, # [("src", "expr")], diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 155a3751..15db8ae1 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -265,7 +265,13 @@ class MediumLevelILInstruction(BaseILInstruction): ("right", "expr")], MediumLevelILOperation.MLIL_MODS_DP: [("left", "expr"), ("right", "expr")], MediumLevelILOperation.MLIL_NEG: [ ("src", "expr") - ], MediumLevelILOperation.MLIL_NOT: [("src", "expr")], MediumLevelILOperation.MLIL_SX: [ + ], MediumLevelILOperation.MLIL_NOT: [("src", "expr")], MediumLevelILOperation.MLIL_BSWAP: [ + ("src", "expr") + ], MediumLevelILOperation.MLIL_POPCNT: [("src", "expr")], MediumLevelILOperation.MLIL_CLZ: [ + ("src", "expr") + ], MediumLevelILOperation.MLIL_CTZ: [("src", "expr")], MediumLevelILOperation.MLIL_RBIT: [ + ("src", "expr") + ], MediumLevelILOperation.MLIL_CLS: [("src", "expr")], MediumLevelILOperation.MLIL_SX: [ ("src", "expr") ], MediumLevelILOperation.MLIL_ZX: [("src", "expr")], MediumLevelILOperation.MLIL_LOW_PART: [ ("src", "expr") @@ -1435,6 +1441,36 @@ class MediumLevelILNot(MediumLevelILUnaryBase, Arithmetic): @dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILBswap(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILPopcnt(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILClz(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILCtz(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILRbit(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) +class MediumLevelILCls(MediumLevelILUnaryBase, Arithmetic): + pass + + +@dataclass(frozen=True, repr=False, eq=False) class MediumLevelILSx(MediumLevelILUnaryBase, Arithmetic): pass @@ -3444,6 +3480,12 @@ ILInstruction = { MediumLevelILOperation.MLIL_MODS_DP: MediumLevelILModsDp, # [("left", "expr"), ("right", "expr")], MediumLevelILOperation.MLIL_NEG: MediumLevelILNeg, # [("src", "expr")], MediumLevelILOperation.MLIL_NOT: MediumLevelILNot, # [("src", "expr")], + MediumLevelILOperation.MLIL_BSWAP: MediumLevelILBswap, # [("src", "expr")], + MediumLevelILOperation.MLIL_POPCNT: MediumLevelILPopcnt, # [("src", "expr")], + MediumLevelILOperation.MLIL_CLZ: MediumLevelILClz, # [("src", "expr")], + MediumLevelILOperation.MLIL_CTZ: MediumLevelILCtz, # [("src", "expr")], + MediumLevelILOperation.MLIL_RBIT: MediumLevelILRbit, # [("src", "expr")], + MediumLevelILOperation.MLIL_CLS: MediumLevelILCls, # [("src", "expr")], MediumLevelILOperation.MLIL_SX: MediumLevelILSx, # [("src", "expr")], MediumLevelILOperation.MLIL_ZX: MediumLevelILZx, # [("src", "expr")], MediumLevelILOperation.MLIL_LOW_PART: MediumLevelILLowPart, # [("src", "expr")], |
