I don't really know what to write for this readme.
So here is the entirity of this library's source code:
#![no_std]
use core::arch::asm;
/// Gets the instruction pointer to the exact next instruction.
#[inline(always)]
pub fn get_ip() -> usize {
let ip: usize;
unsafe {
asm!(
"lea {0}, [rip]",
out(reg) ip
);
}
ip
}
/// Sets the current value of the instruction pointer to addr.
#[inline(always)]
pub unsafe fn set_ip(addr: usize) -> ! {
unsafe{
asm!(
"jmp {0}",
in(reg) addr,
options(noreturn)
);
}
}