aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Gerd Zellweger <mail@gerdzellweger.com> 2019-08-23 17:29:14 -0700
committerGravatar Gerd Zellweger <mail@gerdzellweger.com> 2019-08-23 17:29:14 -0700
commitaf267b0e7869237cfa3cc1aaeb1b32b87b79937a (patch)
tree9422fa44615859d44035a93a7ce4cf254dec48a1
parent46617737ffe418286a7d9fb3e3d53f032a7489e0 (diff)
downloadrust-x86-af267b0e7869237cfa3cc1aaeb1b32b87b79937a.tar.gz
rust-x86-af267b0e7869237cfa3cc1aaeb1b32b87b79937a.tar.zst
rust-x86-af267b0e7869237cfa3cc1aaeb1b32b87b79937a.zip
Fix warnings.
-rw-r--r--x86test/src/hypervisor/mod.rs7
-rw-r--r--x86test/src/hypervisor/vspace.rs13
-rw-r--r--x86test/x86test_macro/src/lib.rs4
3 files changed, 9 insertions, 15 deletions
diff --git a/x86test/src/hypervisor/mod.rs b/x86test/src/hypervisor/mod.rs
index 177300a..2e42eba 100644
--- a/x86test/src/hypervisor/mod.rs
+++ b/x86test/src/hypervisor/mod.rs
@@ -2,7 +2,6 @@
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader, Write};
-use std::slice;
use kvm::{Capability, IoDirection, Segment, System, Vcpu, VirtualMachine};
use mmap::{MemoryMap, MapOption};
@@ -19,6 +18,7 @@ pub(crate) struct PhysicalMemory {
offset: usize,
allocated: usize,
size: usize,
+ #[allow(unused)]
backing_memory: MemoryMap,
}
@@ -39,10 +39,6 @@ impl PhysicalMemory {
}
}
- fn as_mut_slice<'a>(&'a mut self) -> &'a mut [u8] {
- unsafe { slice::from_raw_parts_mut(self.backing_memory.data(), self.size) }
- }
-
fn len(&self) -> usize {
self.size
}
@@ -61,6 +57,7 @@ impl PhysicalMemory {
pub(crate) struct TestEnvironment<'a> {
sys: &'a System,
+ #[allow(unused)]
heap: &'a mut PhysicalMemory,
stack: &'a mut PhysicalMemory,
vspace: VSpace<'a>,
diff --git a/x86test/src/hypervisor/vspace.rs b/x86test/src/hypervisor/vspace.rs
index 5d09b62..fcea2cb 100644
--- a/x86test/src/hypervisor/vspace.rs
+++ b/x86test/src/hypervisor/vspace.rs
@@ -110,7 +110,6 @@ impl fmt::Display for MapAction {
pub struct VSpace<'a> {
pub pml4: &'a mut PML4,
pmem: &'a mut PhysicalMemory,
- pmem_offset: usize
}
impl<'a> VSpace<'a> {
@@ -121,7 +120,7 @@ impl<'a> VSpace<'a> {
let pml4_ptr = pmem.alloc_pages(1);
let pml4 = unsafe { transmute::<*mut u8, &mut PML4>(pml4_ptr) };
- VSpace { pml4: pml4, pmem: pmem, pmem_offset: 0 }
+ VSpace { pml4: pml4, pmem: pmem }
}
/// Constructs an identity map but with an offset added to the region.
@@ -419,11 +418,9 @@ impl<'a> VSpace<'a> {
///
/// Zeroes the memory we allocate.
/// Returns a `u64` containing the base to that.
- pub(crate) fn allocate_pages(&mut self, how_many: usize, typ: u64) -> PAddr {
- unsafe {
- let ptr = self.pmem.alloc_pages(how_many as u64);
- PAddr::from(ptr as u64)
- }
+ pub(crate) fn allocate_pages(&mut self, how_many: usize, _typ: u64) -> PAddr {
+ let ptr = self.pmem.alloc_pages(how_many as u64);
+ PAddr::from(ptr as u64)
}
fn new_pt(&mut self) -> PDEntry {
@@ -456,6 +453,7 @@ impl<'a> VSpace<'a> {
unsafe { transmute::<VAddr, &mut PDPT>(paddr_to_vaddr(entry.address())) }
}
+ #[allow(unused)]
pub(crate) fn resolve_addr(&self, addr: VAddr) -> Option<PAddr> {
let pml4_idx = pml4_index(addr);
if self.pml4[pml4_idx].is_present() {
@@ -507,6 +505,7 @@ impl<'a> VSpace<'a> {
}
}
+#[allow(unused)]
pub unsafe fn dump_table(pml4_table: &PML4) {
for (pml_idx, pml_item) in pml4_table.iter().enumerate() {
if pml_item.is_present() {
diff --git a/x86test/x86test_macro/src/lib.rs b/x86test/x86test_macro/src/lib.rs
index 36df156..b45ccea 100644
--- a/x86test/x86test_macro/src/lib.rs
+++ b/x86test/x86test_macro/src/lib.rs
@@ -97,14 +97,12 @@ fn should_panic(fun: &ItemFn) -> bool {
/// ```
#[proc_macro_attribute]
pub fn x86test(args: TokenStream, input: TokenStream) -> TokenStream {
- let ico = input.clone();
-
let args: Vec<NestedMeta> = syn::parse_macro_input!(args as AttributeArgs);
let input_fn = syn::parse_macro_input!(input as ItemFn);
let mut physical_memory: (u64, u64) = (0, 0);
let mut ioport_reads: (u64, u64) = (0, 0);
- let mut should_panic = should_panic(&input_fn);
+ let should_panic = should_panic(&input_fn);
// Parse the arguments of x86test:
// #[x86test(ram(0xdead, 12), ioport(0x1, 0xfe))]