Trait MmuMeta

Source
pub trait MmuMeta {
    const P_ADDR_BITS: usize;
    const PAGE_BITS: usize;
    const LEVEL_BITS: &'static [usize];
    const PPN_POS: usize;
    const VALID_FLAG: usize = 1usize;

    // Required method
    fn is_leaf(flags: usize) -> bool;

    // Provided methods
    fn is_valid(flags: usize) -> bool { ... }
    fn fmt_flags(f: &mut Formatter<'_>, flags: usize) -> Result { ... }
}
Expand description

地址转换单元元数据。

Required Associated Constants§

Source

const P_ADDR_BITS: usize

物理地址位数,用于计算物理页号形式。

Source

const PAGE_BITS: usize

页内偏移的位数。

Source

const LEVEL_BITS: &'static [usize]

各级页内虚地址位数位数。

Source

const PPN_POS: usize

物理页号在 PTE 中的位置。

Provided Associated Constants§

Source

const VALID_FLAG: usize = 1usize

表示页表项有效的标志位。

一般就是最低位。

Required Methods§

Source

fn is_leaf(flags: usize) -> bool

如果页表项指向物理页,则返回 true

§NOTE

为了分散开销,这个方法的实现不会判断页表项是否有效。

Provided Methods§

Source

fn is_valid(flags: usize) -> bool

判断页表项是否有效。

Source

fn fmt_flags(f: &mut Formatter<'_>, flags: usize) -> Result

格式化特性位。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§