From 74d1b6fd9991d1fb7dc19f09b06f7b2277874ece Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 16 Apr 2022 20:25:59 +0000 Subject: deploy: 38cd31ed203999122c500d389de38bb051ce979e --- src/kvm_rs/cap.rs.html | 23 +++++++++------- src/kvm_rs/fmt.rs.html | 67 ++++++++++++++++++++++++---------------------- src/kvm_rs/kvm.rs.html | 31 +++++++++++---------- src/kvm_rs/kvm_sys.rs.html | 21 ++++++++------- src/kvm_rs/lib.rs.html | 53 +++++++++++++++++++----------------- src/kvm_rs/vcpu.rs.html | 63 ++++++++++++++++++++++--------------------- src/kvm_rs/vm.rs.html | 29 +++++++++++--------- src/kvm_rs/x86_64.rs.html | 43 +++++++++++++++-------------- 8 files changed, 177 insertions(+), 153 deletions(-) (limited to 'src') diff --git a/src/kvm_rs/cap.rs.html b/src/kvm_rs/cap.rs.html index 55c67ce..6add2e1 100644 --- a/src/kvm_rs/cap.rs.html +++ b/src/kvm_rs/cap.rs.html @@ -1,6 +1,9 @@ -cap.rs - source - -
 1
+cap.rs - source
+    
+    
 1
  2
  3
  4
@@ -34,10 +37,9 @@
 32
 33
 34
-
-//! Definitions of KVM capabilities.
+
//! Definitions of KVM capabilities.
 
-use crate::kvm_sys;
+use crate::kvm_sys;
 use std::convert::Into;
 
 /// Definition of capabilities that return a bool value indicating whether the capability is
