diff --git a/ch5/os/mm/address/index.html b/ch5/os/mm/address/index.html index 2548263b..1cf82601 100644 --- a/ch5/os/mm/address/index.html +++ b/ch5/os/mm/address/index.html @@ -4,7 +4,7 @@
-

Module os::mm::address

source · []
Expand description

Implementation of physical and virtual address and page number.

+

Module os::mm::address

source · []
Expand description

Implementation of physical and virtual address and page number.

Structs

physical address

physical page number

diff --git a/ch5/os/mm/address/struct.PhysAddr.html b/ch5/os/mm/address/struct.PhysAddr.html index 1403f493..4963f74f 100644 --- a/ch5/os/mm/address/struct.PhysAddr.html +++ b/ch5/os/mm/address/struct.PhysAddr.html @@ -5,17 +5,17 @@
pub struct PhysAddr(pub usize);
Expand description

physical address

-

Tuple Fields

0: usize

Implementations

PhysAddr->PhysPageNum

-

PhysAddr->PhysPageNum

-

Get page offset

-

Check page aligned

-

Get mutable reference to PhysAddr value

+

Tuple Fields

0: usize

Implementations

PhysAddr->PhysPageNum

+

PhysAddr->PhysPageNum

+

Get page offset

+

Check page aligned

+

Get mutable reference to PhysAddr value

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} T -> usize: T.0 usize -> T: usize.into()

diff --git a/ch5/os/mm/address/struct.PhysPageNum.html b/ch5/os/mm/address/struct.PhysPageNum.html index e1714daa..82588821 100644 --- a/ch5/os/mm/address/struct.PhysPageNum.html +++ b/ch5/os/mm/address/struct.PhysPageNum.html @@ -5,13 +5,13 @@
pub struct PhysPageNum(pub usize);
Expand description

physical page number

-

Tuple Fields

0: usize

Implementations

Get PageTableEntry on PhysPageNum

-

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

Get PageTableEntry on PhysPageNum

+

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

diff --git a/ch5/os/mm/address/struct.SimpleRange.html b/ch5/os/mm/address/struct.SimpleRange.html index 76ce8881..54599d63 100644 --- a/ch5/os/mm/address/struct.SimpleRange.html +++ b/ch5/os/mm/address/struct.SimpleRange.html @@ -4,16 +4,16 @@
pub struct SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ +

Struct os::mm::address::SimpleRange

source · []
pub struct SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ l: T, r: T, }
Expand description

a simple range structure for type T

-

Fields

l: Tr: T

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Fields

l: Tr: T

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

-

The type of the elements being iterated over.

+

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

-

Creates an iterator from a value. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Creates an iterator from a value. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

diff --git a/ch5/os/mm/address/struct.SimpleRangeIterator.html b/ch5/os/mm/address/struct.SimpleRangeIterator.html index d5a6c2d9..8aef1816 100644 --- a/ch5/os/mm/address/struct.SimpleRangeIterator.html +++ b/ch5/os/mm/address/struct.SimpleRangeIterator.html @@ -4,12 +4,12 @@
pub struct SimpleRangeIterator<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ +

Struct os::mm::address::SimpleRangeIterator

source · []
pub struct SimpleRangeIterator<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ current: T, end: T, }
Expand description

iterator for the simple range structure

-

Fields

current: Tend: T

Implementations

Trait Implementations

The type of the elements being iterated over.

-

Advances the iterator and returns the next value. Read more

+

Fields

current: Tend: T

Implementations

Trait Implementations

The type of the elements being iterated over.

+

Advances the iterator and returns the next value. Read more

Returns the bounds on the remaining length of the iterator. Read more

Consumes the iterator, counting the number of iterations and returning it. Read more

Consumes the iterator, returning the last element. Read more

diff --git a/ch5/os/mm/address/struct.VirtAddr.html b/ch5/os/mm/address/struct.VirtAddr.html index 42e379b8..bb381ad2 100644 --- a/ch5/os/mm/address/struct.VirtAddr.html +++ b/ch5/os/mm/address/struct.VirtAddr.html @@ -5,17 +5,17 @@
pub struct VirtAddr(pub usize);
Expand description

virtual address

-

Tuple Fields

0: usize

Implementations

VirtAddr->VirtPageNum

-

VirtAddr->VirtPageNum

-

Get page offset

-

Check page aligned

+

Tuple Fields

0: usize

Implementations

VirtAddr->VirtPageNum

+

VirtAddr->VirtPageNum

+

Get page offset

+

Check page aligned

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Debugging

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

diff --git a/ch5/os/mm/address/struct.VirtPageNum.html b/ch5/os/mm/address/struct.VirtPageNum.html index 486614af..1ea25a01 100644 --- a/ch5/os/mm/address/struct.VirtPageNum.html +++ b/ch5/os/mm/address/struct.VirtPageNum.html @@ -5,13 +5,13 @@
pub struct VirtPageNum(pub usize);
Expand description

virtual page number

-

Tuple Fields

0: usize

Implementations

Return VPN 3 level index

+

Tuple Fields

0: usize

Implementations

Return VPN 3 level index

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

@@ -27,7 +27,7 @@ operator.

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

