Module: X86Assembler

Includes:
X86InstructionSet
Defined in:
lib/rmasm/x86/x86_assembler.rb

Defined Under Namespace

Classes: Operand, SegmentModifier, SizeModifier, X86Expression, X86Instruction

Class Method Summary collapse

Instance Method Summary collapse

Methods included from X86InstructionSet

#aaa, #aad, #call, #jne, #mov, #push, #ret

Class Method Details

.extended(base) ⇒ Object



211
212
213
214
# File 'lib/rmasm/x86/x86_assembler.rb', line 211

def self.extended(base)
  # puts "#{base} extend #{self} "
  base.__init__()
end

Instance Method Details

#__init__Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/rmasm/x86/x86_assembler.rb', line 160

def __init__()
  regs = $rmasm.registers

  def regs.add_regx86(sym, type)
    parent = add_reg sym, type
    mreg = sym.to_s[1].chr
    subparent = add_reg((mreg+"x").to_sym, :r16, parent)
    add_reg( (mreg+"l").to_sym, :r8, subparent )
    add_reg( (mreg+"h").to_sym, :r8, subparent )
  end

  #
  # x86 Registers
  #
  regs.add_regx86 :eax, :r32
  regs.add_regx86 :ebx, :r32
  regs.add_regx86 :ecx, :r32
  regs.add_regx86 :edx, :r32
  regs.add_reg :esi, :r32
  regs.add_reg :edi, :r32
  regs.add_reg :ebp, :r32
  regs.add_reg :esp, :r32

  regs.add_reg :st0, :fpu
  regs.add_reg :st1, :fpu
  regs.add_reg :st2, :fpu
  regs.add_reg :st3, :fpu
  regs.add_reg :st4, :fpu
  regs.add_reg :st5, :fpu
  regs.add_reg :st6, :fpu
  regs.add_reg :st7, :fpu

  regs.add_reg :mm0, :mmx
  regs.add_reg :mm1, :mmx
  regs.add_reg :mm2, :mmx
  regs.add_reg :mm3, :mmx
  regs.add_reg :mm4, :mmx
  regs.add_reg :mm5, :mmx
  regs.add_reg :mm6, :mmx
  regs.add_reg :mm7, :mmx

  regs.add_reg :xmm0, :xmm
  regs.add_reg :xmm1, :xmm
  regs.add_reg :xmm2, :xmm
  regs.add_reg :xmm3, :xmm
  regs.add_reg :xmm4, :xmm
  regs.add_reg :xmm5, :xmm
  regs.add_reg :xmm6, :xmm
  regs.add_reg :xmm7, :xmm
end

#byte(*args) ⇒ Object



152
153
154
155
156
157
158
# File 'lib/rmasm/x86/x86_assembler.rb', line 152

def byte(*args)
  if !args.empty?
    db *args
  else
    SizeModifier.new(:byte)
  end
end

#dword(*args) ⇒ Object



136
137
138
139
140
141
142
# File 'lib/rmasm/x86/x86_assembler.rb', line 136

def dword(*args)
  if !args.empty?
    dd *args
  else
    SizeModifier.new(:dword)
  end
end

#qword(*args) ⇒ Object



128
129
130
131
132
133
134
# File 'lib/rmasm/x86/x86_assembler.rb', line 128

def qword(*args)
  if !args.empty?
    dq *args
  else
    SizeModifier.new(:dword)
  end
end

#word(*args) ⇒ Object



144
145
146
147
148
149
150
# File 'lib/rmasm/x86/x86_assembler.rb', line 144

def word(*args)
  if !args.empty?
    dw *args
  else
    SizeModifier.new(:word)
  end
end