Rust bindings for the unicorn CPU emulator.
```rust extern crate unicorn;
use unicorn::{Cpu, CpuX86, uc_handle};
fn main() {
let x86_code32 : Vec
let mut emu = CpuX86::new(unicorn::Mode::MODE_32).expect("failed to instantiate emulator");
emu.mem_map(0x1000, 0x4000, unicorn::PROT_ALL);
emu.mem_write(0x1000, &x86_code32);
emu.reg_write_i32(unicorn::RegisterX86::ECX, -10);
emu.reg_write_i32(unicorn::RegisterX86::EDX, -50);
emu.emu_start(0x1000, (0x1000 + x86_code32.len()) as u64, 10 * unicorn::SECOND_SCALE, 1000);
assert_eq!(emu.reg_read_i32(unicorn::RegisterX86::ECX), Ok((-9)));
assert_eq!(emu.reg_read_i32(unicorn::RegisterX86::EDX), Ok((-51)));
} ```
This project has been tested on Linux. The bindings are built for the master version of the unicorn git (currently at 1.0).
To use this package, first install unicorn from git :
git clone https://github.com/unicorn-engine/unicorn
.make.sh
and make.sh install
.Then simply add it as dependency to the Cargo.toml of your program.
[dependencies]
unicorn = "0.1.0"
The handling of callbacks has been modified, callbacks should be implemented using closures. See the tests for examples.
Contributions to this project are super appreciated. Pull requests, bug reports, code review, tests, documentation or feedback on your use of the bindings, nothing is too small. Don't hesitate to open an issue if you have questions.
Contributors: