lib/ronin/asm/archs/x86.rb in ronin-asm-0.1.0 vs lib/ronin/asm/archs/x86.rb in ronin-asm-0.2.0

- old
+ new

@@ -1,9 +1,9 @@ # # Ronin ASM - A Ruby DSL for crafting Assembly programs and Shellcode. # -# Copyright (c) 2007-2012 Hal Brodigan (postmodern.mod3 at gmail.com) +# Copyright (c) 2007-2013 Hal Brodigan (postmodern.mod3 at gmail.com) # # This file is part of Ronin ASM. # # Ronin is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,53 +31,53 @@ # Default word size WORD_SIZE = 4 # X86 registers REGISTERS = { - :al => Register.new(:al, 1), - :ah => Register.new(:ah, 1), - :ax => Register.new(:ax, 2), - :eax => Register.new(:eax, 4, true), + al: Register.new(:al, 1), + ah: Register.new(:ah, 1), + ax: Register.new(:ax, 2), + eax: Register.new(:eax, 4, true), - :bl => Register.new(:bl, 1), - :bh => Register.new(:bh, 1), - :bx => Register.new(:bx, 2), - :ebx => Register.new(:ebx, 4, true), + bl: Register.new(:bl, 1), + bh: Register.new(:bh, 1), + bx: Register.new(:bx, 2), + ebx: Register.new(:ebx, 4, true), - :cl => Register.new(:cl, 1), - :ch => Register.new(:ch, 1), - :cx => Register.new(:cx, 2), - :ecx => Register.new(:ecx, 4, true), + cl: Register.new(:cl, 1), + ch: Register.new(:ch, 1), + cx: Register.new(:cx, 2), + ecx: Register.new(:ecx, 4, true), - :dl => Register.new(:dl, 1), - :dh => Register.new(:dh, 1), - :dx => Register.new(:dx, 2), - :edx => Register.new(:edx, 4, true), + dl: Register.new(:dl, 1), + dh: Register.new(:dh, 1), + dx: Register.new(:dx, 2), + edx: Register.new(:edx, 4, true), - :bp => Register.new(:bp, 2), - :ebp => Register.new(:ebp, 4), + bp: Register.new(:bp, 2), + ebp: Register.new(:ebp, 4), - :sp => Register.new(:sp, 2), - :esp => Register.new(:esp, 4), + sp: Register.new(:sp, 2), + esp: Register.new(:esp, 4), - :ip => Register.new(:ip, 2), - :eip => Register.new(:eip, 4), + ip: Register.new(:ip, 2), + eip: Register.new(:eip, 4), - :sil => Register.new(:sil, 1), - :si => Register.new(:si, 2), - :esi => Register.new(:esi, 4, true), + sil: Register.new(:sil, 1), + si: Register.new(:si, 2), + esi: Register.new(:esi, 4, true), - :dil => Register.new(:dil, 1), - :di => Register.new(:di, 2), - :edi => Register.new(:edi, 4, true), + dil: Register.new(:dil, 1), + di: Register.new(:di, 2), + edi: Register.new(:edi, 4, true), - :cs => Register.new(:cs, 2), - :ds => Register.new(:ds, 2), - :es => Register.new(:es, 2), - :fs => Register.new(:fs, 2), - :gs => Register.new(:gs, 2), - :ss => Register.new(:ss, 2) + cs: Register.new(:cs, 2), + ds: Register.new(:ds, 2), + es: Register.new(:es, 2), + fs: Register.new(:fs, 2), + gs: Register.new(:gs, 2), + ss: Register.new(:ss, 2) } # # Generates the instruction to trigger an interrupt. # @@ -129,16 +129,16 @@ end # # Generates the instruction to set a register. # - # @param [ImmediateOperand, MemoryOperate, Register, Integer, Symbol] value - # The value to set. - # # @param [Symbol] name # The name of the register. # - def register_set(value,name) + # @param [ImmediateOperand, MemoryOperate, Register, Integer, Symbol] value + # The value to set. + # + def register_set(name,value) instruction(:mov,value,register(name)) end # # Generates the instruction to save a register.