diff --git a/ch5/os/mm/address/trait.StepByOne.html b/ch5/os/mm/address/trait.StepByOne.html index a52981fd..b2aa284c 100644 --- a/ch5/os/mm/address/trait.StepByOne.html +++ b/ch5/os/mm/address/trait.StepByOne.html @@ -4,7 +4,7 @@
pub trait StepByOne {
+    

Trait os::mm::address::StepByOne

source · []
pub trait StepByOne {
     fn step(&mut self);
-}

Required methods

Implementors

+}

Required methods

Implementors

\ No newline at end of file diff --git a/ch5/os/mm/address/type.VPNRange.html b/ch5/os/mm/address/type.VPNRange.html index 256e5ad0..356ff4bc 100644 --- a/ch5/os/mm/address/type.VPNRange.html +++ b/ch5/os/mm/address/type.VPNRange.html @@ -4,6 +4,6 @@
-

Type Definition os::mm::address::VPNRange

source · []
pub type VPNRange = SimpleRange<VirtPageNum>;
Expand description

a simple range structure for virtual page number

+

Type Definition os::mm::address::VPNRange

source · []
pub type VPNRange = SimpleRange<VirtPageNum>;
Expand description

a simple range structure for virtual page number

\ No newline at end of file diff --git a/ch5/os/mm/struct.PhysAddr.html b/ch5/os/mm/struct.PhysAddr.html index 719c87bd..eec66bb4 100644 --- a/ch5/os/mm/struct.PhysAddr.html +++ b/ch5/os/mm/struct.PhysAddr.html @@ -5,17 +5,17 @@

Struct os::mm::PhysAddr

source · []
pub struct PhysAddr(pub usize);
Expand description

physical address

-

Tuple Fields

0: usize

Implementations

PhysAddr->PhysPageNum

-

PhysAddr->PhysPageNum

-

Get page offset

-

Check page aligned

-

Get mutable reference to PhysAddr value

+

Tuple Fields

0: usize

Implementations

PhysAddr->PhysPageNum

+

PhysAddr->PhysPageNum

+

Get page offset

+

Check page aligned

+

Get mutable reference to PhysAddr value

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} T -> usize: T.0 usize -> T: usize.into()

diff --git a/ch5/os/mm/struct.PhysPageNum.html b/ch5/os/mm/struct.PhysPageNum.html index f08d0081..73b8bfde 100644 --- a/ch5/os/mm/struct.PhysPageNum.html +++ b/ch5/os/mm/struct.PhysPageNum.html @@ -5,13 +5,13 @@
pub struct PhysPageNum(pub usize);
Expand description

physical page number

-

Tuple Fields

0: usize

Implementations

Get PageTableEntry on PhysPageNum

-

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

Get PageTableEntry on PhysPageNum

+

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

diff --git a/ch5/os/mm/struct.VirtAddr.html b/ch5/os/mm/struct.VirtAddr.html index 83777bbc..67a5c532 100644 --- a/ch5/os/mm/struct.VirtAddr.html +++ b/ch5/os/mm/struct.VirtAddr.html @@ -5,17 +5,17 @@

Struct os::mm::VirtAddr

source · []
pub struct VirtAddr(pub usize);
Expand description

virtual address

-

Tuple Fields

0: usize

Implementations

VirtAddr->VirtPageNum

-

VirtAddr->VirtPageNum

-

Get page offset

-

Check page aligned

+

Tuple Fields

0: usize

Implementations

VirtAddr->VirtPageNum

+

VirtAddr->VirtPageNum

+

Get page offset

+

Check page aligned

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Debugging

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

diff --git a/ch5/os/mm/struct.VirtPageNum.html b/ch5/os/mm/struct.VirtPageNum.html index a47aee9a..e5abbae0 100644 --- a/ch5/os/mm/struct.VirtPageNum.html +++ b/ch5/os/mm/struct.VirtPageNum.html @@ -5,13 +5,13 @@
pub struct VirtPageNum(pub usize);
Expand description

virtual page number

-

Tuple Fields

0: usize

Implementations

Return VPN 3 level index

+

Tuple Fields

0: usize

Implementations

Return VPN 3 level index

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

Converts to this type from the input type.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

@@ -27,7 +27,7 @@ operator.

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

diff --git a/ch5/src/os/mm/address.rs.html b/ch5/src/os/mm/address.rs.html index d52fc1a8..837c4a0d 100644 --- a/ch5/src/os/mm/address.rs.html +++ b/ch5/src/os/mm/address.rs.html @@ -266,6 +266,10 @@ 261 262 263 +264 +265 +266 +267
//! Implementation of physical and virtual address and page number.
 use super::PageTableEntry;
 use crate::config::{PAGE_SIZE, PAGE_SIZE_BITS};
@@ -348,7 +352,11 @@
 }
 impl From<VirtAddr> for usize {
     fn from(v: VirtAddr) -> Self {
-        v.0
+        if v.0 >= (1 << (VA_WIDTH_SV39 - 1)) {
+            v.0 | (!((1 << VA_WIDTH_SV39) - 1))
+        } else {
+            v.0
+        }
     }
 }
 impl From<VirtPageNum> for usize {