GregoryComer / rust-x86asm

A Rust library for x86/64 assembly/disassembly.
MIT License
51 stars 11 forks source link

Assembling doesn't work. #2

Open purpleposeidon opened 5 years ago

purpleposeidon commented 5 years ago

Eg,

use std::io::*;
use x86asm::*;

let buffer = Cursor::new(Vec::new());
let mut writer = InstructionWriter::new(buffer, Mode::Long);
writer.write2(Mnemonic::MOV, Operand::Direct(Reg::RBX), Operand::Direct(Reg::RAX))?;

causes an unimplemented panic.

purpleposeidon commented 5 years ago

Changing the unimplemented!() to false does seem to get it working:

--- a/src/instruction_def.rs
+++ b/src/instruction_def.rs
@@ -367,7 +367,8 @@ impl OperandDefinition {
                 size_helper(s.unwrap_or(def_size), op),
             OperandType::Imm => op.map(|o| o.is_literal() || o.is_offset() || o.is_far())
                 .unwrap_or(false) && size_helper(def_size, op),
-            OperandType::Offset => unimplemented!(),
+            OperandType::Offset => false,