Recap
This is a continuation of
Notice that the org 0x1000 header is quite arbitrary and it's actually a good
lead of what we also need to do (set the instruction pointer). Let's compile the
assembly file with:
nasm ./samples/hello-world.asm
Then, we want to load our binary into the memory region at address 0x1000:
let mut file = File::open("./samples/hello-world")?;
let mut code = Vec::new();
file.read_to_end(&mut code)?;
unsafe {
std::ptr::copy_nonoverlapping(code.as_ptr(),
(mem_ptr as *mut u8).add(0x1000),
code.len()) };
Here we are using the more optimal copy_nonoverlapping because we can be quite
certain that the memory where code is stored is not overlapping with our
memory region.
Creating a vCPU
As we saw in .
The more x86-specific code with exit reasons can be found in the
SOCIAL SHARE CARD GENERATOR