From 387dd9e27b9425f23ff0eb0c6e9ea785a762fd48 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 1 Jun 2021 22:48:01 +0200 Subject: add support for IoIn / MmioRead exit --- src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lib.rs') 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 for KvmRun { fn as_ref(&self) -> &kvm_sys::kvm_run { - unsafe { &(*self.ptr) } + unsafe { & *(self.ptr as *const kvm_sys::kvm_run) } + } +} + +impl AsMut for KvmRun { + fn as_mut(&mut self) -> &mut kvm_sys::kvm_run { + unsafe { &mut *(self.ptr as *mut kvm_sys::kvm_run) } } } -- cgit v1.2.3