@@ -49,7 +51,7 @@
 }
 
 impl Into<u64> for CapBool {
-    fn into(self) -> u64 {
+    fn into(self) -> u64 {
         self as u64
     }
 }
@@ -65,9 +67,10 @@
 }
 
 impl Into<u64> for CapInt {
-    fn into(self) -> u64 {
+    fn into(self) -> u64 {
         self as u64
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/fmt.rs.html b/src/kvm_rs/fmt.rs.html index 9432806..35514e7 100644 --- a/src/kvm_rs/fmt.rs.html +++ b/src/kvm_rs/fmt.rs.html @@ -1,6 +1,9 @@ -fmt.rs - source - -
  1
+fmt.rs - source
+    
+    
  1
   2
   3
   4
@@ -129,14 +132,13 @@
 127
 128
 129
-
-use std::fmt;
+
use std::fmt;
 
-use crate::kvm_sys::{kvm_dtable, kvm_regs, kvm_segment, kvm_sregs};
-use crate::x86_64::*;
+use crate::kvm_sys::{kvm_dtable, kvm_regs, kvm_segment, kvm_sregs};
+use crate::x86_64::*;
 
 impl fmt::Display for kvm_regs {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(
             f,
             "rax: {:#018x} rbx: {:#018x} rcx: {:#018x} rdx: {:#018x}\n\
@@ -175,15 +177,15 @@
 }
 
 impl fmt::Display for kvm_segment {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        if self.present == 0 {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        if self.present == 0 {
             write!(f, "{:#04x} P(0)", self.selector)
         } else {
             write!(
                 f,
                 "{:#06x} T({}) RPL({}) BASE({:#010x}) LIMIT({:#07x}) P(1) S({}) DPL({}) DB({}) L({}) TYPE({})",
                 self.selector,
-                if seg_selector_ti(self.selector) == 0 {
+                if seg_selector_ti(self.selector) == 0 {
                     "GDT"
                 } else {
                     "LDT"
@@ -196,23 +198,23 @@
                 self.db,
                 self.l,
                 match self.type_ {
-                    0 => "D:R---",
-                    1 => "D:R-A-",
-                    2 => "D:RW--",
-                    3 => "D:RWA-",
-                    4 => "D:R--E",
-                    5 => "D:R-AE",
-                    6 => "D:RW-E",
-                    7 => "D:RWAE",
-                    8 => "C:X---",
-                    9 => "C:X-A-",
-                    10 => "C:XR--",
-                    11 => "C:XRA-",
-                    12 => "C:X--C",
-                    13 => "C:X-AC",
-                    14 => "C:XR-C",
-                    15 => "C:XRAC",
-                    _ => unreachable!(),
+                    0 => "D:R---",
+                    1 => "D:R-A-",
+                    2 => "D:RW--",
+                    3 => "D:RWA-",
+                    4 => "D:R--E",
+                    5 => "D:R-AE",
+                    6 => "D:RW-E",
+                    7 => "D:RWAE",
+                    8 => "C:X---",
+                    9 => "C:X-A-",
+                    10 => "C:XR--",
+                    11 => "C:XRA-",
+                    12 => "C:X--C",
+                    13 => "C:X-AC",
+                    14 => "C:XR-C",
+                    15 => "C:XRAC",
+                    _ => unreachable!(),
                 }
             )
         }
@@ -220,13 +222,13 @@
 }
 
 impl fmt::Display for kvm_dtable {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "BASE({:#018x}) LIMIT({:#07x})", self.base, self.limit)
     }
 }
 
 impl fmt::Display for kvm_sregs {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(
             f,
             "cs  : {}\n\
@@ -259,5 +261,6 @@
         )
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/kvm.rs.html b/src/kvm_rs/kvm.rs.html index 7e2fdef..5e4b2f5 100644 --- a/src/kvm_rs/kvm.rs.html +++ b/src/kvm_rs/kvm.rs.html @@ -1,6 +1,9 @@ -kvm.rs - source - -
 1
+kvm.rs - source
+    
+    
 1
  2
  3
  4
@@ -73,15 +76,14 @@
 71
 72
 73
-
-//! KVM system ioctls.
+
//! KVM system ioctls.
 
 use std::fs;
 use std::io;
 use std::os::unix::io::FromRawFd;
 
-use crate::cap::{CapBool, CapInt};
-use crate::vm::Vm;
+use crate::cap::{CapBool, CapInt};
+use crate::vm::Vm;
 use crate::{ioctl, kvm_sys, libcret};
 
 /// Wrapper for `/dev/kvm` ioctls.
@@ -96,7 +98,7 @@
 
 impl Kvm {
     /// Open the `/dev/kvm` device.
-    pub fn new() -> io::Result<Kvm> {
+    pub fn new() -> io::Result<Kvm> {
         let kvm = libcret(unsafe {
             libc::open("/dev/kvm\0".as_ptr().cast(), libc::O_RDWR | libc::O_CLOEXEC)
         })
@@ -110,7 +112,7 @@
         Ok(Kvm { kvm })
     }
 
-    fn get_vpcu_mmap_size(&self) -> io::Result<usize> {
+    fn get_vpcu_mmap_size(&self) -> io::Result<usize> {
         ioctl(&self.kvm, kvm_sys::KVM_GET_VCPU_MMAP_SIZE, 0).map(|size| size as usize)
     }
 
@@ -118,7 +120,7 @@
     /// Returns a wrapper [`vm::Vm`][crate::vm::Vm] representing the VM.
     ///
     /// [kvm-create-vm]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-create-vm
-    pub fn create_vm(&self) -> io::Result<Vm> {
+    pub fn create_vm(&self) -> io::Result<Vm> {
         let vm = ioctl(&self.kvm, kvm_sys::KVM_CREATE_VM, 0 /* machine id */)
             .map(|fd| unsafe { fs::File::from_raw_fd(fd) })?;
 
@@ -131,7 +133,7 @@
     /// ioctl.
     ///
     /// [kvm-check-extension]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-check-extension
-    pub fn check_extenstion(&self, cap: CapBool) -> bool {
+    pub fn check_extenstion(&self, cap: CapBool) -> bool {
         let ret = ioctl(&self.kvm, kvm_sys::KVM_CHECK_EXTENSION, cap.into());
 
         matches!(ret, Ok(ret) if ret > 0)
@@ -141,11 +143,12 @@
     /// ioctl.
     ///
     /// [kvm-check-extension]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-check-extension
-    pub fn check_extenstion_int(&self, cap: CapInt) -> i32 {
+    pub fn check_extenstion_int(&self, cap: CapInt) -> i32 {
         let ret = ioctl(&self.kvm, kvm_sys::KVM_CHECK_EXTENSION, cap.into());
 
         ret.unwrap_or(0)
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/kvm_sys.rs.html b/src/kvm_rs/kvm_sys.rs.html index dcdae1b..ee527a3 100644 --- a/src/kvm_rs/kvm_sys.rs.html +++ b/src/kvm_rs/kvm_sys.rs.html @@ -1,6 +1,9 @@ -kvm_sys.rs - source - -
  1
+kvm_sys.rs - source
+    
+    
  1
   2
   3
   4
@@ -197,8 +200,7 @@
 195
 196
 197
-
-//! Definitions of the system header [`<linux/kvm.h>`][kvm-h].
+
//! Definitions of the system header [`<linux/kvm.h>`][kvm-h].
 //!
 //! [kvm-h]: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/kvm.h
 
@@ -329,7 +331,7 @@
 
 // Only add the union fields used here.
 #[repr(C)]
-pub(crate) union kvm_run_union {
+pub(crate) union kvm_run_union {
     pub io: kvm_run_io,
     pub mmio: kvm_run_mmio,
     padding: [u8; 256],
@@ -337,7 +339,7 @@
 
 // Only add the union fields used here.
 #[repr(C)]
-union kvm_run_union_s {
+union kvm_run_union_s {
     padding: [u8; 2048],
 }
 
@@ -395,5 +397,6 @@
         assert_eq!(mem::size_of::<kvm_run_union_s>(), TEST_KVM_RUN_UNION_S_SIZE);
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/lib.rs.html b/src/kvm_rs/lib.rs.html index da6a425..7124c68 100644 --- a/src/kvm_rs/lib.rs.html +++ b/src/kvm_rs/lib.rs.html @@ -1,6 +1,9 @@ -lib.rs - source - -
  1
+lib.rs - source
+    
+    
  1
   2
   3
   4
@@ -166,8 +169,7 @@
 164
 165
 166
-
-use std::convert::{AsMut, AsRef};
+
use std::convert::{AsMut, AsRef};
 use std::io;
 use std::ops;
 use std::os::unix::io::AsRawFd;
@@ -185,7 +187,7 @@
 
 /// Helper to turn libc return values into an [io::Result](std::io::Result). Returns
 /// [`Error::last_os_error`](std::io::Error::last_os_error) if `ret < 0`.
-fn libcret(ret: libc::c_int) -> io::Result<libc::c_int> {
+fn libcret(ret: libc::c_int) -> io::Result<libc::c_int> {
     if ret < 0 {
         Err(io::Error::last_os_error())
     } else {
@@ -195,7 +197,7 @@
 
 /// Wrapper of `libc::ioctl` for KVM ioctls with one argument and returning an
 /// [`io::Result`](std::io::Result).
-fn ioctl<F: AsRawFd>(fd: &F, cmd: u64, arg: u64) -> io::Result<libc::c_int> {
+fn ioctl<F: AsRawFd>(fd: &F, cmd: u64, arg: u64) -> io::Result<libc::c_int> {
     libcret(unsafe { libc::ioctl(fd.as_raw_fd(), cmd, arg) })
 }
 
@@ -206,13 +208,13 @@
 /// Memory can be mapped into a guest VM with
 /// [`Vm::set_user_memory_region`](crate::vm::Vm::set_user_memory_region).
 pub struct UserMem {
-    ptr: *mut u8,
+    ptr: *mut u8,
     len: usize,
 }
 
 impl UserMem {
     /// Allocate a zero-initialized memory region of `len` bytes.
-    pub fn new(len: usize) -> io::Result<UserMem> {
+    pub fn new(len: usize) -> io::Result<UserMem> {
         let ptr = unsafe {
             libc::mmap(
                 std::ptr::null_mut(),
@@ -224,7 +226,7 @@
             )
         };
 
-        if ptr == libc::MAP_FAILED {
+        if ptr == libc::MAP_FAILED {
             Err(io::Error::last_os_error())
         } else {
             Ok(UserMem {
@@ -240,7 +242,7 @@
     /// # Panics
     ///
     /// Panics if `init_from` is larger than the memory size `len`.
-    pub fn with_init(len: usize, init_from: &[u8]) -> io::Result<UserMem> {
+    pub fn with_init(len: usize, init_from: &[u8]) -> io::Result<UserMem> {
         assert!(len >= init_from.len());
 
         let mut m = UserMem::new(len)?;
@@ -253,7 +255,7 @@
     /// # Panics
     ///
     /// Panics if `addr + data.len` is larger than the memory size `len`.
-    pub fn load(&mut self, addr: PhysAddr, data: &[u8]) {
+    pub fn load(&mut self, addr: PhysAddr, data: &[u8]) {
         assert!(self.len >= addr.0 as usize + data.len());
 
         let addr = addr.0 as usize;
@@ -263,19 +265,19 @@
 
 impl ops::Drop for UserMem {
     /// Free underlying memory.
-    fn drop(&mut self) {
+    fn drop(&mut self) {
         unsafe { libc::munmap(self.ptr.cast(), self.len) };
     }
 }
 
 impl AsRef<[u8]> for UserMem {
-    fn as_ref(&self) -> &[u8] {
+    fn as_ref(&self) -> &[u8] {
         unsafe { std::slice::from_raw_parts(self.ptr, self.len) }
     }
 }
 
 impl AsMut<[u8]> for UserMem {
-    fn as_mut(&mut self) -> &mut [u8] {
+    fn as_mut(&mut self) -> &mut [u8] {
         unsafe { std::slice::from_raw_parts_mut(self.ptr, self.len) }
     }
 }
@@ -285,14 +287,14 @@
 ///
 /// [kvm_run]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#the-kvm-run-structure
 struct KvmRun {
-    ptr: *mut kvm_sys::kvm_run,
+    ptr: *mut kvm_sys::kvm_run,
     len: usize,
 }
 
 impl KvmRun {
     /// Mmap the `struct kvm_run` for a given `VCPU` referenced by the argument file descriptor
     /// `vcpu`.
-    fn new<F: AsRawFd>(vcpu: &F, len: usize) -> io::Result<KvmRun> {
+    fn new<F: AsRawFd>(vcpu: &F, len: usize) -> io::Result<KvmRun> {
         let ptr = unsafe {
             libc::mmap(
                 std::ptr::null_mut(),
@@ -304,7 +306,7 @@
             )
         };
 
-        if ptr == libc::MAP_FAILED {
+        if ptr == libc::MAP_FAILED {
             Err(io::Error::last_os_error())
         } else {
             Ok(KvmRun {
@@ -317,21 +319,22 @@
 
 impl ops::Drop for KvmRun {
     /// Munmap the mmaped `struct kvm_run`.
-    fn drop(&mut self) {
+    fn drop(&mut self) {
         unsafe { libc::munmap(self.ptr.cast(), self.len) };
     }
 }
 
 impl AsRef<kvm_sys::kvm_run> for KvmRun {
-    fn as_ref(&self) -> &kvm_sys::kvm_run {
-        unsafe { &*(self.ptr as *const kvm_sys::kvm_run) }
+    fn as_ref(&self) -> &kvm_sys::kvm_run {
+        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) }
+    fn as_mut(&mut self) -> &mut kvm_sys::kvm_run {
+        unsafe { &mut *(self.ptr as *mut kvm_sys::kvm_run) }
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/vcpu.rs.html b/src/kvm_rs/vcpu.rs.html index 1efd836..9c0da9c 100644 --- a/src/kvm_rs/vcpu.rs.html +++ b/src/kvm_rs/vcpu.rs.html @@ -1,6 +1,9 @@ -vcpu.rs - source - -
  1
+vcpu.rs - source
+    
+    
  1
   2
   3
   4
@@ -136,15 +139,14 @@
 134
 135
 136
-
-//! VCPU system ioctls.
+
//! VCPU system ioctls.
 
 use std::fs;
 use std::io;
 
 use crate::{ioctl, kvm_sys, KvmRun};
 
-/// Exit reasons for the [`Vcpu::kvm_run`][crate::vcpu::Vcpu::kvm_run] function.
+/// Exit reasons for the [`Vcpu::run`][crate::vcpu::Vcpu::run] function.
 ///
 /// Details for the different exit reasons can be found in the [`kvm_run`
 /// structure][kvm-run-struct] description.
@@ -172,7 +174,7 @@
 }
 
 impl Vcpu {
-    pub(crate) fn new(vcpu: fs::File, kvm_run: KvmRun) -> Vcpu {
+    pub(crate) fn new(vcpu: fs::File, kvm_run: KvmRun) -> Vcpu {
         Vcpu { vcpu, kvm_run }
     }
 
@@ -180,12 +182,12 @@
     /// [`kvm_regs`](crate::kvm_sys::kvm_regs).
     ///
     /// [kvm-get-regs]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-get-regs
-    pub fn get_regs(&self) -> io::Result<kvm_sys::kvm_regs> {
+    pub fn get_regs(&self) -> io::Result<kvm_sys::kvm_regs> {
         let mut regs = kvm_sys::kvm_regs::default();
         ioctl(
             &self.vcpu,
             kvm_sys::KVM_GET_REGS,
-            &mut regs as *mut _ as u64,
+            &mut regs as *mut _ as u64,
         )?;
         Ok(regs)
     }
@@ -194,20 +196,20 @@
     /// [`kvm_regs`](crate::kvm_sys::kvm_regs).
     ///
     /// [kvm-set-regs]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-set-regs
-    pub fn set_regs(&self, regs: kvm_sys::kvm_regs) -> io::Result<()> {
-        ioctl(&self.vcpu, kvm_sys::KVM_SET_REGS, &regs as *const _ as u64).map(|_| ())
+    pub fn set_regs(&self, regs: kvm_sys::kvm_regs) -> io::Result<()> {
+        ioctl(&self.vcpu, kvm_sys::KVM_SET_REGS, &regs as *const _ as u64).map(|_| ())
     }
 
     /// Get the special registers with the [`KVM_GET_SREGS`][kvm-get-sregs] ioctl in form of
     /// [`kvm_sregs`](crate::kvm_sys::kvm_sregs).
     ///
     /// [kvm-get-sregs]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-get-sregs
-    pub fn get_sregs(&self) -> io::Result<kvm_sys::kvm_sregs> {
+    pub fn get_sregs(&self) -> io::Result<kvm_sys::kvm_sregs> {
         let mut sregs = kvm_sys::kvm_sregs::default();
         ioctl(
             &self.vcpu,
             kvm_sys::KVM_GET_SREGS,
-            &mut sregs as *mut _ as u64,
+            &mut sregs as *mut _ as u64,
         )?;
         Ok(sregs)
     }
@@ -216,11 +218,11 @@
     /// [`kvm_sregs`](crate::kvm_sys::kvm_sregs).
     ///
     /// [kvm-set-sregs]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-set-sregs
-    pub fn set_sregs(&self, sregs: kvm_sys::kvm_sregs) -> io::Result<()> {
+    pub fn set_sregs(&self, sregs: kvm_sys::kvm_sregs) -> io::Result<()> {
         ioctl(
             &self.vcpu,
             kvm_sys::KVM_SET_SREGS,
-            &sregs as *const _ as u64,
+            &sregs as *const _ as u64,
         )
         .map(|_| ())
     }
@@ -229,18 +231,18 @@
     /// reasons described in [`KvmExit`](crate::vcpu::KvmExit).
     ///
     /// [kvm-run]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-run
-    pub fn run(&mut self) -> io::Result<KvmExit<'_>> {
+    pub fn run(&mut self) -> io::Result<KvmExit<'_>> {
         ioctl(&self.vcpu, kvm_sys::KVM_RUN, 0)?;
 
         let kvm_run = self.kvm_run.as_mut();
 
         match kvm_run.exit_reason as u64 {
-            kvm_sys::KVM_EXIT_HLT => Ok(KvmExit::Halt),
-            kvm_sys::KVM_EXIT_IO => {
+            kvm_sys::KVM_EXIT_HLT => Ok(KvmExit::Halt),
+            kvm_sys::KVM_EXIT_IO => {
                 // Safe to use union `io` field, as Kernel instructed us to.
                 let io = unsafe { kvm_run.inner.io };
 
-                let kvm_run_ptr = kvm_run as *mut kvm_sys::kvm_run as *mut u8;
+                let kvm_run_ptr = kvm_run as *mut kvm_sys::kvm_run as *mut u8;
 
                 // Create IO buffer located at `kvm_run + io.offset`.
                 let data = unsafe {
@@ -251,27 +253,28 @@
                 };
 
                 match io.direction as u64 {
-                    kvm_sys::KVM_EXIT_IO_IN => Ok(KvmExit::IoIn(io.port, data)),
-                    kvm_sys::KVM_EXIT_IO_OUT => Ok(KvmExit::IoOut(io.port, data)),
-                    _ => unreachable!(),
+                    kvm_sys::KVM_EXIT_IO_IN => Ok(KvmExit::IoIn(io.port, data)),
+                    kvm_sys::KVM_EXIT_IO_OUT => Ok(KvmExit::IoOut(io.port, data)),
+                    _ => unreachable!(),
                 }
             }
-            kvm_sys::KVM_EXIT_MMIO => {
+            kvm_sys::KVM_EXIT_MMIO => {
                 // Safe to use union `mmio` filed, as Kernel instructed us to.
-                let mmio = unsafe { &mut kvm_run.inner.mmio };
+                let mmio = unsafe { &mut kvm_run.inner.mmio };
                 let len = mmio.len as usize;
 
                 match mmio.is_write {
-                    0 => Ok(KvmExit::MmioRead(mmio.phys_addr, &mut mmio.data[..len])),
-                    1 => Ok(KvmExit::MmioWrite(mmio.phys_addr, &mmio.data[..len])),
-                    _ => unreachable!(),
+                    0 => Ok(KvmExit::MmioRead(mmio.phys_addr, &mut mmio.data[..len])),
+                    1 => Ok(KvmExit::MmioWrite(mmio.phys_addr, &mmio.data[..len])),
+                    _ => unreachable!(),
                 }
             }
-            r @ _ => {
+            r @ _ => {
                 todo!("KVM_EXIT_... (exit_reason={}) not implemented!", r)
             }
         }
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/vm.rs.html b/src/kvm_rs/vm.rs.html index 609a857..4218bfc 100644 --- a/src/kvm_rs/vm.rs.html +++ b/src/kvm_rs/vm.rs.html @@ -1,6 +1,9 @@ -vm.rs - source - -
 1
+vm.rs - source
+    
+    
 1
  2
  3
  4
@@ -69,14 +72,13 @@
 67
 68
 69
-
-//! VM system ioctls.
+
//! VM system ioctls.
 
 use std::fs;
 use std::io;
 use std::os::unix::io::FromRawFd;
 
-use crate::vcpu::Vcpu;
+use crate::vcpu::Vcpu;
 use crate::{ioctl, kvm_sys, KvmRun, PhysAddr, UserMem};
 
 /// Wrapper for VM ioctls.
@@ -92,13 +94,13 @@
 }
 
 impl Vm {
-    pub(crate) fn new(vm: fs::File, vcpu_mmap_size: usize) -> Vm {
+    pub(crate) fn new(vm: fs::File, vcpu_mmap_size: usize) -> Vm {
         Vm { vm, vcpu_mmap_size }
     }
 
     /// Map memory from userspace into the VM as `guest physical` memory starting at address
     /// `phys_addr`.
-    /// The underlying operation is the [`KVM_SET_USER_MEMORY_REGION`][kmv-set-user-memory-region]
+    /// The underlying operation is the [`KVM_SET_USER_MEMORY_REGION`][kvm-set-user-memory-region]
     /// ioctl.
     ///
     /// # Safety
@@ -111,7 +113,7 @@
         &self,
         phys_addr: PhysAddr,
         mem: &UserMem,
-    ) -> io::Result<()> {
+    ) -> io::Result<()> {
         // Create guest physical memory mapping for `slot : 0` at guest `phys_addr`.
         let mut kvm_mem = kvm_sys::kvm_userspace_memory_region::default();
         kvm_mem.userspace_addr = mem.ptr as u64;
@@ -121,7 +123,7 @@
         ioctl(
             &self.vm,
             kvm_sys::KVM_SET_USER_MEMORY_REGION,
-            &kvm_mem as *const _ as u64,
+            &kvm_mem as *const _ as u64,
         )
         .map(|_| ())
     }
@@ -130,7 +132,7 @@
     /// Returns a wrapper [`vcpu::Vcpu`][crate::vcpu::Vcpu] representing the VCPU.
     ///
     /// [kvm-create-vcpu]: https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-create-vcpu
-    pub fn create_vpcu(&self, id: u64) -> io::Result<Vcpu> {
+    pub fn create_vpcu(&self, id: u64) -> io::Result<Vcpu> {
         let vcpu = ioctl(&self.vm, kvm_sys::KVM_CREATE_VCPU, id)
             .map(|fd| unsafe { fs::File::from_raw_fd(fd) })?;
 
@@ -139,5 +141,6 @@
         Ok(Vcpu::new(vcpu, kvm_run))
     }
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/src/kvm_rs/x86_64.rs.html b/src/kvm_rs/x86_64.rs.html index 324683d..d218b2e 100644 --- a/src/kvm_rs/x86_64.rs.html +++ b/src/kvm_rs/x86_64.rs.html @@ -1,6 +1,9 @@ -x86_64.rs - source - -
  1
+x86_64.rs - source
+    
+    
  1
   2
   3
   4
@@ -159,8 +162,7 @@
 157
 158
 159
-
-//! `x86_64` flags and bitfields.
+
//! `x86_64` flags and bitfields.
 
 pub use x86_64::*;
 
@@ -189,16 +191,16 @@
     /// Alignment check.
     pub const RFLAGS_AC: u64 = 1 << 18;
 
-    pub const fn rflags_cf(r: u64) -> u64   { (r & RFLAGS_CF)   >> 0 }
-    pub const fn rflags_pf(r: u64) -> u64   { (r & RFLAGS_PF)   >> 2 }
-    pub const fn rflags_af(r: u64) -> u64   { (r & RFLAGS_AF)   >> 4 }
-    pub const fn rflags_zf(r: u64) -> u64   { (r & RFLAGS_ZF)   >> 6 }
-    pub const fn rflags_sf(r: u64) -> u64   { (r & RFLAGS_SF)   >> 7 }
-    pub const fn rflags_if(r: u64) -> u64   { (r & RFLAGS_IF)   >> 9 }
-    pub const fn rflags_df(r: u64) -> u64   { (r & RFLAGS_DF)   >> 10 }
-    pub const fn rflags_of(r: u64) -> u64   { (r & RFLAGS_OF)   >> 11 }
-    pub const fn rflags_iopl(r: u64) -> u64 { (r & RFLAGS_IOPL) >> 12 }
-    pub const fn rflags_ac(r: u64) -> u64   { (r & RFLAGS_AC)   >> 18 }
+    pub const fn rflags_cf(r: u64) -> u64   { (r & RFLAGS_CF)   >> 0 }
+    pub const fn rflags_pf(r: u64) -> u64   { (r & RFLAGS_PF)   >> 2 }
+    pub const fn rflags_af(r: u64) -> u64   { (r & RFLAGS_AF)   >> 4 }
+    pub const fn rflags_zf(r: u64) -> u64   { (r & RFLAGS_ZF)   >> 6 }
+    pub const fn rflags_sf(r: u64) -> u64   { (r & RFLAGS_SF)   >> 7 }
+    pub const fn rflags_if(r: u64) -> u64   { (r & RFLAGS_IF)   >> 9 }
+    pub const fn rflags_df(r: u64) -> u64   { (r & RFLAGS_DF)   >> 10 }
+    pub const fn rflags_of(r: u64) -> u64   { (r & RFLAGS_OF)   >> 11 }
+    pub const fn rflags_iopl(r: u64) -> u64 { (r & RFLAGS_IOPL) >> 12 }
+    pub const fn rflags_ac(r: u64) -> u64   { (r & RFLAGS_AC)   >> 18 }
 
     /* Segment Selector */
 
@@ -221,9 +223,9 @@
     /// byte`).
     pub const SEG_SELECTOR_INDEX: u16 = 0x1fff << 3;
 
-    pub const fn seg_selector_rpl(s: u16) -> u16   { (s & SEG_SELECTOR_RPL)   >> 0 }
-    pub const fn seg_selector_ti(s: u16) -> u16    { (s & SEG_SELECTOR_TI)    >> 2 }
-    pub const fn seg_selector_index(s: u16) -> u16 { (s & SEG_SELECTOR_INDEX) >> 3 }
+    pub const fn seg_selector_rpl(s: u16) -> u16   { (s & SEG_SELECTOR_RPL)   >> 0 }
+    pub const fn seg_selector_ti(s: u16) -> u16    { (s & SEG_SELECTOR_TI)    >> 2 }
+    pub const fn seg_selector_index(s: u16) -> u16 { (s & SEG_SELECTOR_INDEX) >> 3 }
 
     /* Control Register CR0 (operation mode & state of the processor) */
 
@@ -319,5 +321,6 @@
     /// If set, region reference by paging entry is writeable.
     pub const PAGE_RENTRY_RW: u64 = 1 << 1;
 }
-
-
\ No newline at end of file +
+
+ \ No newline at end of file -- cgit v1.2.3