Class: OneGadget::Emulators::Amd64

Inherits:
X86 show all
Defined in:
lib/one_gadget/emulators/amd64.rb

Overview

Emulator of amd64 instruction set.

Instance Attribute Summary

Attributes inherited from Processor

#pc, #registers, #sp, #stack

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from X86

#instructions, #process!

Methods inherited from Processor

#constraints, #instructions, #parse, #process, #process!

Constructor Details

#initializeAmd64

Instantiate an OneGadget::Emulators::Amd64 object.


16
17
18
# File 'lib/one_gadget/emulators/amd64.rb', line 16

def initialize
  super(OneGadget::ABI.amd64, 'rsp', 'rip')
end

Class Method Details

.bitsObject

Bits.


10
11
12
# File 'lib/one_gadget/emulators/amd64.rb', line 10

def bits
  64
end

Instance Method Details

#argument(idx) ⇒ Lambda, Integer

Return the argument value of calling a function.


23
24
25
26
27
28
29
# File 'lib/one_gadget/emulators/amd64.rb', line 23

def argument(idx)
  case idx
  when 0 then registers['rdi']
  when 1 then registers['rsi']
  when 2 then registers['rdx']
  end
end