diff --git a/ch4/os/mm/address/index.html b/ch4/os/mm/address/index.html index 365ebda7..19ea333c 100644 --- a/ch4/os/mm/address/index.html +++ b/ch4/os/mm/address/index.html @@ -1,4 +1,4 @@ -os::mm::address - Rust

Module os::mm::address

source · []
Expand description

Implementation of physical and virtual address and page number.

+os::mm::address - Rust

Module os::mm::address

source · []
Expand description

Implementation of physical and virtual address and page number.

Structs

Definitions

physical page number

a simple range structure for type T

diff --git a/ch4/os/mm/address/struct.PhysAddr.html b/ch4/os/mm/address/struct.PhysAddr.html index 005682ad..caacaa88 100644 --- a/ch4/os/mm/address/struct.PhysAddr.html +++ b/ch4/os/mm/address/struct.PhysAddr.html @@ -1,10 +1,10 @@ PhysAddr in os::mm::address - Rust
pub struct PhysAddr(pub usize);
Expand description

Definitions

-

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

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/ch4/os/mm/address/struct.PhysPageNum.html b/ch4/os/mm/address/struct.PhysPageNum.html index 1aecf8c2..4ae168e1 100644 --- a/ch4/os/mm/address/struct.PhysPageNum.html +++ b/ch4/os/mm/address/struct.PhysPageNum.html @@ -1,9 +1,9 @@ PhysPageNum in os::mm::address - Rust
pub struct PhysPageNum(pub usize);
Expand description

physical page number

-

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

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

diff --git a/ch4/os/mm/address/struct.SimpleRange.html b/ch4/os/mm/address/struct.SimpleRange.html index 95d99d6f..f0bd1d5d 100644 --- a/ch4/os/mm/address/struct.SimpleRange.html +++ b/ch4/os/mm/address/struct.SimpleRange.html @@ -1,13 +1,13 @@ -SimpleRange in os::mm::address - Rust
pub struct SimpleRange<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ +SimpleRange in os::mm::address - Rust
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/ch4/os/mm/address/struct.SimpleRangeIterator.html b/ch4/os/mm/address/struct.SimpleRangeIterator.html index 48082e68..044e299d 100644 --- a/ch4/os/mm/address/struct.SimpleRangeIterator.html +++ b/ch4/os/mm/address/struct.SimpleRangeIterator.html @@ -1,9 +1,9 @@ -SimpleRangeIterator in os::mm::address - Rust
pub struct SimpleRangeIterator<T> where
    T: StepByOne + Copy + PartialEq + PartialOrd + Debug
{ +SimpleRangeIterator in os::mm::address - Rust
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

🔬 This is a nightly-only experimental API. (iter_next_chunk)

Advances the iterator and returns an array containing the next N values. 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

diff --git a/ch4/os/mm/address/struct.VirtAddr.html b/ch4/os/mm/address/struct.VirtAddr.html index 82220c98..c327c574 100644 --- a/ch4/os/mm/address/struct.VirtAddr.html +++ b/ch4/os/mm/address/struct.VirtAddr.html @@ -1,11 +1,11 @@ VirtAddr in os::mm::address - Rust
pub struct VirtAddr(pub usize);
Expand description

virtual address

-

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

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.

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

Compares and returns the maximum of two values. Read more

diff --git a/ch4/os/mm/address/struct.VirtPageNum.html b/ch4/os/mm/address/struct.VirtPageNum.html index 5a7e5d4a..dd2ab9ba 100644 --- a/ch4/os/mm/address/struct.VirtPageNum.html +++ b/ch4/os/mm/address/struct.VirtPageNum.html @@ -1,9 +1,9 @@ VirtPageNum in os::mm::address - Rust
pub struct VirtPageNum(pub usize);
Expand description

virtual page number

-

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Tuple Fields

0: usize

Implementations

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

@@ -20,7 +20,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/ch4/os/mm/address/trait.StepByOne.html b/ch4/os/mm/address/trait.StepByOne.html index dca8d751..bb16e96e 100644 --- a/ch4/os/mm/address/trait.StepByOne.html +++ b/ch4/os/mm/address/trait.StepByOne.html @@ -1,3 +1,3 @@ -StepByOne in os::mm::address - Rust
pub trait StepByOne {
+StepByOne in os::mm::address - Rust
pub trait StepByOne {
     fn step(&mut self);
-}

Required Methods

Implementors

\ No newline at end of file +}

Required Methods

Implementors

\ No newline at end of file diff --git a/ch4/os/mm/address/type.VPNRange.html b/ch4/os/mm/address/type.VPNRange.html index 257a95b3..d45c4e12 100644 --- a/ch4/os/mm/address/type.VPNRange.html +++ b/ch4/os/mm/address/type.VPNRange.html @@ -1,2 +1,2 @@ -VPNRange in os::mm::address - Rust

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

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

a simple range structure for virtual page number

+VPNRange in os::mm::address - Rust

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/ch4/src/os/mm/address.rs.html b/ch4/src/os/mm/address.rs.html index 7a9e32bf..abcbefdf 100644 --- a/ch4/src/os/mm/address.rs.html +++ b/ch4/src/os/mm/address.rs.html @@ -253,6 +253,14 @@ 253 254 255 +256 +257 +258 +259 +260 +261 +262 +263
//! Implementation of physical and virtual address and page number.
 
 use super::PageTableEntry;
@@ -358,7 +366,11 @@
         VirtPageNum(self.0 / PAGE_SIZE)
     }
     pub fn ceil(&self) -> VirtPageNum {
-        VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+        if self.0 == 0 {
+            VirtPageNum(0)
+        } else {
+            VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+        }
     }
     pub fn page_offset(&self) -> usize {
         self.0 & (PAGE_SIZE - 1)
@@ -383,7 +395,11 @@
         PhysPageNum(self.0 / PAGE_SIZE)
     }
     pub fn ceil(&self) -> PhysPageNum {
-        PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+        if self.0 == 0 {
+            PhysPageNum(0)
+        } else {
+            PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
+        }
     }
     pub fn page_offset(&self) -> usize {
         self.0 & (PAGE_SIZE - 1)