ros666::mm::page_table

Struct PageTableEntry

Source
#[repr(C)]
pub struct PageTableEntry { pub bits: usize, }
Expand description

页表项 PTE

64 位 RISC-V 地址空间下,页表项大小为 64 位

§页表项格式

63-5453-109-876543210
保留位物理页号RSWDAGUXWRV

Fields§

§bits: usize

Implementations§

Source§

impl PageTableEntry

Source

pub fn new(phy_page: PhysicalPageNumber, flags: PTEFlags) -> Self

创建一个新的页表项

根据给定的物理页号和标志位创建页表项

Source

pub fn valid(&self) -> bool

判断页表项是否有效

检查页表项的有效位是否被设置

Source

pub fn readable(&self) -> bool

判断页表项是否可读

检查页表项的可读位是否被设置

Source

pub fn writable(&self) -> bool

判断页表项是否可写

检查页表项的可写位是否被设置

Source

pub fn executable(&self) -> bool

判断页表项是否可执行

检查页表项的可执行位是否被设置

Source

pub fn user(&self) -> bool

判断页表项是否为用户态

检查页表项的用户位是否被设置

Source

pub fn accessed(&self) -> bool

判断页表项是否被访问

检查页表项的访问位是否被设置

Source

pub fn dirty(&self) -> bool

判断页表项是否脏

检查页表项的脏位是否被设置

Trait Implementations§

Source§

impl Clone for PageTableEntry

Source§

fn clone(&self) -> PageTableEntry

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PageTableEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PageTableEntry

Source§

fn default() -> Self

创建一个默认的页表项

默认页表项的位字段为 0

Source§

impl From<&PageTableEntry> for PTEFlags

Source§

fn from(pte: &PageTableEntry) -> Self

从页表项创建标志位

根据页表项的位字段创建标志位

Source§

impl From<&PageTableEntry> for PhysicalPageNumber

Source§

fn from(pte: &PageTableEntry) -> Self

从页表项创建物理页号

根据页表项的位字段创建物理页号

Source§

impl From<&mut PageTableEntry> for PhysicalPageNumber

Source§

fn from(pte: &mut PageTableEntry) -> Self

从可变页表项创建物理页号

根据页表项的位字段创建物理页号

Source§

impl Copy for PageTableEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.