mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Revise IoMem::resize
into IoMem::slice
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
c8ba695c85
commit
cefeea7b50
@ -198,10 +198,7 @@ impl VirtioTransport for VirtioMmioTransport {
|
||||
|
||||
fn device_config_memory(&self) -> IoMem {
|
||||
// offset: 0x100~0x200
|
||||
let mut io_mem = self.common_device.io_mem().clone();
|
||||
let paddr = io_mem.paddr();
|
||||
io_mem.resize((paddr + 0x100)..(paddr + 0x200)).unwrap();
|
||||
io_mem
|
||||
self.common_device.io_mem().slice(0x100..0x200)
|
||||
}
|
||||
|
||||
fn device_features(&self) -> u64 {
|
||||
|
@ -125,18 +125,11 @@ impl VirtioTransport for VirtioPciTransport {
|
||||
}
|
||||
|
||||
fn device_config_memory(&self) -> IoMem {
|
||||
let mut memory = self
|
||||
.device_cfg
|
||||
.memory_bar()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.io_mem()
|
||||
.clone();
|
||||
let new_paddr = memory.paddr() + self.device_cfg.offset() as usize;
|
||||
memory
|
||||
.resize(new_paddr..(self.device_cfg.length() as usize + new_paddr))
|
||||
.unwrap();
|
||||
memory
|
||||
let memory = self.device_cfg.memory_bar().as_ref().unwrap().io_mem();
|
||||
|
||||
let offset = self.device_cfg.offset() as usize;
|
||||
let length = self.device_cfg.length() as usize;
|
||||
memory.slice(offset..offset + length)
|
||||
}
|
||||
|
||||
fn device_features(&self) -> u64 {
|
||||
|
Reference in New Issue
Block a user