From 509c7a88ce13117c7cefbfcbb058176a57ea58e0 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 14 Feb 2010 18:56:43 -0800 Subject: [PATCH] implement OR for r/m32, r32 and r/m8, imm8 --- asm/binary.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/asm/binary.rb b/asm/binary.rb index b667c47..a8bc65d 100644 --- a/asm/binary.rb +++ b/asm/binary.rb @@ -851,6 +851,23 @@ module Assembler 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