PowerPC

Instruction

Inheritance diagram of lief._lief.assembly.powerpc.Instruction
class lief.assembly.powerpc.Instruction

Bases: Instruction

This class represents a PowerPC (ppc64/ppc32) instruction

property opcode lief.assembly.powerpc.OPCODE

The instruction opcode as defined in LLVM

property operands Iterator[lief.assembly.powerpc.Operand | None]

Iterator over the operands of the current instruction

Opcodes

See: lief.assembly.powerpc.OPCODE

Operands

Inheritance diagram of lief._lief.assembly.powerpc.operands.PCRelative, lief._lief.assembly.powerpc.Operand, lief._lief.assembly.powerpc.operands.Memory, lief._lief.assembly.powerpc.operands.Register, lief._lief.assembly.powerpc.operands.Immediate
class lief.assembly.powerpc.Operand

Bases: object

This class represents an operand for a PowerPC instruction

property to_string str

Pretty representation of the operand

Immediate

Inheritance diagram of lief._lief.assembly.powerpc.operands.Immediate
class lief.assembly.powerpc.operands.Immediate

Bases: Operand

This class represents an immediate operand (i.e. a constant)

For instance:

li 3, 8
      |
      +---> Immediate(8)
property value int

The constant value wrapped by this operand

Register

Inheritance diagram of lief._lief.assembly.powerpc.operands.Register
class lief.assembly.powerpc.operands.Register

Bases: Operand

This class represents a register operand.

For instance:

add 3, 4, 5
     |  |  |
     |  |  +---------> Register(5)
     |  +------------> Register(4)
     +---------------> Register(3)
property value lief.assembly.powerpc.REG

The effective lief.assembly.powerpc.REG wrapped by this operand

Memory

Inheritance diagram of lief._lief.assembly.powerpc.operands.Memory
class lief.assembly.powerpc.operands.Memory

Bases: Operand

This class represents a memory operand.

lwz   3, 8(4)              lwzx   3, 4, 5
       |  |                       |  |  |
+------+  +---+            +------+   |  +---+
|             |           |          |      |
v             v           v          v      v
Disp         Base        Reg        Base   Index
property base lief.assembly.powerpc.REG

The base register.

For lwz 3, 8(4) it would return 4.

property offset lief.assembly.powerpc.REG | int | None

The addressing offset.

It can be either:

  • An index register (e.g. lwzx 3, 4, 5)

  • A displacement (e.g. lwz 3, 8(4))

PCRelative

Inheritance diagram of lief._lief.assembly.powerpc.operands.PCRelative
class lief.assembly.powerpc.operands.PCRelative

Bases: Operand

This class represents a PC-relative operand.

bl 0x100
   |
   v
 PC Relative operand
property value int

The effective value that is relative to the current pc register