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.



431
432
433
434
435
436
# File 'lib/fisk.rb', line 431

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

Instance Method Details

#encode(buffer, labels) ⇒ Object



446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/fisk.rb', line 446

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)


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

def jump?
  true
end

#targetObject



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

def target
  @operand.name
end