fix(interpreter): impl fetch and decode
I parsed all instructions before executing, but this is not how intel works. We need to decode the instructions, pointed to by IP, on the fly.
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -69,15 +69,8 @@ fn main() {
|
||||
}
|
||||
}
|
||||
Command::Interpret => {
|
||||
let mut disasm = Disassembler::new(&args);
|
||||
let instructions = disasm.disassemble(args.dump);
|
||||
match instructions {
|
||||
Ok(instrs) => {
|
||||
let mut interpreter = Interpreter::new(instrs, disasm.aout.data);
|
||||
interpreter.interpret().unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let mut interpreter = Interpreter::new(&args);
|
||||
interpreter.interpret().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user