aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lib.rs
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-06-01 22:48:01 +0200
committerjohannst <johannes.stoelp@gmail.com>2021-06-01 22:48:01 +0200
commit387dd9e27b9425f23ff0eb0c6e9ea785a762fd48 (patch)
tree84f4ff979dd5232421431b8ba0f6c6cb9d7493f0 /src/lib.rs
parentccc0081adc056b9a5df1b4b704d2e680ec979b2c (diff)
downloadmini-kvm-rs-387dd9e27b9425f23ff0eb0c6e9ea785a762fd48.tar.gz
mini-kvm-rs-387dd9e27b9425f23ff0eb0c6e9ea785a762fd48.zip
add support for IoIn / MmioRead exit
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9690eaa..d31d33e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -126,7 +126,7 @@ impl KvmRun {
libc::mmap(
std::ptr::null_mut(),
len,
- libc::PROT_READ,
+ libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_SHARED,
vcpu.as_raw_fd(),
0,
@@ -153,6 +153,12 @@ impl ops::Drop for KvmRun {
impl AsRef<kvm_sys::kvm_run> for KvmRun {
fn as_ref(&self) -> &kvm_sys::kvm_run {
- unsafe { &(*self.ptr) }
+ unsafe { & *(self.ptr as *const kvm_sys::kvm_run) }
+ }
+}
+
+impl AsMut<kvm_sys::kvm_run> for KvmRun {
+ fn as_mut(&mut self) -> &mut kvm_sys::kvm_run {
+ unsafe { &mut *(self.ptr as *mut kvm_sys::kvm_run) }
}
}