VirtIOHal

Struct VirtIOHal 

Source
pub struct VirtIOHal;
Expand description

virtio-drivers 0.12.0 库使用的 HAL 实现

Implementations§

Source§

impl VirtIOHal

Source

pub fn new() -> Self

创建新的 HAL 实例

Trait Implementations§

Source§

impl Hal for VirtIOHal

Source§

fn dma_alloc( pages: usize, _direction: BufferDirection, ) -> (PhysAddr, NonNull<u8>)

分配并清零指定数量的连续物理页用于DMA

Source§

unsafe fn dma_dealloc( paddr: PhysAddr, _vaddr: NonNull<u8>, _pages: usize, ) -> i32

释放之前分配的DMA内存

Source§

unsafe fn mmio_phys_to_virt(paddr: PhysAddr, _size: usize) -> NonNull<u8>

将MMIO物理地址转换为虚拟地址

Source§

unsafe fn share(buffer: NonNull<[u8]>, _direction: BufferDirection) -> PhysAddr

共享内存区域给设备,并返回设备可访问的物理地址

Source§

unsafe fn unshare( _paddr: PhysAddr, _buffer: NonNull<[u8]>, _direction: BufferDirection, )

取消共享内存区域,并在必要时将数据复制回原始缓冲区

Auto Trait Implementations§

§

impl Freeze for VirtIOHal

§

impl RefUnwindSafe for VirtIOHal

§

impl Send for VirtIOHal

§

impl Sync for VirtIOHal

§

impl Unpin for VirtIOHal

§

impl UnwindSafe for VirtIOHal

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.