Class: OneGadget::Emulators::I386
- Defined in:
- lib/one_gadget/emulators/i386.rb
Overview
Emulator of amd64 instruction set.
Instance Attribute Summary
Attributes inherited from X86
Attributes inherited from Processor
#pc, #registers, #sp, #sp_based_stack
Class Method Summary collapse
-
.bits ⇒ Object
Yap, bits.
Instance Method Summary collapse
-
#argument(idx) ⇒ Lambda, Integer
Get function call arguments.
-
#initialize ⇒ I386
constructor
Instantiate an I386 object.
Methods inherited from X86
#get_corresponding_stack, #instructions, #process!
Methods inherited from Processor
#constraints, #get_corresponding_stack, #instructions, #parse, #process, #process!
Constructor Details
#initialize ⇒ I386
Instantiate an OneGadget::Emulators::I386 object.
18 19 20 |
# File 'lib/one_gadget/emulators/i386.rb', line 18 def initialize super(OneGadget::ABI.i386, 'esp', 'ebp', 'eip') end |
Class Method Details
.bits ⇒ Object
Yap, bits.
12 13 14 |
# File 'lib/one_gadget/emulators/i386.rb', line 12 def bits 32 end |
Instance Method Details
#argument(idx) ⇒ Lambda, Integer
Get function call arguments.
For i386 this is a little bit tricky. We need to fetch the stack slots reference to current ‘esp’ but not original ‘esp’. So we need to evaluate the offset of current esp first.
30 31 32 33 |
# File 'lib/one_gadget/emulators/i386.rb', line 30 def argument(idx) cur_top = registers['esp'].evaluate('esp' => 0) sp_based_stack[cur_top + idx * 4] end |