Remove physmap in pcid.

This commit is contained in:
4lDO2
2023-07-15 01:14:27 +02:00
parent 6e94a9e236
commit e0a0e2a532
2 changed files with 10 additions and 2 deletions
+2
View File
@@ -27,3 +27,5 @@ smallvec = "1"
structopt = { version = "0.3", default-features = false, features = [ "paw" ] }
thiserror = "1"
toml = "0.5"
common = { path = "../common" }
+8 -2
View File
@@ -3,7 +3,6 @@ use std::collections::BTreeMap;
use std::sync::{Arc, Mutex};
use syscall::PAGE_SIZE;
use syscall::flag::PhysmapFlags;
use smallvec::SmallVec;
@@ -173,7 +172,14 @@ impl Pcie {
};
let mut maps_lock = self.maps.lock().unwrap();
let virt_pointer = maps_lock.entry((bus, dev, func)).or_insert_with(|| {
syscall::physmap(base_address_phys as usize + Self::addr_offset_in_bytes(starting_bus, bus, dev, func, 0), PAGE_SIZE, PhysmapFlags::PHYSMAP_NO_CACHE | PhysmapFlags::PHYSMAP_WRITE).unwrap_or_else(|error| panic!("failed to physmap pcie configuration space for {:2x}:{:2x}.{:2x}: {:?}", bus, dev, func, error)) as *mut u32
common::physmap(
base_address_phys as usize + Self::addr_offset_in_bytes(starting_bus, bus, dev, func, 0),
PAGE_SIZE,
common::Prot { read: true, write: true },
common::MemoryType::Uncacheable,
).unwrap_or_else(|error| {
panic!("failed to physmap pcie configuration space for {:2x}:{:2x}.{:2x}: {:?}", bus, dev, func, error)
}) as *mut u32
});
f(Some(&mut *virt_pointer.offset((offset as usize / mem::size_of::<u32>()) as isize)))
}