Permalink
Browse files

implement OR for r/m32, r32 and r/m8, imm8

  • Loading branch information...
1 parent e3b220d commit 509c7a88ce13117c7cefbfcbb058176a57ea58e0 @samsonjs committed Feb 15, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 asm/binary.rb
View
@@ -851,6 +851,23 @@ def and_(dest, src)
end
alias_method :and, :and_
+ def or_(dest, src)
+ if rm?(dest) && register?(src)
+ asm do
+ emit_byte(0x9)
+ emit_modrm(dest, src.regnum)
+ end
+ elsif rm?(dest, 8) && immediate?(src, 8)
+ asm do
+ emit_byte(0x80)
+ emit_modrm(dest, 1)
+ emit_byte(src)
+ end
+ else
+ raise "unsupported OR instruction: dest=#{dest.inspect}, src=#{src.inspect}"
+ end
+ end
+ alias_method :or, :or_
def xor(dest, src)
# xor r/m32, reg32

0 comments on commit 509c7a8

Please sign in to comment.