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.



409
410
411
412
413
414
# File 'lib/fisk.rb', line 409

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

Instance Method Details

#encode(buffer, labels) ⇒ Object



424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/fisk.rb', line 424

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)


416
417
418
# File 'lib/fisk.rb', line 416

def jump?
  true
end

#targetObject



420
421
422
# File 'lib/fisk.rb', line 420

def target
  @operand.name
end