Class: OneGadget::Emulators::ArmFamily

Inherits:
Processor
  • Object
show all
Defined in:
lib/one_gadget/emulators/arm_family.rb

Overview

Behaviour shared by the two ARM-architecture emulators, Arm (AArch32) and AArch64: the condition-code table plus the parts of the calling convention and memory model that are identical in 32- and 64-bit mode. The common base each inherits (the ARM counterpart of X86); everything that genuinely differs (instruction set, register width, pc handling) stays in the individual classes.

Direct Known Subclasses

AArch64, Arm

Constant Summary collapse

COND =

ARM condition-code suffix (the <cc> in b<cc> / b.<cc>) mapped to a shared Conditional::RELATION predicate. Decodes the opaque mnemonics once: +hs+/+cs+ and +lo+/+cc+ are aliases; +mi+/+pl+ (sign bit) act as signed +</+>=+. +vs+/+vc+ (overflow) have no constraint form and are absent, so a branch on them maps to nil and aborts the path. (x86 uses X86::JCC.)

{
  'eq' => :eq, 'ne' => :ne,
  'hs' => :uge, 'cs' => :uge, 'lo' => :ult, 'cc' => :ult,
  'hi' => :ugt, 'ls' => :ule,
  'ge' => :sge, 'lt' => :slt, 'gt' => :sgt, 'le' => :sle,
  'mi' => :slt, 'pl' => :sge
}.freeze
COMPARES =

This arch family's flag-setting compare mnemonics, mapped to the ALU op whose result their flags reflect (see Conditional::COMPARE_OPS). x86 has its own X86::COMPARES.

{ 'cmp' => :sub, 'cmn' => :add, 'tst' => :and }.freeze

Constants inherited from Processor

Processor::ADDRESS_TYPES, Processor::CLOBBERED, Processor::NULLABLE_REQUIREMENTS, Processor::POINTER_REQUIREMENTS, Processor::TERMINAL_CALL_RE

Constants included from Conditional

Conditional::COMPARE_OPS, Conditional::NEGATE, Conditional::RELATION

Instance Attribute Summary

Attributes inherited from Processor

#bp, #pc, #refused_line, #registers, #sp

Method Summary

Methods inherited from Processor

#address_deref0?, #argument, bits, #bp_based_stack, #closed_fds, #constraint_key, #constraints, #drop_implied_nonzero, #drop_restated_null, #get_corresponding_stack, #initialize, instruction_table, #instructions, line_memo, #parse, #process, #process!, #reach_terminal_call, #render_constraint, #resolve_address, #setup_frame_pointer, #sp_based_stack, #terminal_call?

Methods included from Conditional

#branch_on_bit, #branch_on_compare, #branch_on_zero, #comparisons_on, #mnemonic, #operand_str, #record_compare, #resolve_pending_branch, #satisfiable?, #value_str

Constructor Details

This class inherits a constructor from OneGadget::Emulators::Processor