Class: Unarm::Ins
Constant Summary
Constants included
from UnarmBind
UnarmBind::ARGUMENT_KIND, UnarmBind::ARGUMENT_KIND_MAP, UnarmBind::Arg, UnarmBind::Args, UnarmBind::CONDITION, UnarmBind::CONDITION_MAP, UnarmBind::CO_REG, UnarmBind::CO_REG_MAP, UnarmBind::ENDIAN, UnarmBind::ENDIAN_MAP, UnarmBind::OPCODE, UnarmBind::OPCODE_MNEMONIC, UnarmBind::REGISTER, UnarmBind::REGISTER_MAP, UnarmBind::SHIFT, UnarmBind::SHIFT_MAP, UnarmBind::STATUS_REG, UnarmBind::STATUS_REG_MAP
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#address ⇒ Object
Also known as:
addr
Returns the value of attribute address.
614
615
616
|
# File 'lib/unarm/unarm.rb', line 614
def address
@address
end
|
#arguments ⇒ Object
Also known as:
args
Returns the value of attribute arguments.
614
615
616
|
# File 'lib/unarm/unarm.rb', line 614
def arguments
@arguments
end
|
#raw ⇒ Object
Returns the value of attribute raw.
614
615
616
|
# File 'lib/unarm/unarm.rb', line 614
def raw
@raw
end
|
Instance Method Details
#branch_destination ⇒ Object
Also known as:
branch_dest
671
672
673
674
675
|
# File 'lib/unarm/unarm.rb', line 671
def branch_destination
arg = @arguments.find {|a| a.kind == :branch_dest}
return nil if !arg
arg.value + @address
end
|
#branch_to_register? ⇒ Boolean
Also known as:
branch_to_reg?
687
688
689
690
|
# File 'lib/unarm/unarm.rb', line 687
def branch_to_register?
opcode == :bx ||
(mnemonic == 'mov' && args[0].value.reg == :pc) || (mnemonic == 'ldr' && args[0].value.reg == :pc)
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
629
630
631
|
# File 'lib/unarm/unarm.rb', line 629
def eql?(other)
@raw == other.raw
end
|
#function_end? ⇒ Boolean
693
694
695
696
697
698
699
|
# File 'lib/unarm/unarm.rb', line 693
def function_end?
return false if conditional?
branch_to_register? ||
(mnemonic == 'pop' && args[0].value.contains?(:pc)) ||
(mnemonic == 'ldm' && args[0].value.reg == :sp && args[1].value.contains?(:pc))
end
|
#has_imod? ⇒ Boolean
does instruction modify interrupt flags?
667
668
669
|
# File 'lib/unarm/unarm.rb', line 667
def has_imod? opcode == :cps
end
|
#is_conditional? ⇒ Boolean
Also known as:
conditional?
642
643
644
|
# File 'lib/unarm/unarm.rb', line 642
def is_conditional?
@conditional
end
|
#is_data_operation? ⇒ Boolean
Also known as:
is_data_op?
652
653
654
|
# File 'lib/unarm/unarm.rb', line 652
def is_data_operation?
@data_op
end
|
#is_illegal? ⇒ Boolean
Also known as:
illegal?
657
658
659
|
# File 'lib/unarm/unarm.rb', line 657
def is_illegal?
opcode == :illegal
end
|
#is_unconditional? ⇒ Boolean
Also known as:
unconditional?
647
648
649
|
# File 'lib/unarm/unarm.rb', line 647
def is_unconditional?
!@conditional
end
|
#opcode ⇒ Object
634
635
636
|
# File 'lib/unarm/unarm.rb', line 634
def opcode
UnarmBind::OPCODE[@opcode_id]
end
|
#sets_flags? ⇒ Boolean
Also known as:
updates_condition_flags?
662
663
664
|
# File 'lib/unarm/unarm.rb', line 662
def sets_flags?
@sets_flags
end
|
#size ⇒ Object
Also known as:
ins_size
619
620
621
|
# File 'lib/unarm/unarm.rb', line 619
def size
@@size
end
|
#string ⇒ Object
Also known as:
str
624
625
626
|
# File 'lib/unarm/unarm.rb', line 624
def string
@str.to_s
end
|
#target_address ⇒ Object
Also known as:
target_addr
678
679
680
681
682
683
684
|
# File 'lib/unarm/unarm.rb', line 678
def target_address
if opcode == :ldr && args[1].kind == :reg && args[1].value.reg == :pc && args[2].kind == :offset_imm
address + args[2].value.value + 8
else
nil
end
end
|