diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-06-01 22:48:01 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-06-01 22:48:01 +0200 |
commit | 387dd9e27b9425f23ff0eb0c6e9ea785a762fd48 (patch) | |
tree | 84f4ff979dd5232421431b8ba0f6c6cb9d7493f0 /src/lib.rs | |
parent | ccc0081adc056b9a5df1b4b704d2e680ec979b2c (diff) | |
download | mini-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.rs | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) } } } |