Class: Fisk::AbsoluteJumpInstruction

Inherits:
Object
  • Object
show all
Includes:
InstructionPredicates
Defined in:
lib/fisk.rb

Instance Method Summary collapse

Methods included from InstructionPredicates

#comment?, #has_temp_registers?, #label?, #lazy?, #retry?

Constructor Details

#initialize(insn, form, operand) ⇒ AbsoluteJumpInstruction

Returns a new instance of AbsoluteJumpInstruction.



435
436
437
438
439
440
# File 'lib/fisk.rb', line 435

def initialize insn, form, operand
  @insn       = insn
  @form       = form
  @operand    = operand
  @must_retry = false
end

Instance Method Details

#encode(buffer, labels) ⇒ Object



450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/fisk.rb', line 450

def encode buffer, labels
  form              = find_form "rel32"
  encoding          = form.encodings.first
  operand_klass     = Rel32

  pos = buffer.pos
  rel_jump = 0xCAFE
  2.times do
    buffer.seek pos, IO::SEEK_SET
    encoding.encode buffer, [operand_klass.new(rel_jump)]
    rel_jump = @operand.value - buffer.address
  end
end

#jump?Boolean

Returns:

  • (Boolean)


442
443
444
# File 'lib/fisk.rb', line 442

def jump?
  true
end

#targetObject



446
447
448
# File 'lib/fisk.rb', line 446

def target
  @operand.name
end