diff --git a/ch5/os/all.html b/ch5/os/all.html index f5b53360..273da0aa 100644 --- a/ch5/os/all.html +++ b/ch5/os/all.html @@ -3,5 +3,5 @@

List of all items

Structs

Enums

Traits

Macros

Functions

Typedefs

Statics

Constants

+

Crate os

List of all items

Structs

Enums

Traits

Macros

Functions

Typedefs

Statics

Constants

\ No newline at end of file diff --git a/ch5/os/config/constant.KERNEL_HEAP_SIZE.html b/ch5/os/config/constant.KERNEL_HEAP_SIZE.html index 5f3a93f2..6f7944e8 100644 --- a/ch5/os/config/constant.KERNEL_HEAP_SIZE.html +++ b/ch5/os/config/constant.KERNEL_HEAP_SIZE.html @@ -4,5 +4,5 @@
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
+

Constant os::config::KERNEL_HEAP_SIZE

source · []
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
\ No newline at end of file diff --git a/ch5/os/config/constant.KERNEL_STACK_SIZE.html b/ch5/os/config/constant.KERNEL_STACK_SIZE.html index 797166d1..63c5ef5f 100644 --- a/ch5/os/config/constant.KERNEL_STACK_SIZE.html +++ b/ch5/os/config/constant.KERNEL_STACK_SIZE.html @@ -4,5 +4,5 @@
pub const KERNEL_STACK_SIZE: usize = 4096 * 2; // 8_192usize
+

Constant os::config::KERNEL_STACK_SIZE

source · []
pub const KERNEL_STACK_SIZE: usize = 4096 * 2; // 8_192usize
\ No newline at end of file diff --git a/ch5/os/config/constant.PAGE_SIZE.html b/ch5/os/config/constant.PAGE_SIZE.html index eee8cd59..a981d562 100644 --- a/ch5/os/config/constant.PAGE_SIZE.html +++ b/ch5/os/config/constant.PAGE_SIZE.html @@ -4,5 +4,5 @@
-

Constant os::config::PAGE_SIZE

source · []
pub const PAGE_SIZE: usize = 0x1000;
+

Constant os::config::PAGE_SIZE

source · []
pub const PAGE_SIZE: usize = 0x1000;
\ No newline at end of file diff --git a/ch5/os/config/constant.PAGE_SIZE_BITS.html b/ch5/os/config/constant.PAGE_SIZE_BITS.html index 7a7c668d..e686ee0d 100644 --- a/ch5/os/config/constant.PAGE_SIZE_BITS.html +++ b/ch5/os/config/constant.PAGE_SIZE_BITS.html @@ -4,5 +4,5 @@
pub const PAGE_SIZE_BITS: usize = 0xc;
+

Constant os::config::PAGE_SIZE_BITS

source · []
pub const PAGE_SIZE_BITS: usize = 0xc;
\ No newline at end of file diff --git a/ch5/os/config/constant.TRAMPOLINE.html b/ch5/os/config/constant.TRAMPOLINE.html index e5a8c0c1..5a74221c 100644 --- a/ch5/os/config/constant.TRAMPOLINE.html +++ b/ch5/os/config/constant.TRAMPOLINE.html @@ -4,5 +4,5 @@
-

Constant os::config::TRAMPOLINE

source · []
pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1; // 18_446_744_073_709_547_520usize
+

Constant os::config::TRAMPOLINE

source · []
pub const TRAMPOLINE: usize = usize::MAX - PAGE_SIZE + 1; // 18_446_744_073_709_547_520usize
\ No newline at end of file diff --git a/ch5/os/config/constant.TRAP_CONTEXT.html b/ch5/os/config/constant.TRAP_CONTEXT.html index 33ede0e5..ffb58ef2 100644 --- a/ch5/os/config/constant.TRAP_CONTEXT.html +++ b/ch5/os/config/constant.TRAP_CONTEXT.html @@ -4,5 +4,5 @@
pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE; // 18_446_744_073_709_543_424usize
+

Constant os::config::TRAP_CONTEXT

source · []
pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE; // 18_446_744_073_709_543_424usize
\ No newline at end of file diff --git a/ch5/os/config/constant.USER_STACK_SIZE.html b/ch5/os/config/constant.USER_STACK_SIZE.html index cc652521..257d1d89 100644 --- a/ch5/os/config/constant.USER_STACK_SIZE.html +++ b/ch5/os/config/constant.USER_STACK_SIZE.html @@ -4,5 +4,5 @@
pub const USER_STACK_SIZE: usize = 4096 * 2; // 8_192usize
+

Constant os::config::USER_STACK_SIZE

source · []
pub const USER_STACK_SIZE: usize = 4096 * 2; // 8_192usize
\ No newline at end of file diff --git a/ch5/os/config/index.html b/ch5/os/config/index.html index 00ea0634..019bbf36 100644 --- a/ch5/os/config/index.html +++ b/ch5/os/config/index.html @@ -1,10 +1,11 @@ -os::config - Rust +os::config - Rust
-

Module os::config

source · []

Re-exports

+

Module os::config

source · []
Expand description

Constants used in rCore

+

Re-exports

pub use crate::board::CLOCK_FREQ;
pub use crate::board::MEMORY_END;

Constants

\ No newline at end of file diff --git a/ch5/os/console/fn.print.html b/ch5/os/console/fn.print.html index f8119bcb..da0a7e32 100644 --- a/ch5/os/console/fn.print.html +++ b/ch5/os/console/fn.print.html @@ -4,5 +4,5 @@
-

Function os::console::print

source · []
pub fn print(args: Arguments<'_>)
+

Function os::console::print

source · []
pub fn print(args: Arguments<'_>)
\ No newline at end of file diff --git a/ch5/os/console/index.html b/ch5/os/console/index.html index cb323cd3..d18f0bf2 100644 --- a/ch5/os/console/index.html +++ b/ch5/os/console/index.html @@ -1,10 +1,11 @@ -os::console - Rust +os::console - Rust
-

Module os::console

source · []

Structs

+

Module os::console

source · []
Expand description

SBI console driver, for text output

+

Structs

Stdout 🔒

Functions

\ No newline at end of file diff --git a/ch5/os/console/struct.Stdout.html b/ch5/os/console/struct.Stdout.html index 1f956495..34462a88 100644 --- a/ch5/os/console/struct.Stdout.html +++ b/ch5/os/console/struct.Stdout.html @@ -4,7 +4,7 @@
-

Struct os::console::Stdout

source · []
struct Stdout;

Trait Implementations

Writes a string slice into this writer, returning whether the write +

Struct os::console::Stdout

source · []
struct Stdout;

Trait Implementations

Writes a string slice into this writer, returning whether the write succeeded. Read more

Writes a char into this writer, returning whether the write succeeded. Read more

Glue for usage of the write! macro with implementors of this trait. Read more

diff --git a/ch5/os/fn.clear_bss.html b/ch5/os/fn.clear_bss.html index c2be7826..af3d96d9 100644 --- a/ch5/os/fn.clear_bss.html +++ b/ch5/os/fn.clear_bss.html @@ -1,8 +1,9 @@ -clear_bss in os - Rust +clear_bss in os - Rust
-

Function os::clear_bss

source · []
pub(crate) fn clear_bss()
+

Function os::clear_bss

source · []
pub(crate) fn clear_bss()
Expand description

clear BSS segment

+
\ No newline at end of file diff --git a/ch5/os/fn.rust_main.html b/ch5/os/fn.rust_main.html index 1020ed37..790537a2 100644 --- a/ch5/os/fn.rust_main.html +++ b/ch5/os/fn.rust_main.html @@ -1,9 +1,10 @@ -rust_main in os - Rust +rust_main in os - Rust
-

Function os::rust_main

source · []
#[no_mangle]
-pub fn rust_main() -> !
+

Function os::rust_main

source · []
#[no_mangle]
+pub fn rust_main() -> !
Expand description

the rust entry-point of os

+
\ No newline at end of file diff --git a/ch5/os/index.html b/ch5/os/index.html index 43d7f243..72b14979 100644 --- a/ch5/os/index.html +++ b/ch5/os/index.html @@ -1,11 +1,42 @@ -os - Rust +os - Rust
-

Crate os

source · []

Modules

-
board 🔒
config 🔒
console 🔒
lang_items 🔒
loader 🔒
mm 🔒
sbi 🔒
sync 🔒
syscall 🔒
task 🔒
timer 🔒
trap 🔒

Macros

-

Functions

-
+

Crate os

source · []
Expand description

The main module and entrypoint

+

Various facilities of the kernels are implemented as submodules. The most +important ones are:

+ +

The operating system also starts in this module. Kernel code starts +executing from entry.asm, after which rust_main() is called to +initialize various pieces of functionality. (See its source code for +details.)

+

We then call task::run_tasks() and for the first time go to +userspace.

+

Modules

+
board 🔒
config 🔒

Constants used in rCore

+
console 🔒

SBI console driver, for text output

+
lang_items 🔒

The panic handler

+
loader 🔒

Loading user applications into memory

+

Memory management implementation

+
sbi 🔒

SBI call wrappers

+

Synchronization and interior mutability primitives

+

Implementation of syscalls

+

Task management implementation

+
timer 🔒

RISC-V timer-related functionality

+

Trap handling functionality

+

Macros

+

print string macro

+

println string macro

+

Functions

+
clear_bss 🔒

clear BSS segment

+

the rust entry-point of os

+
\ No newline at end of file diff --git a/ch5/os/lang_items/fn.panic.html b/ch5/os/lang_items/fn.panic.html index 17c1398e..9bac00ce 100644 --- a/ch5/os/lang_items/fn.panic.html +++ b/ch5/os/lang_items/fn.panic.html @@ -4,5 +4,5 @@
-

Function os::lang_items::panic

source · []
fn panic(info: &PanicInfo<'_>) -> !
+

Function os::lang_items::panic

source · []
fn panic(info: &PanicInfo<'_>) -> !
\ No newline at end of file diff --git a/ch5/os/lang_items/index.html b/ch5/os/lang_items/index.html index 9ce22367..b137cf66 100644 --- a/ch5/os/lang_items/index.html +++ b/ch5/os/lang_items/index.html @@ -1,9 +1,10 @@ -os::lang_items - Rust +os::lang_items - Rust
-

Module os::lang_items

source · []

Functions

+

Module os::lang_items

source · []
Expand description

The panic handler

+

Functions

panic 🔒
\ No newline at end of file diff --git a/ch5/os/loader/fn.get_app_data.html b/ch5/os/loader/fn.get_app_data.html index 8e8a2c8e..1ddd3917 100644 --- a/ch5/os/loader/fn.get_app_data.html +++ b/ch5/os/loader/fn.get_app_data.html @@ -1,8 +1,9 @@ -get_app_data in os::loader - Rust +get_app_data in os::loader - Rust
pub fn get_app_data(app_id: usize) -> &'static [u8]
+

Function os::loader::get_app_data

source · []
pub fn get_app_data(app_id: usize) -> &'static [u8]
Expand description

get applications data

+
\ No newline at end of file diff --git a/ch5/os/loader/fn.get_app_data_by_name.html b/ch5/os/loader/fn.get_app_data_by_name.html index 30a866fa..bd534370 100644 --- a/ch5/os/loader/fn.get_app_data_by_name.html +++ b/ch5/os/loader/fn.get_app_data_by_name.html @@ -1,8 +1,9 @@ -get_app_data_by_name in os::loader - Rust +get_app_data_by_name in os::loader - Rust
pub fn get_app_data_by_name(name: &str) -> Option<&'static [u8]>
+

Function os::loader::get_app_data_by_name

source · []
pub fn get_app_data_by_name(name: &str) -> Option<&'static [u8]>
Expand description

get app data from name

+
\ No newline at end of file diff --git a/ch5/os/loader/fn.get_num_app.html b/ch5/os/loader/fn.get_num_app.html index 76ed8fdc..1082965b 100644 --- a/ch5/os/loader/fn.get_num_app.html +++ b/ch5/os/loader/fn.get_num_app.html @@ -1,8 +1,9 @@ -get_num_app in os::loader - Rust +get_num_app in os::loader - Rust
-

Function os::loader::get_num_app

source · []
pub fn get_num_app() -> usize
+

Function os::loader::get_num_app

source · []
pub fn get_num_app() -> usize
Expand description

get app number

+
\ No newline at end of file diff --git a/ch5/os/loader/fn.list_apps.html b/ch5/os/loader/fn.list_apps.html index 59848dea..e053eb9f 100644 --- a/ch5/os/loader/fn.list_apps.html +++ b/ch5/os/loader/fn.list_apps.html @@ -1,8 +1,9 @@ -list_apps in os::loader - Rust +list_apps in os::loader - Rust
-

Function os::loader::list_apps

source · []
pub fn list_apps()
+

Function os::loader::list_apps

source · []
pub fn list_apps()
Expand description

list all apps

+
\ No newline at end of file diff --git a/ch5/os/loader/index.html b/ch5/os/loader/index.html index 5ed11311..eba7017b 100644 --- a/ch5/os/loader/index.html +++ b/ch5/os/loader/index.html @@ -1,10 +1,16 @@ -os::loader - Rust +os::loader - Rust
-

Module os::loader

source · []

Structs

-
APP_NAMES 🔒

Functions

-
+

Module os::loader

source · []
Expand description

Loading user applications into memory

+

Structs

+
APP_NAMES 🔒

All of app’s name

+

Functions

+

get applications data

+

get app data from name

+

get app number

+

list all apps

+
\ No newline at end of file diff --git a/ch5/os/loader/sidebar-items.js b/ch5/os/loader/sidebar-items.js index ab6c8f3a..b0cd1db6 100644 --- a/ch5/os/loader/sidebar-items.js +++ b/ch5/os/loader/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["get_app_data",""],["get_app_data_by_name",""],["get_num_app",""],["list_apps",""]],"struct":[["APP_NAMES",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["get_app_data","get applications data"],["get_app_data_by_name","get app data from name"],["get_num_app","get app number"],["list_apps","list all apps"]],"struct":[["APP_NAMES","All of app’s name"]]}); \ No newline at end of file diff --git a/ch5/os/loader/struct.APP_NAMES.html b/ch5/os/loader/struct.APP_NAMES.html index 34dcb354..0512dcf6 100644 --- a/ch5/os/loader/struct.APP_NAMES.html +++ b/ch5/os/loader/struct.APP_NAMES.html @@ -1,12 +1,13 @@ -APP_NAMES in os::loader - Rust +APP_NAMES in os::loader - Rust
struct APP_NAMES {
+    

Struct os::loader::APP_NAMES

source · []
struct APP_NAMES {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = Vec<&'static str>>

Returns the number of elements the vector can hold without +}

Expand description

All of app’s name

+

Fields

__private_field: ()

Methods from Deref<Target = Vec<&'static str>>

Returns the number of elements the vector can hold without reallocating.

Examples
let vec: Vec<i32> = Vec::with_capacity(10);
@@ -934,9 +935,9 @@ given separator between each.

Examples
assert_eq!(["hello", "world"].connect(" "), "hello world");
 assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/macro.print.html b/ch5/os/macro.print.html index df49b790..388f897a 100644 --- a/ch5/os/macro.print.html +++ b/ch5/os/macro.print.html @@ -1,11 +1,12 @@ -print in os - Rust +print in os - Rust
-

Macro os::print

source · []
macro_rules! print {
+    

Macro os::print

source · []
macro_rules! print {
     ($fmt: literal $(, $($arg: tt)+)?) => { ... };
 }
-
+
Expand description

print string macro

+
\ No newline at end of file diff --git a/ch5/os/macro.println.html b/ch5/os/macro.println.html index 40626a4a..7073f76a 100644 --- a/ch5/os/macro.println.html +++ b/ch5/os/macro.println.html @@ -1,11 +1,12 @@ -println in os - Rust +println in os - Rust
-

Macro os::println

source · []
macro_rules! println {
+    

Macro os::println

source · []
macro_rules! println {
     ($fmt: literal $(, $($arg: tt)+)?) => { ... };
 }
-
+
Expand description

println string macro

+
\ No newline at end of file diff --git a/ch5/os/mm/address/constant.PA_WIDTH_SV39.html b/ch5/os/mm/address/constant.PA_WIDTH_SV39.html index 581afc43..d7a56f2d 100644 --- a/ch5/os/mm/address/constant.PA_WIDTH_SV39.html +++ b/ch5/os/mm/address/constant.PA_WIDTH_SV39.html @@ -1,8 +1,9 @@ -PA_WIDTH_SV39 in os::mm::address - Rust +PA_WIDTH_SV39 in os::mm::address - Rust
const PA_WIDTH_SV39: usize = 56;
+

Constant os::mm::address::PA_WIDTH_SV39

source · []
const PA_WIDTH_SV39: usize = 56;
Expand description

physical address

+
\ No newline at end of file diff --git a/ch5/os/mm/address/constant.PPN_WIDTH_SV39.html b/ch5/os/mm/address/constant.PPN_WIDTH_SV39.html index 9d5254cb..684a71e7 100644 --- a/ch5/os/mm/address/constant.PPN_WIDTH_SV39.html +++ b/ch5/os/mm/address/constant.PPN_WIDTH_SV39.html @@ -4,5 +4,5 @@
const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS; // 44usize
+

Constant os::mm::address::PPN_WIDTH_SV39

source · []
const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS; // 44usize
\ No newline at end of file diff --git a/ch5/os/mm/address/constant.VA_WIDTH_SV39.html b/ch5/os/mm/address/constant.VA_WIDTH_SV39.html index c8821bd0..ef15067b 100644 --- a/ch5/os/mm/address/constant.VA_WIDTH_SV39.html +++ b/ch5/os/mm/address/constant.VA_WIDTH_SV39.html @@ -4,5 +4,5 @@
const VA_WIDTH_SV39: usize = 39;
+

Constant os::mm::address::VA_WIDTH_SV39

source · []
const VA_WIDTH_SV39: usize = 39;
\ No newline at end of file diff --git a/ch5/os/mm/address/constant.VPN_WIDTH_SV39.html b/ch5/os/mm/address/constant.VPN_WIDTH_SV39.html index c4e11101..55d91999 100644 --- a/ch5/os/mm/address/constant.VPN_WIDTH_SV39.html +++ b/ch5/os/mm/address/constant.VPN_WIDTH_SV39.html @@ -4,5 +4,5 @@
const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS; // 27usize
+

Constant os::mm::address::VPN_WIDTH_SV39

source · []
const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS; // 27usize
\ No newline at end of file diff --git a/ch5/os/mm/address/index.html b/ch5/os/mm/address/index.html index 91016b9f..2548263b 100644 --- a/ch5/os/mm/address/index.html +++ b/ch5/os/mm/address/index.html @@ -1,13 +1,21 @@ -os::mm::address - Rust +os::mm::address - Rust
Expand description

Implementation of physical and virtual address and page number.

+

Structs

+

physical address

+

physical page number

+

a simple range structure for type T

+

iterator for the simple range structure

+

virtual address

+

virtual page number

+

Constants

+

physical address

+

Traits

Type Definitions

-
+

a simple range structure for virtual page number

+
\ No newline at end of file diff --git a/ch5/os/mm/address/sidebar-items.js b/ch5/os/mm/address/sidebar-items.js index 354c1cc1..d304b7a4 100644 --- a/ch5/os/mm/address/sidebar-items.js +++ b/ch5/os/mm/address/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["PA_WIDTH_SV39",""],["PPN_WIDTH_SV39",""],["VA_WIDTH_SV39",""],["VPN_WIDTH_SV39",""]],"struct":[["PhysAddr","Definitions"],["PhysPageNum",""],["SimpleRange",""],["SimpleRangeIterator",""],["VirtAddr",""],["VirtPageNum",""]],"trait":[["StepByOne",""]],"type":[["VPNRange",""]]}); \ No newline at end of file +initSidebarItems({"constant":[["PA_WIDTH_SV39","physical address"],["PPN_WIDTH_SV39",""],["VA_WIDTH_SV39",""],["VPN_WIDTH_SV39",""]],"struct":[["PhysAddr","physical address"],["PhysPageNum","physical page number"],["SimpleRange","a simple range structure for type T"],["SimpleRangeIterator","iterator for the simple range structure"],["VirtAddr","virtual address"],["VirtPageNum","virtual page number"]],"trait":[["StepByOne",""]],"type":[["VPNRange","a simple range structure for virtual page number"]]}); \ No newline at end of file diff --git a/ch5/os/mm/address/struct.PhysAddr.html b/ch5/os/mm/address/struct.PhysAddr.html index a6c07333..1403f493 100644 --- a/ch5/os/mm/address/struct.PhysAddr.html +++ b/ch5/os/mm/address/struct.PhysAddr.html @@ -1,35 +1,40 @@ -PhysAddr in os::mm::address - Rust +PhysAddr in os::mm::address - Rust
-

Struct os::mm::address::PhysAddr

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

Definitions

-

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Struct os::mm::address::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

+

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.

-

T: {PhysAddr, VirtAddr, PhysPageNum, VirtPageNum} +

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.

+

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

-

Converts to this type from the input type.

-

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

+

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

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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/struct.PhysPageNum.html b/ch5/os/mm/address/struct.PhysPageNum.html index 1446cc48..e1714daa 100644 --- a/ch5/os/mm/address/struct.PhysPageNum.html +++ b/ch5/os/mm/address/struct.PhysPageNum.html @@ -1,31 +1,33 @@ -PhysPageNum in os::mm::address - Rust +PhysPageNum in os::mm::address - Rust
pub struct PhysPageNum(pub usize);

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Struct os::mm::address::PhysPageNum

source · []
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

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.

-

This method returns an Ordering between self and other. 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.

+

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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/struct.SimpleRange.html b/ch5/os/mm/address/struct.SimpleRange.html index d4a8fcaa..76ce8881 100644 --- a/ch5/os/mm/address/struct.SimpleRange.html +++ b/ch5/os/mm/address/struct.SimpleRange.html @@ -1,18 +1,19 @@ -SimpleRange in os::mm::address - Rust +SimpleRange in os::mm::address - Rust
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, -}

Fields

l: Tr: T

Implementations

Trait Implementations

Returns a copy of the value. Read more

+}
Expand description

a simple range structure for type T

+

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 43902ffe..d5a6c2d9 100644 --- a/ch5/os/mm/address/struct.SimpleRangeIterator.html +++ b/ch5/os/mm/address/struct.SimpleRangeIterator.html @@ -1,14 +1,15 @@ -SimpleRangeIterator in os::mm::address - Rust +SimpleRangeIterator in os::mm::address - Rust
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, -}

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

+}
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

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 1e70e562..42e379b8 100644 --- a/ch5/os/mm/address/struct.VirtAddr.html +++ b/ch5/os/mm/address/struct.VirtAddr.html @@ -1,32 +1,37 @@ -VirtAddr in os::mm::address - Rust +VirtAddr in os::mm::address - Rust
-

Struct os::mm::address::VirtAddr

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

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Struct os::mm::address::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

+

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.

-

This method returns an Ordering between self and other. 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.

+

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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/struct.VirtPageNum.html b/ch5/os/mm/address/struct.VirtPageNum.html index 32b9bff9..486614af 100644 --- a/ch5/os/mm/address/struct.VirtPageNum.html +++ b/ch5/os/mm/address/struct.VirtPageNum.html @@ -1,31 +1,33 @@ -VirtPageNum in os::mm::address - Rust +VirtPageNum in os::mm::address - Rust
pub struct VirtPageNum(pub usize);

Tuple Fields

0: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+

Struct os::mm::address::VirtPageNum

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

virtual page number

+

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.

-

This method returns an Ordering between self and other. 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.

+

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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 9514e5bf..a52981fd 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 181e6262..256e5ad0 100644 --- a/ch5/os/mm/address/type.VPNRange.html +++ b/ch5/os/mm/address/type.VPNRange.html @@ -1,8 +1,9 @@ -VPNRange in os::mm::address - Rust +VPNRange in os::mm::address - Rust
-

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

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

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/fn.frame_alloc.html b/ch5/os/mm/fn.frame_alloc.html new file mode 100644 index 00000000..73a1c8f7 --- /dev/null +++ b/ch5/os/mm/fn.frame_alloc.html @@ -0,0 +1,9 @@ +frame_alloc in os::mm - Rust + +
+

Function os::mm::frame_alloc

source · []
pub fn frame_alloc() -> Option<FrameTracker>
Expand description

allocate a frame

+
+ \ No newline at end of file diff --git a/ch5/os/mm/fn.init.html b/ch5/os/mm/fn.init.html index 38d24f94..2be437d0 100644 --- a/ch5/os/mm/fn.init.html +++ b/ch5/os/mm/fn.init.html @@ -1,8 +1,9 @@ -init in os::mm - Rust +init in os::mm - Rust
-

Function os::mm::init

source · []
pub fn init()
+

Function os::mm::init

source · []
pub fn init()
Expand description

initiate heap allocator, frame allocator and kernel space

+
\ No newline at end of file diff --git a/ch5/os/mm/fn.remap_test.html b/ch5/os/mm/fn.remap_test.html new file mode 100644 index 00000000..af525c38 --- /dev/null +++ b/ch5/os/mm/fn.remap_test.html @@ -0,0 +1,9 @@ +remap_test in os::mm - Rust + +
+

Function os::mm::remap_test

source · []
pub fn remap_test()
Expand description

Check PageTable running correctly

+
+ \ No newline at end of file diff --git a/ch5/os/mm/fn.translated_byte_buffer.html b/ch5/os/mm/fn.translated_byte_buffer.html new file mode 100644 index 00000000..38843e07 --- /dev/null +++ b/ch5/os/mm/fn.translated_byte_buffer.html @@ -0,0 +1,9 @@ +translated_byte_buffer in os::mm - Rust + +
pub fn translated_byte_buffer(
    token: usize,
    ptr: *const u8,
    len: usize
) -> Vec<&'static mut [u8]>
Expand description

translate a pointer to a mutable u8 Vec through page table

+
+ \ No newline at end of file diff --git a/ch5/os/mm/fn.translated_refmut.html b/ch5/os/mm/fn.translated_refmut.html new file mode 100644 index 00000000..39bff0e2 --- /dev/null +++ b/ch5/os/mm/fn.translated_refmut.html @@ -0,0 +1,9 @@ +translated_refmut in os::mm - Rust + +
pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
Expand description

translate a generic through page table and return a mutable reference

+
+ \ No newline at end of file diff --git a/ch5/os/mm/fn.translated_str.html b/ch5/os/mm/fn.translated_str.html new file mode 100644 index 00000000..176d94d9 --- /dev/null +++ b/ch5/os/mm/fn.translated_str.html @@ -0,0 +1,9 @@ +translated_str in os::mm - Rust + +
+

Function os::mm::translated_str

source · []
pub fn translated_str(token: usize, ptr: *const u8) -> String
Expand description

translate a pointer to a mutable u8 Vec end with \0 through page table to a String

+
+ \ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/fn.frame_alloc.html b/ch5/os/mm/frame_allocator/fn.frame_alloc.html index 84b63b35..b8a61125 100644 --- a/ch5/os/mm/frame_allocator/fn.frame_alloc.html +++ b/ch5/os/mm/frame_allocator/fn.frame_alloc.html @@ -1,8 +1,9 @@ -frame_alloc in os::mm::frame_allocator - Rust +frame_alloc in os::mm::frame_allocator - Rust
pub fn frame_alloc() -> Option<FrameTracker>
+

Function os::mm::frame_allocator::frame_alloc

source · []
pub fn frame_alloc() -> Option<FrameTracker>
Expand description

allocate a frame

+
\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/fn.frame_allocator_test.html b/ch5/os/mm/frame_allocator/fn.frame_allocator_test.html index 433ea4ff..5ebf4e9a 100644 --- a/ch5/os/mm/frame_allocator/fn.frame_allocator_test.html +++ b/ch5/os/mm/frame_allocator/fn.frame_allocator_test.html @@ -1,8 +1,9 @@ -frame_allocator_test in os::mm::frame_allocator - Rust +frame_allocator_test in os::mm::frame_allocator - Rust
pub fn frame_allocator_test()
+

Function os::mm::frame_allocator::frame_allocator_test

source · []
pub fn frame_allocator_test()
Expand description

a simple test for frame allocator

+
\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/fn.frame_dealloc.html b/ch5/os/mm/frame_allocator/fn.frame_dealloc.html index 037e5b02..4cc35261 100644 --- a/ch5/os/mm/frame_allocator/fn.frame_dealloc.html +++ b/ch5/os/mm/frame_allocator/fn.frame_dealloc.html @@ -1,8 +1,9 @@ -frame_dealloc in os::mm::frame_allocator - Rust +frame_dealloc in os::mm::frame_allocator - Rust
fn frame_dealloc(ppn: PhysPageNum)
+

Function os::mm::frame_allocator::frame_dealloc

source · []
fn frame_dealloc(ppn: PhysPageNum)
Expand description

deallocate a frame

+
\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/fn.init_frame_allocator.html b/ch5/os/mm/frame_allocator/fn.init_frame_allocator.html index e64de651..b853fd2a 100644 --- a/ch5/os/mm/frame_allocator/fn.init_frame_allocator.html +++ b/ch5/os/mm/frame_allocator/fn.init_frame_allocator.html @@ -1,8 +1,9 @@ -init_frame_allocator in os::mm::frame_allocator - Rust +init_frame_allocator in os::mm::frame_allocator - Rust
pub fn init_frame_allocator()
+

Function os::mm::frame_allocator::init_frame_allocator

source · []
pub fn init_frame_allocator()
Expand description

initiate the frame allocator using ekernel and MEMORY_END

+
\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/index.html b/ch5/os/mm/frame_allocator/index.html index 5db17df9..1b780cf2 100644 --- a/ch5/os/mm/frame_allocator/index.html +++ b/ch5/os/mm/frame_allocator/index.html @@ -1,12 +1,21 @@ -os::mm::frame_allocator - Rust +os::mm::frame_allocator - Rust
Expand description

Implementation of FrameAllocator which +controls all the frames in the operating system.

+

Structs

+

frame allocator instance through lazy_static!

+

manage a frame which has the same lifecycle as the tracker

+

an implementation for frame allocator

+

Traits

Functions

-

Type Definitions

+

allocate a frame

+

a simple test for frame allocator

+

deallocate a frame

+

initiate the frame allocator using ekernel and MEMORY_END

+

Type Definitions

\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/sidebar-items.js b/ch5/os/mm/frame_allocator/sidebar-items.js index d63ca944..91a50bd8 100644 --- a/ch5/os/mm/frame_allocator/sidebar-items.js +++ b/ch5/os/mm/frame_allocator/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["frame_alloc",""],["frame_allocator_test",""],["frame_dealloc",""],["init_frame_allocator",""]],"struct":[["FRAME_ALLOCATOR",""],["FrameTracker",""],["StackFrameAllocator",""]],"trait":[["FrameAllocator",""]],"type":[["FrameAllocatorImpl",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["frame_alloc","allocate a frame"],["frame_allocator_test","a simple test for frame allocator"],["frame_dealloc","deallocate a frame"],["init_frame_allocator","initiate the frame allocator using `ekernel` and `MEMORY_END`"]],"struct":[["FRAME_ALLOCATOR","frame allocator instance through lazy_static!"],["FrameTracker","manage a frame which has the same lifecycle as the tracker"],["StackFrameAllocator","an implementation for frame allocator"]],"trait":[["FrameAllocator",""]],"type":[["FrameAllocatorImpl",""]]}); \ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html b/ch5/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html index 899a902b..7c0d41f9 100644 --- a/ch5/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html +++ b/ch5/os/mm/frame_allocator/struct.FRAME_ALLOCATOR.html @@ -1,15 +1,16 @@ -FRAME_ALLOCATOR in os::mm::frame_allocator - Rust +FRAME_ALLOCATOR in os::mm::frame_allocator - Rust
pub struct FRAME_ALLOCATOR {
+    

Struct os::mm::frame_allocator::FRAME_ALLOCATOR

source · []
pub struct FRAME_ALLOCATOR {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<StackFrameAllocator>>

Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

frame allocator instance through lazy_static!

+

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<StackFrameAllocator>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/frame_allocator/struct.FrameTracker.html b/ch5/os/mm/frame_allocator/struct.FrameTracker.html index b496d54b..6805929a 100644 --- a/ch5/os/mm/frame_allocator/struct.FrameTracker.html +++ b/ch5/os/mm/frame_allocator/struct.FrameTracker.html @@ -1,13 +1,15 @@ -FrameTracker in os::mm::frame_allocator - Rust +FrameTracker in os::mm::frame_allocator - Rust
pub struct FrameTracker {
+    

Struct os::mm::frame_allocator::FrameTracker

source · []
pub struct FrameTracker {
     pub ppn: PhysPageNum,
-}

Fields

ppn: PhysPageNum

Implementations

Trait Implementations

Formats the value using the given formatter. Read more

-

Executes the destructor for this type. Read more

+}
Expand description

manage a frame which has the same lifecycle as the tracker

+

Fields

ppn: PhysPageNum

Implementations

Create an empty FrameTracker

+

Trait Implementations

Formats the value using the given formatter. Read more

+

Executes the destructor for this type. 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

diff --git a/ch5/os/mm/frame_allocator/struct.StackFrameAllocator.html b/ch5/os/mm/frame_allocator/struct.StackFrameAllocator.html index ba254d29..7d776232 100644 --- a/ch5/os/mm/frame_allocator/struct.StackFrameAllocator.html +++ b/ch5/os/mm/frame_allocator/struct.StackFrameAllocator.html @@ -1,14 +1,15 @@ -StackFrameAllocator in os::mm::frame_allocator - Rust +StackFrameAllocator in os::mm::frame_allocator - Rust
pub struct StackFrameAllocator {
+    

Struct os::mm::frame_allocator::StackFrameAllocator

source · []
pub struct StackFrameAllocator {
     current: usize,
     end: usize,
     recycled: Vec<usize>,
-}

Fields

current: usizeend: usizerecycled: Vec<usize>

Implementations

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

an implementation for frame allocator

+

Fields

current: usizeend: usizerecycled: Vec<usize>

Implementations

Trait Implementations

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/frame_allocator/trait.FrameAllocator.html b/ch5/os/mm/frame_allocator/trait.FrameAllocator.html index f7667df8..72c2c9fb 100644 --- a/ch5/os/mm/frame_allocator/trait.FrameAllocator.html +++ b/ch5/os/mm/frame_allocator/trait.FrameAllocator.html @@ -4,9 +4,9 @@
trait FrameAllocator {
+    

Trait os::mm::frame_allocator::FrameAllocator

source · []
trait FrameAllocator {
     fn new() -> Self;
     fn alloc(&mut self) -> Option<PhysPageNum>;
     fn dealloc(&mut self, ppn: PhysPageNum);
-}

Required methods

Implementors

+}

Required methods

Implementors

\ No newline at end of file diff --git a/ch5/os/mm/frame_allocator/type.FrameAllocatorImpl.html b/ch5/os/mm/frame_allocator/type.FrameAllocatorImpl.html index 424c3b48..8e266eda 100644 --- a/ch5/os/mm/frame_allocator/type.FrameAllocatorImpl.html +++ b/ch5/os/mm/frame_allocator/type.FrameAllocatorImpl.html @@ -4,5 +4,5 @@
type FrameAllocatorImpl = StackFrameAllocator;
+

Type Definition os::mm::frame_allocator::FrameAllocatorImpl

source · []
type FrameAllocatorImpl = StackFrameAllocator;
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/fn.handle_alloc_error.html b/ch5/os/mm/heap_allocator/fn.handle_alloc_error.html index 2530c916..601c4266 100644 --- a/ch5/os/mm/heap_allocator/fn.handle_alloc_error.html +++ b/ch5/os/mm/heap_allocator/fn.handle_alloc_error.html @@ -1,8 +1,9 @@ -handle_alloc_error in os::mm::heap_allocator - Rust +handle_alloc_error in os::mm::heap_allocator - Rust
pub fn handle_alloc_error(layout: Layout) -> !
+

Function os::mm::heap_allocator::handle_alloc_error

source · []
pub fn handle_alloc_error(layout: Layout) -> !
Expand description

panic when heap allocation error occurs

+
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/fn.heap_test.html b/ch5/os/mm/heap_allocator/fn.heap_test.html index 6475c14f..ce7ad454 100644 --- a/ch5/os/mm/heap_allocator/fn.heap_test.html +++ b/ch5/os/mm/heap_allocator/fn.heap_test.html @@ -4,5 +4,5 @@
pub fn heap_test()
+

Function os::mm::heap_allocator::heap_test

source · []
pub fn heap_test()
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/fn.init_heap.html b/ch5/os/mm/heap_allocator/fn.init_heap.html index 6fafa7c1..21e3ec41 100644 --- a/ch5/os/mm/heap_allocator/fn.init_heap.html +++ b/ch5/os/mm/heap_allocator/fn.init_heap.html @@ -1,8 +1,9 @@ -init_heap in os::mm::heap_allocator - Rust +init_heap in os::mm::heap_allocator - Rust
pub fn init_heap()
+

Function os::mm::heap_allocator::init_heap

source · []
pub fn init_heap()
Expand description

initiate heap allocator

+
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/index.html b/ch5/os/mm/heap_allocator/index.html index a09e54a2..43eafb33 100644 --- a/ch5/os/mm/heap_allocator/index.html +++ b/ch5/os/mm/heap_allocator/index.html @@ -1,10 +1,15 @@ -os::mm::heap_allocator - Rust +os::mm::heap_allocator - Rust
+

Module os::mm::heap_allocator

source · []
Expand description

The global allocator

+

Statics

+

heap allocator instance

+
HEAP_SPACE 🔒

heap space ([u8; KERNEL_HEAP_SIZE])

+

Functions

+

panic when heap allocation error occurs

+

initiate heap allocator

+
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/sidebar-items.js b/ch5/os/mm/heap_allocator/sidebar-items.js index d1f423dc..a400d729 100644 --- a/ch5/os/mm/heap_allocator/sidebar-items.js +++ b/ch5/os/mm/heap_allocator/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["handle_alloc_error",""],["heap_test",""],["init_heap",""]],"static":[["HEAP_ALLOCATOR",""],["HEAP_SPACE",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["handle_alloc_error","panic when heap allocation error occurs"],["heap_test",""],["init_heap","initiate heap allocator"]],"static":[["HEAP_ALLOCATOR","heap allocator instance"],["HEAP_SPACE","heap space ([u8; KERNEL_HEAP_SIZE])"]]}); \ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html b/ch5/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html index bf4b1785..4703f7e9 100644 --- a/ch5/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html +++ b/ch5/os/mm/heap_allocator/static.HEAP_ALLOCATOR.html @@ -1,8 +1,9 @@ -HEAP_ALLOCATOR in os::mm::heap_allocator - Rust +HEAP_ALLOCATOR in os::mm::heap_allocator - Rust
static HEAP_ALLOCATOR: LockedHeap
+

Static os::mm::heap_allocator::HEAP_ALLOCATOR

source · []
static HEAP_ALLOCATOR: LockedHeap
Expand description

heap allocator instance

+
\ No newline at end of file diff --git a/ch5/os/mm/heap_allocator/static.HEAP_SPACE.html b/ch5/os/mm/heap_allocator/static.HEAP_SPACE.html index 10553534..208ea6c3 100644 --- a/ch5/os/mm/heap_allocator/static.HEAP_SPACE.html +++ b/ch5/os/mm/heap_allocator/static.HEAP_SPACE.html @@ -1,8 +1,9 @@ -HEAP_SPACE in os::mm::heap_allocator - Rust +HEAP_SPACE in os::mm::heap_allocator - Rust
static mut HEAP_SPACE: [u8; 2097152]
+

Static os::mm::heap_allocator::HEAP_SPACE

source · []
static mut HEAP_SPACE: [u8; 2097152]
Expand description

heap space ([u8; KERNEL_HEAP_SIZE])

+
\ No newline at end of file diff --git a/ch5/os/mm/index.html b/ch5/os/mm/index.html index 8f6a0508..d4d9d75e 100644 --- a/ch5/os/mm/index.html +++ b/ch5/os/mm/index.html @@ -1,11 +1,37 @@ -os::mm - Rust +os::mm - Rust
-

Module os::mm

source · []

Re-exports

-
pub use address::PhysAddr;
pub use address::PhysPageNum;
pub use address::VirtAddr;
pub use address::VirtPageNum;
pub use frame_allocator::frame_alloc;
pub use frame_allocator::FrameTracker;
pub use memory_set::remap_test;
pub use memory_set::MapPermission;
pub use memory_set::MemorySet;
pub use memory_set::KERNEL_SPACE;
pub use memory_set::KERNEL_SPACE;
pub use page_table::translated_byte_buffer;
pub use page_table::translated_refmut;
pub use page_table::translated_str;
pub use page_table::PageTableEntry;

Modules

-

Functions

-
+

Module mm

+

Module os::mm

source · []
Expand description

Memory management implementation

+

SV39 page-based virtual-memory architecture for RV64 systems, and +everything about memory management, like frame allocator, page table, +map area and memory set, is implemented here.

+

Every task or process has a memory_set to control its virtual memory.

+

Modules

+
address 🔒

Implementation of physical and virtual address and page number.

+

Implementation of FrameAllocator which +controls all the frames in the operating system.

+

The global allocator

+
memory_set 🔒

Implementation of MapArea and MemorySet.

+
page_table 🔒

Implementation of PageTableEntry and PageTable.

+

Structs

+

manage a frame which has the same lifecycle as the tracker

+

a memory set instance through lazy_static! managing kernel space

+

map permission corresponding to that in pte: R W X U

+

memory set structure, controls virtual-memory space

+

page table entry structure

+

physical address

+

physical page number

+

virtual address

+

virtual page number

+

Functions

+

allocate a frame

+

initiate heap allocator, frame allocator and kernel space

+

Check PageTable running correctly

+

translate a pointer to a mutable u8 Vec through page table

+

translate a generic through page table and return a mutable reference

+

translate a pointer to a mutable u8 Vec end with \0 through page table to a String

+
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/enum.MapType.html b/ch5/os/mm/memory_set/enum.MapType.html index f4086dd0..628e9098 100644 --- a/ch5/os/mm/memory_set/enum.MapType.html +++ b/ch5/os/mm/memory_set/enum.MapType.html @@ -1,19 +1,20 @@ -MapType in os::mm::memory_set - Rust +MapType in os::mm::memory_set - Rust
pub enum MapType {
+    

Enum os::mm::memory_set::MapType

source · []
pub enum MapType {
     Identical,
     Framed,
-}

Variants

Identical

Framed

Trait Implementations

Returns a copy of the value. Read more

+}
Expand description

map type for memory set: identical or framed

+

Variants

Identical

Framed

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

-

This method tests for self and other values to be equal, and is used +

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

-

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/memory_set/fn.ebss.html b/ch5/os/mm/memory_set/fn.ebss.html index abf3a54a..3eb32d69 100644 --- a/ch5/os/mm/memory_set/fn.ebss.html +++ b/ch5/os/mm/memory_set/fn.ebss.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::ebss

source · []
unsafe extern "C" fn ebss()
+

Function os::mm::memory_set::ebss

source · []
unsafe extern "C" fn ebss()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.edata.html b/ch5/os/mm/memory_set/fn.edata.html index e300398a..b4fb932e 100644 --- a/ch5/os/mm/memory_set/fn.edata.html +++ b/ch5/os/mm/memory_set/fn.edata.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::edata

source · []
unsafe extern "C" fn edata()
+

Function os::mm::memory_set::edata

source · []
unsafe extern "C" fn edata()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.ekernel.html b/ch5/os/mm/memory_set/fn.ekernel.html index 4104c50a..aeba8924 100644 --- a/ch5/os/mm/memory_set/fn.ekernel.html +++ b/ch5/os/mm/memory_set/fn.ekernel.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::ekernel

source · []
unsafe extern "C" fn ekernel()
+

Function os::mm::memory_set::ekernel

source · []
unsafe extern "C" fn ekernel()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.erodata.html b/ch5/os/mm/memory_set/fn.erodata.html index ea14c701..4519e0dd 100644 --- a/ch5/os/mm/memory_set/fn.erodata.html +++ b/ch5/os/mm/memory_set/fn.erodata.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::erodata

source · []
unsafe extern "C" fn erodata()
+

Function os::mm::memory_set::erodata

source · []
unsafe extern "C" fn erodata()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.etext.html b/ch5/os/mm/memory_set/fn.etext.html index 37af16a3..c9a582bc 100644 --- a/ch5/os/mm/memory_set/fn.etext.html +++ b/ch5/os/mm/memory_set/fn.etext.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::etext

source · []
unsafe extern "C" fn etext()
+

Function os::mm::memory_set::etext

source · []
unsafe extern "C" fn etext()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.remap_test.html b/ch5/os/mm/memory_set/fn.remap_test.html index ab367d53..523abc96 100644 --- a/ch5/os/mm/memory_set/fn.remap_test.html +++ b/ch5/os/mm/memory_set/fn.remap_test.html @@ -1,8 +1,9 @@ -remap_test in os::mm::memory_set - Rust +remap_test in os::mm::memory_set - Rust
pub fn remap_test()
+

Function os::mm::memory_set::remap_test

source · []
pub fn remap_test()
Expand description

Check PageTable running correctly

+
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.sbss_with_stack.html b/ch5/os/mm/memory_set/fn.sbss_with_stack.html index 6b2051e1..08d429d8 100644 --- a/ch5/os/mm/memory_set/fn.sbss_with_stack.html +++ b/ch5/os/mm/memory_set/fn.sbss_with_stack.html @@ -4,5 +4,5 @@
unsafe extern "C" fn sbss_with_stack()
+

Function os::mm::memory_set::sbss_with_stack

source · []
unsafe extern "C" fn sbss_with_stack()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.sdata.html b/ch5/os/mm/memory_set/fn.sdata.html index f9c26016..a8cd42d7 100644 --- a/ch5/os/mm/memory_set/fn.sdata.html +++ b/ch5/os/mm/memory_set/fn.sdata.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::sdata

source · []
unsafe extern "C" fn sdata()
+

Function os::mm::memory_set::sdata

source · []
unsafe extern "C" fn sdata()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.srodata.html b/ch5/os/mm/memory_set/fn.srodata.html index 04e306e2..1dee6349 100644 --- a/ch5/os/mm/memory_set/fn.srodata.html +++ b/ch5/os/mm/memory_set/fn.srodata.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::srodata

source · []
unsafe extern "C" fn srodata()
+

Function os::mm::memory_set::srodata

source · []
unsafe extern "C" fn srodata()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.stext.html b/ch5/os/mm/memory_set/fn.stext.html index 054f5de6..cecb13ad 100644 --- a/ch5/os/mm/memory_set/fn.stext.html +++ b/ch5/os/mm/memory_set/fn.stext.html @@ -4,5 +4,5 @@
-

Function os::mm::memory_set::stext

source · []
unsafe extern "C" fn stext()
+

Function os::mm::memory_set::stext

source · []
unsafe extern "C" fn stext()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/fn.strampoline.html b/ch5/os/mm/memory_set/fn.strampoline.html index d4c09c0c..b967e3d1 100644 --- a/ch5/os/mm/memory_set/fn.strampoline.html +++ b/ch5/os/mm/memory_set/fn.strampoline.html @@ -4,5 +4,5 @@
unsafe extern "C" fn strampoline()
+

Function os::mm::memory_set::strampoline

source · []
unsafe extern "C" fn strampoline()
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/index.html b/ch5/os/mm/memory_set/index.html index 329df564..26b31b58 100644 --- a/ch5/os/mm/memory_set/index.html +++ b/ch5/os/mm/memory_set/index.html @@ -1,11 +1,18 @@ -os::mm::memory_set - Rust +os::mm::memory_set - Rust
+

Module os::mm::memory_set

source · []
Expand description

Implementation of MapArea and MemorySet.

+

Structs

+

a memory set instance through lazy_static! managing kernel space

+

map area structure, controls a contiguous piece of virtual memory

+

map permission corresponding to that in pte: R W X U

+

memory set structure, controls virtual-memory space

+

Enums

+

map type for memory set: identical or framed

+

Functions

+
ebss 🔒
edata 🔒
ekernel 🔒
erodata 🔒
etext 🔒

Check PageTable running correctly

+
sdata 🔒
srodata 🔒
stext 🔒
\ No newline at end of file diff --git a/ch5/os/mm/memory_set/sidebar-items.js b/ch5/os/mm/memory_set/sidebar-items.js index 04cf13e9..b017b544 100644 --- a/ch5/os/mm/memory_set/sidebar-items.js +++ b/ch5/os/mm/memory_set/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["MapType",""]],"fn":[["ebss",""],["edata",""],["ekernel",""],["erodata",""],["etext",""],["remap_test",""],["sbss_with_stack",""],["sdata",""],["srodata",""],["stext",""],["strampoline",""]],"struct":[["KERNEL_SPACE",""],["MapArea",""],["MapPermission",""],["MemorySet",""]]}); \ No newline at end of file +initSidebarItems({"enum":[["MapType","map type for memory set: identical or framed"]],"fn":[["ebss",""],["edata",""],["ekernel",""],["erodata",""],["etext",""],["remap_test","Check PageTable running correctly"],["sbss_with_stack",""],["sdata",""],["srodata",""],["stext",""],["strampoline",""]],"struct":[["KERNEL_SPACE","a memory set instance through lazy_static! managing kernel space"],["MapArea","map area structure, controls a contiguous piece of virtual memory"],["MapPermission","map permission corresponding to that in pte: `R W X U`"],["MemorySet","memory set structure, controls virtual-memory space"]]}); \ No newline at end of file diff --git a/ch5/os/mm/memory_set/struct.KERNEL_SPACE.html b/ch5/os/mm/memory_set/struct.KERNEL_SPACE.html index 66b47393..42381bc8 100644 --- a/ch5/os/mm/memory_set/struct.KERNEL_SPACE.html +++ b/ch5/os/mm/memory_set/struct.KERNEL_SPACE.html @@ -1,14 +1,15 @@ -KERNEL_SPACE in os::mm::memory_set - Rust +KERNEL_SPACE in os::mm::memory_set - Rust
pub struct KERNEL_SPACE {
+    

Struct os::mm::memory_set::KERNEL_SPACE

source · []
pub struct KERNEL_SPACE {
     __private_field: (),
-}

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

a memory set instance through lazy_static! managing kernel space

+

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/memory_set/struct.MapArea.html b/ch5/os/mm/memory_set/struct.MapArea.html index 8fc773d8..93ddce46 100644 --- a/ch5/os/mm/memory_set/struct.MapArea.html +++ b/ch5/os/mm/memory_set/struct.MapArea.html @@ -1,15 +1,16 @@ -MapArea in os::mm::memory_set - Rust +MapArea in os::mm::memory_set - Rust
pub struct MapArea {
+    

Struct os::mm::memory_set::MapArea

source · []
pub struct MapArea {
     vpn_range: SimpleRange<VirtPageNum>,
     data_frames: BTreeMap<VirtPageNum, FrameTracker>,
     map_type: MapType,
     map_perm: MapPermission,
-}

Fields

vpn_range: SimpleRange<VirtPageNum>data_frames: BTreeMap<VirtPageNum, FrameTracker>map_type: MapTypemap_perm: MapPermission

Implementations

data: start-aligned but maybe with shorter length +}

Expand description

map area structure, controls a contiguous piece of virtual memory

+

Fields

vpn_range: SimpleRange<VirtPageNum>data_frames: BTreeMap<VirtPageNum, FrameTracker>map_type: MapTypemap_perm: MapPermission

Implementations

data: start-aligned but maybe with shorter length assume that all frames were cleared before

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

diff --git a/ch5/os/mm/memory_set/struct.MapPermission.html b/ch5/os/mm/memory_set/struct.MapPermission.html index 5daa5f40..ccc5f535 100644 --- a/ch5/os/mm/memory_set/struct.MapPermission.html +++ b/ch5/os/mm/memory_set/struct.MapPermission.html @@ -1,19 +1,24 @@ -MapPermission in os::mm::memory_set - Rust +MapPermission in os::mm::memory_set - Rust
pub struct MapPermission {
+    

Struct os::mm::memory_set::MapPermission

source · []
pub struct MapPermission {
     bits: u8,
-}

Fields

bits: u8

Implementations

Returns an empty set of flags.

-

Returns the set containing all flags.

-

Returns the raw value of the flags currently stored.

-

Convert from underlying bit representation, unless that +}

Expand description

map permission corresponding to that in pte: R W X U

+

Fields

bits: u8

Implementations

Readable

+

Writable

+

Excutable

+

Accessible in U mode

+

Returns an empty set of flags.

+

Returns the set containing all flags.

+

Returns the raw value of the flags currently stored.

+

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

-

Convert from underlying bit representation, dropping any bits +

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

-

Convert from underlying bit representation, preserving all +

Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

Safety

The caller of the bitflags! macro can chose to allow or @@ -21,35 +26,35 @@ disallow extra bits for their bitflags type.

The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

-

Returns true if no flags are currently stored.

-

Returns true if all flags are currently set.

-

Returns true if there are flags common to both self and other.

-

Returns true if all of the flags in other are contained within self.

-

Inserts the specified flags in-place.

-

Removes the specified flags in-place.

-

Toggles the specified flags in-place.

-

Inserts or removes the specified flags depending on the passed value.

-

Returns the intersection between the flags in self and +

Returns true if no flags are currently stored.

+

Returns true if all flags are currently set.

+

Returns true if there are flags common to both self and other.

+

Returns true if all of the flags in other are contained within self.

+

Inserts the specified flags in-place.

+

Removes the specified flags in-place.

+

Toggles the specified flags in-place.

+

Inserts or removes the specified flags depending on the passed value.

+

Returns the intersection between the flags in self and other.

Specifically, the returned set contains only the flags which are present in both self and other.

This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

-

Returns the union of between the flags in self and other.

+

Returns the union of between the flags in self and other.

Specifically, the returned set contains all flags which are present in either self or other, including any which are present in both (see Self::symmetric_difference if that is undesirable).

This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

-

Returns the difference between the flags in self and other.

+

Returns the difference between the flags in self and other.

Specifically, the returned set contains all flags present in self, except for the ones present in other.

It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

-

Returns the symmetric difference between the flags +

Returns the symmetric difference between the flags in self and other.

Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -57,55 +62,55 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

-

Returns the complement of this set of flags.

+

Returns the complement of this set of flags.

Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

Alternatively, it can be thought of as the set difference between Self::all() and self (e.g. Self::all() - self)

This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

-

Trait Implementations

Formats the value using the given formatter.

-

Returns the intersection between the two sets of flags.

+

Trait Implementations

Formats the value using the given formatter.

+

Returns the intersection between the two sets of flags.

The resulting type after applying the & operator.

-

Disables all flags disabled in the set.

-

Returns the union of the two sets of flags.

+

Disables all flags disabled in the set.

+

Returns the union of the two sets of flags.

The resulting type after applying the | operator.

-

Adds the set of flags.

-

Returns the left flags, but with all the right flags toggled.

+

Adds the set of flags.

+

Returns the left flags, but with all the right flags toggled.

The resulting type after applying the ^ operator.

-

Toggles the set of flags.

-

Returns a copy of the value. Read more

+

Toggles the set of flags.

+

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Extends a collection with the contents of an iterator. Read more

+

Formats the value using the given formatter. Read more

+

Extends a collection with the contents of an iterator. Read more

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. Read more

-

Creates a value from an iterator. Read more

-

Feeds this value into the given Hasher. Read more

+

Creates a value from an iterator. Read more

+

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

-

Formats the value using the given formatter.

-

Returns the complement of this set of flags.

+

Formats the value using the given formatter.

+

Returns the complement of this set of flags.

The resulting type after applying the ! operator.

-

Formats the value using the given formatter.

-

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

+

Formats the value using the given formatter.

+

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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

-

Returns the set difference of the two sets of flags.

+

Returns the set difference of the two sets of flags.

The resulting type after applying the - operator.

-

Disables all flags enabled in the set.

-

Formats the value using the given formatter.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Disables all flags enabled in the set.

+

Formats the value using the given formatter.

+

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/memory_set/struct.MemorySet.html b/ch5/os/mm/memory_set/struct.MemorySet.html index e781337c..d33b637c 100644 --- a/ch5/os/mm/memory_set/struct.MemorySet.html +++ b/ch5/os/mm/memory_set/struct.MemorySet.html @@ -1,18 +1,26 @@ -MemorySet in os::mm::memory_set - Rust +MemorySet in os::mm::memory_set - Rust
pub struct MemorySet {
+    

Struct os::mm::memory_set::MemorySet

source · []
pub struct MemorySet {
     page_table: PageTable,
     areas: Vec<MapArea>,
-}

Fields

page_table: PageTableareas: Vec<MapArea>

Implementations

Assume that no conflicts.

-

Mention that trampoline is not collected by areas.

-

Without kernel stacks.

-

Include sections in elf and trampoline and TrapContext and user stack, +}

Expand description

memory set structure, controls virtual-memory space

+

Fields

page_table: PageTableareas: Vec<MapArea>

Implementations

Create an empty MemorySet

+

Get pagetable root_ppn

+

Assume that no conflicts.

+

Remove MapArea that starts with start_vpn

+

Mention that trampoline is not collected by areas.

+

Without kernel stacks.

+

Include sections in elf and trampoline and TrapContext and user stack, also returns user_sp and entry point.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Clone a same MemorySet

+

Refresh TLB with sfence.vma

+

Translate throuth pagetable

+

Remove all MapArea

+

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/page_table/fn.translated_byte_buffer.html b/ch5/os/mm/page_table/fn.translated_byte_buffer.html index e56ed8cd..ea83cac3 100644 --- a/ch5/os/mm/page_table/fn.translated_byte_buffer.html +++ b/ch5/os/mm/page_table/fn.translated_byte_buffer.html @@ -1,8 +1,9 @@ -translated_byte_buffer in os::mm::page_table - Rust +translated_byte_buffer in os::mm::page_table - Rust
pub fn translated_byte_buffer(
    token: usize,
    ptr: *const u8,
    len: usize
) -> Vec<&'static mut [u8]>
+

Function os::mm::page_table::translated_byte_buffer

source · []
pub fn translated_byte_buffer(
    token: usize,
    ptr: *const u8,
    len: usize
) -> Vec<&'static mut [u8]>
Expand description

translate a pointer to a mutable u8 Vec through page table

+
\ No newline at end of file diff --git a/ch5/os/mm/page_table/fn.translated_refmut.html b/ch5/os/mm/page_table/fn.translated_refmut.html index 427feb7f..118cba2b 100644 --- a/ch5/os/mm/page_table/fn.translated_refmut.html +++ b/ch5/os/mm/page_table/fn.translated_refmut.html @@ -1,8 +1,9 @@ -translated_refmut in os::mm::page_table - Rust +translated_refmut in os::mm::page_table - Rust
pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
+

Function os::mm::page_table::translated_refmut

source · []
pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T
Expand description

translate a generic through page table and return a mutable reference

+
\ No newline at end of file diff --git a/ch5/os/mm/page_table/fn.translated_str.html b/ch5/os/mm/page_table/fn.translated_str.html index 1919d3c4..f3c5d5d6 100644 --- a/ch5/os/mm/page_table/fn.translated_str.html +++ b/ch5/os/mm/page_table/fn.translated_str.html @@ -1,8 +1,9 @@ -translated_str in os::mm::page_table - Rust +translated_str in os::mm::page_table - Rust
pub fn translated_str(token: usize, ptr: *const u8) -> String
+

Function os::mm::page_table::translated_str

source · []
pub fn translated_str(token: usize, ptr: *const u8) -> String
Expand description

translate a pointer to a mutable u8 Vec end with \0 through page table to a String

+
\ No newline at end of file diff --git a/ch5/os/mm/page_table/index.html b/ch5/os/mm/page_table/index.html index a2b53e78..1d01c375 100644 --- a/ch5/os/mm/page_table/index.html +++ b/ch5/os/mm/page_table/index.html @@ -1,10 +1,15 @@ -os::mm::page_table - Rust +os::mm::page_table - Rust
+

Module os::mm::page_table

source · []
Expand description

Implementation of PageTableEntry and PageTable.

+

Structs

+

page table entry structure

+

Functions

+

translate a pointer to a mutable u8 Vec through page table

+

translate a generic through page table and return a mutable reference

+

translate a pointer to a mutable u8 Vec end with \0 through page table to a String

+
\ No newline at end of file diff --git a/ch5/os/mm/page_table/sidebar-items.js b/ch5/os/mm/page_table/sidebar-items.js index abce6e18..ffa32f4c 100644 --- a/ch5/os/mm/page_table/sidebar-items.js +++ b/ch5/os/mm/page_table/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["translated_byte_buffer",""],["translated_refmut",""],["translated_str",""]],"struct":[["PTEFlags",""],["PageTable",""],["PageTableEntry",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["translated_byte_buffer","translate a pointer to a mutable u8 Vec through page table"],["translated_refmut","translate a generic through page table and return a mutable reference"],["translated_str","translate a pointer to a mutable u8 Vec end with `\\0` through page table to a `String`"]],"struct":[["PTEFlags",""],["PageTable",""],["PageTableEntry","page table entry structure"]]}); \ No newline at end of file diff --git a/ch5/os/mm/page_table/struct.PTEFlags.html b/ch5/os/mm/page_table/struct.PTEFlags.html index 569d8117..06eff429 100644 --- a/ch5/os/mm/page_table/struct.PTEFlags.html +++ b/ch5/os/mm/page_table/struct.PTEFlags.html @@ -4,16 +4,16 @@
pub struct PTEFlags {
+    

Struct os::mm::page_table::PTEFlags

source · []
pub struct PTEFlags {
     bits: u8,
-}

Fields

bits: u8

Implementations

Returns an empty set of flags.

-

Returns the set containing all flags.

-

Returns the raw value of the flags currently stored.

-

Convert from underlying bit representation, unless that +}

Fields

bits: u8

Implementations

Returns an empty set of flags.

+

Returns the set containing all flags.

+

Returns the raw value of the flags currently stored.

+

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

-

Convert from underlying bit representation, dropping any bits +

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

-

Convert from underlying bit representation, preserving all +

Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).

Safety

The caller of the bitflags! macro can chose to allow or @@ -21,35 +21,35 @@ disallow extra bits for their bitflags type.

The caller of from_bits_unchecked() has to ensure that all bits correspond to a defined flag or that extra bits are valid for this bitflags type.

-

Returns true if no flags are currently stored.

-

Returns true if all flags are currently set.

-

Returns true if there are flags common to both self and other.

-

Returns true if all of the flags in other are contained within self.

-

Inserts the specified flags in-place.

-

Removes the specified flags in-place.

-

Toggles the specified flags in-place.

-

Inserts or removes the specified flags depending on the passed value.

-

Returns the intersection between the flags in self and +

Returns true if no flags are currently stored.

+

Returns true if all flags are currently set.

+

Returns true if there are flags common to both self and other.

+

Returns true if all of the flags in other are contained within self.

+

Inserts the specified flags in-place.

+

Removes the specified flags in-place.

+

Toggles the specified flags in-place.

+

Inserts or removes the specified flags depending on the passed value.

+

Returns the intersection between the flags in self and other.

Specifically, the returned set contains only the flags which are present in both self and other.

This is equivalent to using the & operator (e.g. ops::BitAnd), as in flags & other.

-

Returns the union of between the flags in self and other.

+

Returns the union of between the flags in self and other.

Specifically, the returned set contains all flags which are present in either self or other, including any which are present in both (see Self::symmetric_difference if that is undesirable).

This is equivalent to using the | operator (e.g. ops::BitOr), as in flags | other.

-

Returns the difference between the flags in self and other.

+

Returns the difference between the flags in self and other.

Specifically, the returned set contains all flags present in self, except for the ones present in other.

It is also conceptually equivalent to the “bit-clear” operation: flags & !other (and this syntax is also supported).

This is equivalent to using the - operator (e.g. ops::Sub), as in flags - other.

-

Returns the symmetric difference between the flags +

Returns the symmetric difference between the flags in self and other.

Specifically, the returned set contains the flags present which are present in self or other, but that are not present in @@ -57,55 +57,55 @@ both. Equivalently, it contains the flags present in exactly one of the sets self and other.

This is equivalent to using the ^ operator (e.g. ops::BitXor), as in flags ^ other.

-

Returns the complement of this set of flags.

+

Returns the complement of this set of flags.

Specifically, the returned set contains all the flags which are not set in self, but which are allowed for this type.

Alternatively, it can be thought of as the set difference between Self::all() and self (e.g. Self::all() - self)

This is equivalent to using the ! operator (e.g. ops::Not), as in !flags.

-

Trait Implementations

Formats the value using the given formatter.

-

Returns the intersection between the two sets of flags.

+

Trait Implementations

Formats the value using the given formatter.

+

Returns the intersection between the two sets of flags.

The resulting type after applying the & operator.

-

Disables all flags disabled in the set.

-

Returns the union of the two sets of flags.

+

Disables all flags disabled in the set.

+

Returns the union of the two sets of flags.

The resulting type after applying the | operator.

-

Adds the set of flags.

-

Returns the left flags, but with all the right flags toggled.

+

Adds the set of flags.

+

Returns the left flags, but with all the right flags toggled.

The resulting type after applying the ^ operator.

-

Toggles the set of flags.

-

Returns a copy of the value. Read more

+

Toggles the set of flags.

+

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Extends a collection with the contents of an iterator. Read more

+

Formats the value using the given formatter. Read more

+

Extends a collection with the contents of an iterator. Read more

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. Read more

-

Creates a value from an iterator. Read more

-

Feeds this value into the given Hasher. Read more

+

Creates a value from an iterator. Read more

+

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

-

Formats the value using the given formatter.

-

Returns the complement of this set of flags.

+

Formats the value using the given formatter.

+

Returns the complement of this set of flags.

The resulting type after applying the ! operator.

-

Formats the value using the given formatter.

-

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

+

Formats the value using the given formatter.

+

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

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

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

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

-

Returns the set difference of the two sets of flags.

+

Returns the set difference of the two sets of flags.

The resulting type after applying the - operator.

-

Disables all flags enabled in the set.

-

Formats the value using the given formatter.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Disables all flags enabled in the set.

+

Formats the value using the given formatter.

+

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/page_table/struct.PageTable.html b/ch5/os/mm/page_table/struct.PageTable.html index 62e7a55d..2ded383f 100644 --- a/ch5/os/mm/page_table/struct.PageTable.html +++ b/ch5/os/mm/page_table/struct.PageTable.html @@ -4,12 +4,12 @@
pub struct PageTable {
+    

Struct os::mm::page_table::PageTable

source · []
pub struct PageTable {
     root_ppn: PhysPageNum,
     frames: Vec<FrameTracker>,
-}

Fields

root_ppn: PhysPageNumframes: Vec<FrameTracker>

Implementations

Assume that it won’t oom when creating/mapping.

-

Temporarily used to get arguments from user space.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

root_ppn: PhysPageNumframes: Vec<FrameTracker>

Implementations

Assume that it won’t oom when creating/mapping.

+

Temporarily used to get arguments from user space.

+

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/page_table/struct.PageTableEntry.html b/ch5/os/mm/page_table/struct.PageTableEntry.html index a22fe547..ae7f693d 100644 --- a/ch5/os/mm/page_table/struct.PageTableEntry.html +++ b/ch5/os/mm/page_table/struct.PageTableEntry.html @@ -1,14 +1,24 @@ -PageTableEntry in os::mm::page_table - Rust +PageTableEntry in os::mm::page_table - Rust
#[repr(C)]
pub struct PageTableEntry { +

Struct os::mm::page_table::PageTableEntry

source · []
#[repr(C)]
pub struct PageTableEntry { pub bits: usize, -}

Fields

bits: usize

Implementations

Trait Implementations

Returns a copy of the value. Read more

+}
Expand description

page table entry structure

+

Fields

bits: usize

PTE

+

Implementations

Create a PTE from ppn

+

Return an empty PTE

+

Return 44bit ppn

+

Return 10bit flag

+

Check PTE valid

+

Check PTE readable

+

Check PTE writable

+

Check PTE executable

+

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. 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/sidebar-items.js b/ch5/os/mm/sidebar-items.js index 5e2f1aaa..14b1f3a4 100644 --- a/ch5/os/mm/sidebar-items.js +++ b/ch5/os/mm/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["init",""]],"mod":[["address",""],["frame_allocator",""],["heap_allocator",""],["memory_set",""],["page_table",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["frame_alloc","allocate a frame"],["init","initiate heap allocator, frame allocator and kernel space"],["remap_test","Check PageTable running correctly"],["translated_byte_buffer","translate a pointer to a mutable u8 Vec through page table"],["translated_refmut","translate a generic through page table and return a mutable reference"],["translated_str","translate a pointer to a mutable u8 Vec end with `\\0` through page table to a `String`"]],"mod":[["address","Implementation of physical and virtual address and page number."],["frame_allocator","Implementation of [`FrameAllocator`] which controls all the frames in the operating system."],["heap_allocator","The global allocator"],["memory_set","Implementation of [`MapArea`] and [`MemorySet`]."],["page_table","Implementation of [`PageTableEntry`] and [`PageTable`]."]],"struct":[["FrameTracker","manage a frame which has the same lifecycle as the tracker"],["KERNEL_SPACE","a memory set instance through lazy_static! managing kernel space"],["MapPermission","map permission corresponding to that in pte: `R W X U`"],["MemorySet","memory set structure, controls virtual-memory space"],["PageTableEntry","page table entry structure"],["PhysAddr","physical address"],["PhysPageNum","physical page number"],["VirtAddr","virtual address"],["VirtPageNum","virtual page number"]]}); \ No newline at end of file diff --git a/ch5/os/mm/struct.FrameTracker.html b/ch5/os/mm/struct.FrameTracker.html new file mode 100644 index 00000000..cb4f6398 --- /dev/null +++ b/ch5/os/mm/struct.FrameTracker.html @@ -0,0 +1,25 @@ +FrameTracker in os::mm - Rust + +
+

Struct os::mm::FrameTracker

source · []
pub struct FrameTracker {
+    pub ppn: PhysPageNum,
+}
Expand description

manage a frame which has the same lifecycle as the tracker

+

Fields

ppn: PhysPageNum

Implementations

Create an empty FrameTracker

+

Trait Implementations

Formats the value using the given formatter. Read more

+

Executes the destructor for this type. 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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.KERNEL_SPACE.html b/ch5/os/mm/struct.KERNEL_SPACE.html new file mode 100644 index 00000000..a9a9ae4f --- /dev/null +++ b/ch5/os/mm/struct.KERNEL_SPACE.html @@ -0,0 +1,24 @@ +KERNEL_SPACE in os::mm - Rust + +
+

Struct os::mm::KERNEL_SPACE

source · []
pub struct KERNEL_SPACE {
+    __private_field: (),
+}
Expand description

a memory set instance through lazy_static! managing kernel space

+

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.MapPermission.html b/ch5/os/mm/struct.MapPermission.html new file mode 100644 index 00000000..b5918def --- /dev/null +++ b/ch5/os/mm/struct.MapPermission.html @@ -0,0 +1,128 @@ +MapPermission in os::mm - Rust + +
pub struct MapPermission {
+    bits: u8,
+}
Expand description

map permission corresponding to that in pte: R W X U

+

Fields

bits: u8

Implementations

Readable

+

Writable

+

Excutable

+

Accessible in U mode

+

Returns an empty set of flags.

+

Returns the set containing all flags.

+

Returns the raw value of the flags currently stored.

+

Convert from underlying bit representation, unless that +representation contains bits that do not correspond to a flag.

+

Convert from underlying bit representation, dropping any bits +that do not correspond to flags.

+

Convert from underlying bit representation, preserving all +bits (even those not corresponding to a defined flag).

+
Safety
+

The caller of the bitflags! macro can chose to allow or +disallow extra bits for their bitflags type.

+

The caller of from_bits_unchecked() has to ensure that +all bits correspond to a defined flag or that extra bits +are valid for this bitflags type.

+

Returns true if no flags are currently stored.

+

Returns true if all flags are currently set.

+

Returns true if there are flags common to both self and other.

+

Returns true if all of the flags in other are contained within self.

+

Inserts the specified flags in-place.

+

Removes the specified flags in-place.

+

Toggles the specified flags in-place.

+

Inserts or removes the specified flags depending on the passed value.

+

Returns the intersection between the flags in self and +other.

+

Specifically, the returned set contains only the flags which are +present in both self and other.

+

This is equivalent to using the & operator (e.g. +ops::BitAnd), as in flags & other.

+

Returns the union of between the flags in self and other.

+

Specifically, the returned set contains all flags which are +present in either self or other, including any which are +present in both (see Self::symmetric_difference if that +is undesirable).

+

This is equivalent to using the | operator (e.g. +ops::BitOr), as in flags | other.

+

Returns the difference between the flags in self and other.

+

Specifically, the returned set contains all flags present in +self, except for the ones present in other.

+

It is also conceptually equivalent to the “bit-clear” operation: +flags & !other (and this syntax is also supported).

+

This is equivalent to using the - operator (e.g. +ops::Sub), as in flags - other.

+

Returns the symmetric difference between the flags +in self and other.

+

Specifically, the returned set contains the flags present which +are present in self or other, but that are not present in +both. Equivalently, it contains the flags present in exactly +one of the sets self and other.

+

This is equivalent to using the ^ operator (e.g. +ops::BitXor), as in flags ^ other.

+

Returns the complement of this set of flags.

+

Specifically, the returned set contains all the flags which are +not set in self, but which are allowed for this type.

+

Alternatively, it can be thought of as the set difference +between Self::all() and self (e.g. Self::all() - self)

+

This is equivalent to using the ! operator (e.g. +ops::Not), as in !flags.

+

Trait Implementations

Formats the value using the given formatter.

+

Returns the intersection between the two sets of flags.

+

The resulting type after applying the & operator.

+

Disables all flags disabled in the set.

+

Returns the union of the two sets of flags.

+

The resulting type after applying the | operator.

+

Adds the set of flags.

+

Returns the left flags, but with all the right flags toggled.

+

The resulting type after applying the ^ operator.

+

Toggles the set of flags.

+

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Extends a collection with the contents of an iterator. Read more

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. Read more

+

Creates a value from an iterator. Read more

+

Feeds this value into the given Hasher. Read more

+

Feeds a slice of this type into the given Hasher. Read more

+

Formats the value using the given formatter.

+

Returns the complement of this set of flags.

+

The resulting type after applying the ! operator.

+

Formats the value using the given formatter.

+

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

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

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

+

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

+

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

+

Returns the set difference of the two sets of flags.

+

The resulting type after applying the - operator.

+

Disables all flags enabled in the set.

+

Formats the value using the given formatter.

+

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.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.MemorySet.html b/ch5/os/mm/struct.MemorySet.html new file mode 100644 index 00000000..4552c94c --- /dev/null +++ b/ch5/os/mm/struct.MemorySet.html @@ -0,0 +1,35 @@ +MemorySet in os::mm - Rust + +
+

Struct os::mm::MemorySet

source · []
pub struct MemorySet {
+    page_table: PageTable,
+    areas: Vec<MapArea>,
+}
Expand description

memory set structure, controls virtual-memory space

+

Fields

page_table: PageTableareas: Vec<MapArea>

Implementations

Create an empty MemorySet

+

Get pagetable root_ppn

+

Assume that no conflicts.

+

Remove MapArea that starts with start_vpn

+

Mention that trampoline is not collected by areas.

+

Without kernel stacks.

+

Include sections in elf and trampoline and TrapContext and user stack, +also returns user_sp and entry point.

+

Clone a same MemorySet

+

Refresh TLB with sfence.vma

+

Translate throuth pagetable

+

Remove all MapArea

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.PageTableEntry.html b/ch5/os/mm/struct.PageTableEntry.html new file mode 100644 index 00000000..02ee7016 --- /dev/null +++ b/ch5/os/mm/struct.PageTableEntry.html @@ -0,0 +1,36 @@ +PageTableEntry in os::mm - Rust + +
#[repr(C)]
pub struct PageTableEntry { + pub bits: usize, +}
Expand description

page table entry structure

+

Fields

bits: usize

PTE

+

Implementations

Create a PTE from ppn

+

Return an empty PTE

+

Return 44bit ppn

+

Return 10bit flag

+

Check PTE valid

+

Check PTE readable

+

Check PTE writable

+

Check PTE executable

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. 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.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.PhysAddr.html b/ch5/os/mm/struct.PhysAddr.html new file mode 100644 index 00000000..719c87bd --- /dev/null +++ b/ch5/os/mm/struct.PhysAddr.html @@ -0,0 +1,52 @@ +PhysAddr in os::mm - Rust + +
+

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

+

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.

+

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

+

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

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

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

+

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

+

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

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.PhysPageNum.html b/ch5/os/mm/struct.PhysPageNum.html new file mode 100644 index 00000000..f08d0081 --- /dev/null +++ b/ch5/os/mm/struct.PhysPageNum.html @@ -0,0 +1,45 @@ +PhysPageNum in os::mm - Rust + +
+

Struct os::mm::PhysPageNum

source · []
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

+

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.

+

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

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

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

+

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

+

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

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.VirtAddr.html b/ch5/os/mm/struct.VirtAddr.html new file mode 100644 index 00000000..83777bbc --- /dev/null +++ b/ch5/os/mm/struct.VirtAddr.html @@ -0,0 +1,49 @@ +VirtAddr in os::mm - Rust + +
+

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

+

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.

+

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

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

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

+

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

+

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

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/mm/struct.VirtPageNum.html b/ch5/os/mm/struct.VirtPageNum.html new file mode 100644 index 00000000..a47aee9a --- /dev/null +++ b/ch5/os/mm/struct.VirtPageNum.html @@ -0,0 +1,45 @@ +VirtPageNum in os::mm - Rust + +
+

Struct os::mm::VirtPageNum

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

virtual page number

+

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.

+

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

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

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

+

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

+

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

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+

The resulting type after obtaining ownership.

+

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

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

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_CLEAR_IPI.html b/ch5/os/sbi/constant.SBI_CLEAR_IPI.html index f5d56dfa..be14110f 100644 --- a/ch5/os/sbi/constant.SBI_CLEAR_IPI.html +++ b/ch5/os/sbi/constant.SBI_CLEAR_IPI.html @@ -4,5 +4,5 @@
-

Constant os::sbi::SBI_CLEAR_IPI

source · []
const SBI_CLEAR_IPI: usize = 3;
+

Constant os::sbi::SBI_CLEAR_IPI

source · []
const SBI_CLEAR_IPI: usize = 3;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_CONSOLE_GETCHAR.html b/ch5/os/sbi/constant.SBI_CONSOLE_GETCHAR.html index 042f0251..abc48e6e 100644 --- a/ch5/os/sbi/constant.SBI_CONSOLE_GETCHAR.html +++ b/ch5/os/sbi/constant.SBI_CONSOLE_GETCHAR.html @@ -4,5 +4,5 @@
const SBI_CONSOLE_GETCHAR: usize = 2;
+

Constant os::sbi::SBI_CONSOLE_GETCHAR

source · []
const SBI_CONSOLE_GETCHAR: usize = 2;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html b/ch5/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html index fca7335b..e1bb6f31 100644 --- a/ch5/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html +++ b/ch5/os/sbi/constant.SBI_CONSOLE_PUTCHAR.html @@ -4,5 +4,5 @@
const SBI_CONSOLE_PUTCHAR: usize = 1;
+

Constant os::sbi::SBI_CONSOLE_PUTCHAR

source · []
const SBI_CONSOLE_PUTCHAR: usize = 1;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_REMOTE_FENCE_I.html b/ch5/os/sbi/constant.SBI_REMOTE_FENCE_I.html index cb9d263a..34b2f2c5 100644 --- a/ch5/os/sbi/constant.SBI_REMOTE_FENCE_I.html +++ b/ch5/os/sbi/constant.SBI_REMOTE_FENCE_I.html @@ -4,5 +4,5 @@
const SBI_REMOTE_FENCE_I: usize = 5;
+

Constant os::sbi::SBI_REMOTE_FENCE_I

source · []
const SBI_REMOTE_FENCE_I: usize = 5;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html b/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html index 4a7078eb..49295e76 100644 --- a/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html +++ b/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA.html @@ -4,5 +4,5 @@
const SBI_REMOTE_SFENCE_VMA: usize = 6;
+

Constant os::sbi::SBI_REMOTE_SFENCE_VMA

source · []
const SBI_REMOTE_SFENCE_VMA: usize = 6;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html b/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html index 3c7e411b..23f4fa82 100644 --- a/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html +++ b/ch5/os/sbi/constant.SBI_REMOTE_SFENCE_VMA_ASID.html @@ -4,5 +4,5 @@
const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
+

Constant os::sbi::SBI_REMOTE_SFENCE_VMA_ASID

source · []
const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_SEND_IPI.html b/ch5/os/sbi/constant.SBI_SEND_IPI.html index 07195820..e58b3592 100644 --- a/ch5/os/sbi/constant.SBI_SEND_IPI.html +++ b/ch5/os/sbi/constant.SBI_SEND_IPI.html @@ -4,5 +4,5 @@
-

Constant os::sbi::SBI_SEND_IPI

source · []
const SBI_SEND_IPI: usize = 4;
+

Constant os::sbi::SBI_SEND_IPI

source · []
const SBI_SEND_IPI: usize = 4;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_SET_TIMER.html b/ch5/os/sbi/constant.SBI_SET_TIMER.html index 5fcd7bc4..fd0ae79d 100644 --- a/ch5/os/sbi/constant.SBI_SET_TIMER.html +++ b/ch5/os/sbi/constant.SBI_SET_TIMER.html @@ -4,5 +4,5 @@
-

Constant os::sbi::SBI_SET_TIMER

source · []
const SBI_SET_TIMER: usize = 0;
+

Constant os::sbi::SBI_SET_TIMER

source · []
const SBI_SET_TIMER: usize = 0;
\ No newline at end of file diff --git a/ch5/os/sbi/constant.SBI_SHUTDOWN.html b/ch5/os/sbi/constant.SBI_SHUTDOWN.html index bfed6936..b1e93dc4 100644 --- a/ch5/os/sbi/constant.SBI_SHUTDOWN.html +++ b/ch5/os/sbi/constant.SBI_SHUTDOWN.html @@ -4,5 +4,5 @@
-

Constant os::sbi::SBI_SHUTDOWN

source · []
const SBI_SHUTDOWN: usize = 8;
+

Constant os::sbi::SBI_SHUTDOWN

source · []
const SBI_SHUTDOWN: usize = 8;
\ No newline at end of file diff --git a/ch5/os/sbi/fn.console_getchar.html b/ch5/os/sbi/fn.console_getchar.html index 1223ca43..932d8efa 100644 --- a/ch5/os/sbi/fn.console_getchar.html +++ b/ch5/os/sbi/fn.console_getchar.html @@ -1,8 +1,9 @@ -console_getchar in os::sbi - Rust +console_getchar in os::sbi - Rust
pub fn console_getchar() -> usize
+

Function os::sbi::console_getchar

source · []
pub fn console_getchar() -> usize
Expand description

use sbi call to getchar from console (qemu uart handler)

+
\ No newline at end of file diff --git a/ch5/os/sbi/fn.console_putchar.html b/ch5/os/sbi/fn.console_putchar.html index f65a2732..e2ce33c0 100644 --- a/ch5/os/sbi/fn.console_putchar.html +++ b/ch5/os/sbi/fn.console_putchar.html @@ -1,8 +1,9 @@ -console_putchar in os::sbi - Rust +console_putchar in os::sbi - Rust
pub fn console_putchar(c: usize)
+

Function os::sbi::console_putchar

source · []
pub fn console_putchar(c: usize)
Expand description

use sbi call to putchar in console (qemu uart handler)

+
\ No newline at end of file diff --git a/ch5/os/sbi/fn.sbi_call.html b/ch5/os/sbi/fn.sbi_call.html index 7555efc9..66b7ef38 100644 --- a/ch5/os/sbi/fn.sbi_call.html +++ b/ch5/os/sbi/fn.sbi_call.html @@ -1,8 +1,9 @@ -sbi_call in os::sbi - Rust +sbi_call in os::sbi - Rust
-

Function os::sbi::sbi_call

source · []
fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize
+

Function os::sbi::sbi_call

source · []
fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize
Expand description

general sbi call

+
\ No newline at end of file diff --git a/ch5/os/sbi/fn.set_timer.html b/ch5/os/sbi/fn.set_timer.html index a189954c..b70b7d93 100644 --- a/ch5/os/sbi/fn.set_timer.html +++ b/ch5/os/sbi/fn.set_timer.html @@ -1,8 +1,9 @@ -set_timer in os::sbi - Rust +set_timer in os::sbi - Rust
-

Function os::sbi::set_timer

source · []
pub fn set_timer(timer: usize)
+

Function os::sbi::set_timer

source · []
pub fn set_timer(timer: usize)
Expand description

use sbi call to set timer

+
\ No newline at end of file diff --git a/ch5/os/sbi/fn.shutdown.html b/ch5/os/sbi/fn.shutdown.html index 67e910eb..e9d396bb 100644 --- a/ch5/os/sbi/fn.shutdown.html +++ b/ch5/os/sbi/fn.shutdown.html @@ -1,8 +1,9 @@ -shutdown in os::sbi - Rust +shutdown in os::sbi - Rust
-

Function os::sbi::shutdown

source · []
pub fn shutdown() -> !
+

Function os::sbi::shutdown

source · []
pub fn shutdown() -> !
Expand description

use sbi call to shutdown the kernel

+
\ No newline at end of file diff --git a/ch5/os/sbi/index.html b/ch5/os/sbi/index.html index a6c08362..63a2a420 100644 --- a/ch5/os/sbi/index.html +++ b/ch5/os/sbi/index.html @@ -1,10 +1,16 @@ -os::sbi - Rust +os::sbi - Rust
-

Module os::sbi

source · []

Constants

+

Module os::sbi

source · []
Expand description

SBI call wrappers

+

Constants

Functions

-
+

use sbi call to getchar from console (qemu uart handler)

+

use sbi call to putchar in console (qemu uart handler)

+
sbi_call 🔒

general sbi call

+

use sbi call to set timer

+

use sbi call to shutdown the kernel

+
\ No newline at end of file diff --git a/ch5/os/sbi/sidebar-items.js b/ch5/os/sbi/sidebar-items.js index 025cc5ad..df8a1503 100644 --- a/ch5/os/sbi/sidebar-items.js +++ b/ch5/os/sbi/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["SBI_CLEAR_IPI",""],["SBI_CONSOLE_GETCHAR",""],["SBI_CONSOLE_PUTCHAR",""],["SBI_REMOTE_FENCE_I",""],["SBI_REMOTE_SFENCE_VMA",""],["SBI_REMOTE_SFENCE_VMA_ASID",""],["SBI_SEND_IPI",""],["SBI_SET_TIMER",""],["SBI_SHUTDOWN",""]],"fn":[["console_getchar",""],["console_putchar",""],["sbi_call",""],["set_timer",""],["shutdown",""]]}); \ No newline at end of file +initSidebarItems({"constant":[["SBI_CLEAR_IPI",""],["SBI_CONSOLE_GETCHAR",""],["SBI_CONSOLE_PUTCHAR",""],["SBI_REMOTE_FENCE_I",""],["SBI_REMOTE_SFENCE_VMA",""],["SBI_REMOTE_SFENCE_VMA_ASID",""],["SBI_SEND_IPI",""],["SBI_SET_TIMER",""],["SBI_SHUTDOWN",""]],"fn":[["console_getchar","use sbi call to getchar from console (qemu uart handler)"],["console_putchar","use sbi call to putchar in console (qemu uart handler)"],["sbi_call","general sbi call"],["set_timer","use sbi call to set timer"],["shutdown","use sbi call to shutdown the kernel"]]}); \ No newline at end of file diff --git a/ch5/os/sidebar-items.js b/ch5/os/sidebar-items.js index bf6c5eff..4666d920 100644 --- a/ch5/os/sidebar-items.js +++ b/ch5/os/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["clear_bss",""],["rust_main",""]],"macro":[["print",""],["println",""]],"mod":[["board",""],["config",""],["console",""],["lang_items",""],["loader",""],["mm",""],["sbi",""],["sync",""],["syscall",""],["task",""],["timer",""],["trap",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["clear_bss","clear BSS segment"],["rust_main","the rust entry-point of os"]],"macro":[["print","print string macro"],["println","println string macro"]],"mod":[["board",""],["config","Constants used in rCore"],["console","SBI console driver, for text output"],["lang_items","The panic handler"],["loader","Loading user applications into memory"],["mm","Memory management implementation"],["sbi","SBI call wrappers"],["sync","Synchronization and interior mutability primitives"],["syscall","Implementation of syscalls"],["task","Task management implementation"],["timer","RISC-V timer-related functionality"],["trap","Trap handling functionality"]]}); \ No newline at end of file diff --git a/ch5/os/sync/index.html b/ch5/os/sync/index.html index 7728caec..6119d98c 100644 --- a/ch5/os/sync/index.html +++ b/ch5/os/sync/index.html @@ -1,10 +1,14 @@ -os::sync - Rust +os::sync - Rust
-

Module os::sync

source · []

Re-exports

-
pub use up::UPSafeCell;

Modules

-
up 🔒
+

Module sync

+

Module os::sync

source · []
Expand description

Synchronization and interior mutability primitives

+

Modules

+
up 🔒

Uniprocessor interior mutability primitives

+

Structs

+

Wrap a static data structure inside it so that we are +able to access it without any unsafe.

+
\ No newline at end of file diff --git a/ch5/os/sync/sidebar-items.js b/ch5/os/sync/sidebar-items.js index 440fc425..a310b54a 100644 --- a/ch5/os/sync/sidebar-items.js +++ b/ch5/os/sync/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"mod":[["up",""]]}); \ No newline at end of file +initSidebarItems({"mod":[["up","Uniprocessor interior mutability primitives"]],"struct":[["UPSafeCell","Wrap a static data structure inside it so that we are able to access it without any `unsafe`."]]}); \ No newline at end of file diff --git a/ch5/os/sync/struct.UPSafeCell.html b/ch5/os/sync/struct.UPSafeCell.html new file mode 100644 index 00000000..9163b002 --- /dev/null +++ b/ch5/os/sync/struct.UPSafeCell.html @@ -0,0 +1,30 @@ +UPSafeCell in os::sync - Rust + +
+

Struct os::sync::UPSafeCell

source · []
pub struct UPSafeCell<T> {
+    inner: RefCell<T>,
+}
Expand description

Wrap a static data structure inside it so that we are +able to access it without any unsafe.

+

We should only use it in uniprocessor.

+

In order to get mutable reference of inner data, call +exclusive_access.

+

Fields

inner: RefCell<T>

inner data

+

Implementations

User is responsible to guarantee that inner struct is only used in +uniprocessor.

+

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/sync/up/index.html b/ch5/os/sync/up/index.html index 9f55b3ef..db7fed21 100644 --- a/ch5/os/sync/up/index.html +++ b/ch5/os/sync/up/index.html @@ -1,10 +1,11 @@ -os::sync::up - Rust +os::sync::up - Rust
-

Module os::sync::up

source · []

Structs

+

Module os::sync::up

source · []
Expand description

Uniprocessor interior mutability primitives

+

Structs

Wrap a static data structure inside it so that we are able to access it without any unsafe.

diff --git a/ch5/os/sync/up/struct.UPSafeCell.html b/ch5/os/sync/up/struct.UPSafeCell.html index c8e804ed..52784de0 100644 --- a/ch5/os/sync/up/struct.UPSafeCell.html +++ b/ch5/os/sync/up/struct.UPSafeCell.html @@ -4,7 +4,7 @@
-

Struct os::sync::up::UPSafeCell

source · []
pub struct UPSafeCell<T> {
+    

Struct os::sync::up::UPSafeCell

source · []
pub struct UPSafeCell<T> {
     inner: RefCell<T>,
 }
Expand description

Wrap a static data structure inside it so that we are able to access it without any unsafe.

@@ -12,10 +12,10 @@ able to access it without any unsafe.

In order to get mutable reference of inner data, call exclusive_access.

Fields

inner: RefCell<T>

inner data

-

Implementations

User is responsible to guarantee that inner struct is only used in +

Implementations

User is responsible to guarantee that inner struct is only used in uniprocessor.

-

Panic if the data has been borrowed.

-

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

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/syscall/constant.SYSCALL_EXEC.html b/ch5/os/syscall/constant.SYSCALL_EXEC.html index f72dc503..bf860d98 100644 --- a/ch5/os/syscall/constant.SYSCALL_EXEC.html +++ b/ch5/os/syscall/constant.SYSCALL_EXEC.html @@ -4,5 +4,5 @@
const SYSCALL_EXEC: usize = 221;
+

Constant os::syscall::SYSCALL_EXEC

source · []
const SYSCALL_EXEC: usize = 221;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_EXIT.html b/ch5/os/syscall/constant.SYSCALL_EXIT.html index 679ff529..e46f4bcc 100644 --- a/ch5/os/syscall/constant.SYSCALL_EXIT.html +++ b/ch5/os/syscall/constant.SYSCALL_EXIT.html @@ -4,5 +4,5 @@
const SYSCALL_EXIT: usize = 93;
+

Constant os::syscall::SYSCALL_EXIT

source · []
const SYSCALL_EXIT: usize = 93;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_FORK.html b/ch5/os/syscall/constant.SYSCALL_FORK.html index 1af4a6b1..3f419c91 100644 --- a/ch5/os/syscall/constant.SYSCALL_FORK.html +++ b/ch5/os/syscall/constant.SYSCALL_FORK.html @@ -4,5 +4,5 @@
const SYSCALL_FORK: usize = 220;
+

Constant os::syscall::SYSCALL_FORK

source · []
const SYSCALL_FORK: usize = 220;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_GETPID.html b/ch5/os/syscall/constant.SYSCALL_GETPID.html index da57cb63..b3eb4b7f 100644 --- a/ch5/os/syscall/constant.SYSCALL_GETPID.html +++ b/ch5/os/syscall/constant.SYSCALL_GETPID.html @@ -4,5 +4,5 @@
const SYSCALL_GETPID: usize = 172;
+

Constant os::syscall::SYSCALL_GETPID

source · []
const SYSCALL_GETPID: usize = 172;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_GET_TIME.html b/ch5/os/syscall/constant.SYSCALL_GET_TIME.html index dde97827..3930aa98 100644 --- a/ch5/os/syscall/constant.SYSCALL_GET_TIME.html +++ b/ch5/os/syscall/constant.SYSCALL_GET_TIME.html @@ -4,5 +4,5 @@
const SYSCALL_GET_TIME: usize = 169;
+

Constant os::syscall::SYSCALL_GET_TIME

source · []
const SYSCALL_GET_TIME: usize = 169;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_READ.html b/ch5/os/syscall/constant.SYSCALL_READ.html index 47f90fdf..49b2d140 100644 --- a/ch5/os/syscall/constant.SYSCALL_READ.html +++ b/ch5/os/syscall/constant.SYSCALL_READ.html @@ -4,5 +4,5 @@
const SYSCALL_READ: usize = 63;
+

Constant os::syscall::SYSCALL_READ

source · []
const SYSCALL_READ: usize = 63;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_WAITPID.html b/ch5/os/syscall/constant.SYSCALL_WAITPID.html index 6e5bbc4f..d7e74f52 100644 --- a/ch5/os/syscall/constant.SYSCALL_WAITPID.html +++ b/ch5/os/syscall/constant.SYSCALL_WAITPID.html @@ -4,5 +4,5 @@
const SYSCALL_WAITPID: usize = 260;
+

Constant os::syscall::SYSCALL_WAITPID

source · []
const SYSCALL_WAITPID: usize = 260;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_WRITE.html b/ch5/os/syscall/constant.SYSCALL_WRITE.html index 4f0b757d..b7777110 100644 --- a/ch5/os/syscall/constant.SYSCALL_WRITE.html +++ b/ch5/os/syscall/constant.SYSCALL_WRITE.html @@ -4,5 +4,5 @@
const SYSCALL_WRITE: usize = 64;
+

Constant os::syscall::SYSCALL_WRITE

source · []
const SYSCALL_WRITE: usize = 64;
\ No newline at end of file diff --git a/ch5/os/syscall/constant.SYSCALL_YIELD.html b/ch5/os/syscall/constant.SYSCALL_YIELD.html index 395a7497..a976cfa6 100644 --- a/ch5/os/syscall/constant.SYSCALL_YIELD.html +++ b/ch5/os/syscall/constant.SYSCALL_YIELD.html @@ -4,5 +4,5 @@
const SYSCALL_YIELD: usize = 124;
+

Constant os::syscall::SYSCALL_YIELD

source · []
const SYSCALL_YIELD: usize = 124;
\ No newline at end of file diff --git a/ch5/os/syscall/fn.syscall.html b/ch5/os/syscall/fn.syscall.html index 59638bdf..0868f64b 100644 --- a/ch5/os/syscall/fn.syscall.html +++ b/ch5/os/syscall/fn.syscall.html @@ -1,8 +1,9 @@ -syscall in os::syscall - Rust +syscall in os::syscall - Rust
-

Function os::syscall::syscall

source · []
pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize
+

Function os::syscall::syscall

source · []
pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize
Expand description

handle syscall exception with syscall_id and other arguments

+
\ No newline at end of file diff --git a/ch5/os/syscall/fs/constant.FD_STDIN.html b/ch5/os/syscall/fs/constant.FD_STDIN.html index 6e4c3202..301c3760 100644 --- a/ch5/os/syscall/fs/constant.FD_STDIN.html +++ b/ch5/os/syscall/fs/constant.FD_STDIN.html @@ -4,5 +4,5 @@
-

Constant os::syscall::fs::FD_STDIN

source · []
const FD_STDIN: usize = 0;
+

Constant os::syscall::fs::FD_STDIN

source · []
const FD_STDIN: usize = 0;
\ No newline at end of file diff --git a/ch5/os/syscall/fs/constant.FD_STDOUT.html b/ch5/os/syscall/fs/constant.FD_STDOUT.html index 6e494fa8..ef144e9f 100644 --- a/ch5/os/syscall/fs/constant.FD_STDOUT.html +++ b/ch5/os/syscall/fs/constant.FD_STDOUT.html @@ -4,5 +4,5 @@
-

Constant os::syscall::fs::FD_STDOUT

source · []
const FD_STDOUT: usize = 1;
+

Constant os::syscall::fs::FD_STDOUT

source · []
const FD_STDOUT: usize = 1;
\ No newline at end of file diff --git a/ch5/os/syscall/fs/fn.sys_read.html b/ch5/os/syscall/fs/fn.sys_read.html index 3cab4c90..232c47da 100644 --- a/ch5/os/syscall/fs/fn.sys_read.html +++ b/ch5/os/syscall/fs/fn.sys_read.html @@ -4,5 +4,5 @@
-

Function os::syscall::fs::sys_read

source · []
pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize
+

Function os::syscall::fs::sys_read

source · []
pub fn sys_read(fd: usize, buf: *const u8, len: usize) -> isize
\ No newline at end of file diff --git a/ch5/os/syscall/fs/fn.sys_write.html b/ch5/os/syscall/fs/fn.sys_write.html index 54e5b8e8..c1c9d6b5 100644 --- a/ch5/os/syscall/fs/fn.sys_write.html +++ b/ch5/os/syscall/fs/fn.sys_write.html @@ -4,5 +4,5 @@
-

Function os::syscall::fs::sys_write

source · []
pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize
+

Function os::syscall::fs::sys_write

source · []
pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize
\ No newline at end of file diff --git a/ch5/os/syscall/fs/index.html b/ch5/os/syscall/fs/index.html index 05257b5a..8311bf4b 100644 --- a/ch5/os/syscall/fs/index.html +++ b/ch5/os/syscall/fs/index.html @@ -1,10 +1,11 @@ -os::syscall::fs - Rust +os::syscall::fs - Rust
-

Module os::syscall::fs

source · []

Constants

+

Module os::syscall::fs

source · []
Expand description

File and filesystem-related syscalls

+

Constants

FD_STDIN 🔒
FD_STDOUT 🔒

Functions

\ No newline at end of file diff --git a/ch5/os/syscall/index.html b/ch5/os/syscall/index.html index 2bbe01b8..e03706ff 100644 --- a/ch5/os/syscall/index.html +++ b/ch5/os/syscall/index.html @@ -1,11 +1,22 @@ -os::syscall - Rust +os::syscall - Rust
-

Module os::syscall

source · []

Modules

-
fs 🔒
process 🔒

Constants

+

Module os::syscall

source · []
Expand description

Implementation of syscalls

+

The single entry point to all system calls, syscall(), is called +whenever userspace wishes to perform a system call using the ecall +instruction. In this case, the processor raises an ‘Environment call from +U-mode’ exception, which is handled as one of the cases in +crate::trap::trap_handler.

+

For clarity, each single syscall is implemented as its own function, named +sys_ then the name of the syscall. You can find functions like this in +submodules, and you should also implement syscalls this way.

+

Modules

+
fs 🔒

File and filesystem-related syscalls

+
process 🔒

Constants

Functions

-
+

handle syscall exception with syscall_id and other arguments

+
\ No newline at end of file diff --git a/ch5/os/syscall/sidebar-items.js b/ch5/os/syscall/sidebar-items.js index 9061f396..9eecf0c0 100644 --- a/ch5/os/syscall/sidebar-items.js +++ b/ch5/os/syscall/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["SYSCALL_EXEC",""],["SYSCALL_EXIT",""],["SYSCALL_FORK",""],["SYSCALL_GETPID",""],["SYSCALL_GET_TIME",""],["SYSCALL_READ",""],["SYSCALL_WAITPID",""],["SYSCALL_WRITE",""],["SYSCALL_YIELD",""]],"fn":[["syscall",""]],"mod":[["fs",""],["process",""]]}); \ No newline at end of file +initSidebarItems({"constant":[["SYSCALL_EXEC",""],["SYSCALL_EXIT",""],["SYSCALL_FORK",""],["SYSCALL_GETPID",""],["SYSCALL_GET_TIME",""],["SYSCALL_READ",""],["SYSCALL_WAITPID",""],["SYSCALL_WRITE",""],["SYSCALL_YIELD",""]],"fn":[["syscall","handle syscall exception with `syscall_id` and other arguments"]],"mod":[["fs","File and filesystem-related syscalls"],["process",""]]}); \ No newline at end of file diff --git a/ch5/os/task/context/index.html b/ch5/os/task/context/index.html index 74b2c655..209177cd 100644 --- a/ch5/os/task/context/index.html +++ b/ch5/os/task/context/index.html @@ -1,9 +1,11 @@ -os::task::context - Rust +os::task::context - Rust
+

Module os::task::context

source · []
Expand description

Implementation of TaskContext

+

Structs

+

task context structure containing some registers

+
\ No newline at end of file diff --git a/ch5/os/task/context/sidebar-items.js b/ch5/os/task/context/sidebar-items.js index 86a68385..c68c1891 100644 --- a/ch5/os/task/context/sidebar-items.js +++ b/ch5/os/task/context/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["TaskContext",""]]}); \ No newline at end of file +initSidebarItems({"struct":[["TaskContext","task context structure containing some registers"]]}); \ No newline at end of file diff --git a/ch5/os/task/context/struct.TaskContext.html b/ch5/os/task/context/struct.TaskContext.html index 76dd0a3a..f596bb56 100644 --- a/ch5/os/task/context/struct.TaskContext.html +++ b/ch5/os/task/context/struct.TaskContext.html @@ -1,14 +1,20 @@ -TaskContext in os::task::context - Rust +TaskContext in os::task::context - Rust
#[repr(C)]
pub struct TaskContext { +

Struct os::task::context::TaskContext

source · []
#[repr(C)]
pub struct TaskContext { ra: usize, sp: usize, s: [usize; 12], -}

Fields

ra: usizesp: usizes: [usize; 12]

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

task context structure containing some registers

+

Fields

ra: usize

return address ( e.g. __restore ) of __switch ASM function

+
sp: usize

kernel stack pointer of app

+
s: [usize; 12]

s0-11 register, callee saved

+

Implementations

init task context

+

set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

+

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/task/fn.add_initproc.html b/ch5/os/task/fn.add_initproc.html index d62c66b4..ff479874 100644 --- a/ch5/os/task/fn.add_initproc.html +++ b/ch5/os/task/fn.add_initproc.html @@ -1,8 +1,9 @@ -add_initproc in os::task - Rust +add_initproc in os::task - Rust
-

Function os::task::add_initproc

source · []
pub fn add_initproc()
+

Function os::task::add_initproc

source · []
pub fn add_initproc()
Expand description

Add init process to the manager

+
\ No newline at end of file diff --git a/ch5/os/task/fn.add_task.html b/ch5/os/task/fn.add_task.html new file mode 100644 index 00000000..f9e1b627 --- /dev/null +++ b/ch5/os/task/fn.add_task.html @@ -0,0 +1,9 @@ +add_task in os::task - Rust + +
+

Function os::task::add_task

source · []
pub fn add_task(task: Arc<TaskControlBlock>)
Expand description

Interface offered to add task

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.current_task.html b/ch5/os/task/fn.current_task.html new file mode 100644 index 00000000..08c15734 --- /dev/null +++ b/ch5/os/task/fn.current_task.html @@ -0,0 +1,9 @@ +current_task in os::task - Rust + +
+

Function os::task::current_task

source · []
pub fn current_task() -> Option<Arc<TaskControlBlock>>
Expand description

Get running task

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.current_trap_cx.html b/ch5/os/task/fn.current_trap_cx.html new file mode 100644 index 00000000..3a49b090 --- /dev/null +++ b/ch5/os/task/fn.current_trap_cx.html @@ -0,0 +1,9 @@ +current_trap_cx in os::task - Rust + +
pub fn current_trap_cx() -> &'static mut TrapContext
Expand description

Get the mutable reference to trap context of current task

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.current_user_token.html b/ch5/os/task/fn.current_user_token.html new file mode 100644 index 00000000..18e6e449 --- /dev/null +++ b/ch5/os/task/fn.current_user_token.html @@ -0,0 +1,9 @@ +current_user_token in os::task - Rust + +
pub fn current_user_token() -> usize
Expand description

Get token of the address space of current task

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.exit_current_and_run_next.html b/ch5/os/task/fn.exit_current_and_run_next.html index 421c7007..7b70fe59 100644 --- a/ch5/os/task/fn.exit_current_and_run_next.html +++ b/ch5/os/task/fn.exit_current_and_run_next.html @@ -1,8 +1,9 @@ -exit_current_and_run_next in os::task - Rust +exit_current_and_run_next in os::task - Rust
pub fn exit_current_and_run_next(exit_code: i32)
+

Function os::task::exit_current_and_run_next

source · []
pub fn exit_current_and_run_next(exit_code: i32)
Expand description

Exit the current ‘Running’ task and run the next task in task list.

+
\ No newline at end of file diff --git a/ch5/os/task/fn.fetch_task.html b/ch5/os/task/fn.fetch_task.html new file mode 100644 index 00000000..6e62c16f --- /dev/null +++ b/ch5/os/task/fn.fetch_task.html @@ -0,0 +1,9 @@ +fetch_task in os::task - Rust + +
+

Function os::task::fetch_task

source · []
pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
Expand description

Interface offered to pop the first task

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.pid_alloc.html b/ch5/os/task/fn.pid_alloc.html new file mode 100644 index 00000000..435d7577 --- /dev/null +++ b/ch5/os/task/fn.pid_alloc.html @@ -0,0 +1,9 @@ +pid_alloc in os::task - Rust + +
+

Function os::task::pid_alloc

source · []
pub fn pid_alloc() -> PidHandle
Expand description

Allocate a pid from PID_ALLOCATOR

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.run_tasks.html b/ch5/os/task/fn.run_tasks.html new file mode 100644 index 00000000..0f2a2d6c --- /dev/null +++ b/ch5/os/task/fn.run_tasks.html @@ -0,0 +1,10 @@ +run_tasks in os::task - Rust + +
+

Function os::task::run_tasks

source · []
pub fn run_tasks()
Expand description

The main part of process execution and scheduling +Loop fetch_task to get the process that needs to run, and switch the process through __switch

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.schedule.html b/ch5/os/task/fn.schedule.html new file mode 100644 index 00000000..6f39f65b --- /dev/null +++ b/ch5/os/task/fn.schedule.html @@ -0,0 +1,9 @@ +schedule in os::task - Rust + +
+

Function os::task::schedule

source · []
pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
Expand description

Return to idle control flow for new scheduling

+
+ \ No newline at end of file diff --git a/ch5/os/task/fn.suspend_current_and_run_next.html b/ch5/os/task/fn.suspend_current_and_run_next.html index cb4d0eff..98438c32 100644 --- a/ch5/os/task/fn.suspend_current_and_run_next.html +++ b/ch5/os/task/fn.suspend_current_and_run_next.html @@ -1,8 +1,9 @@ -suspend_current_and_run_next in os::task - Rust +suspend_current_and_run_next in os::task - Rust
pub fn suspend_current_and_run_next()
+

Function os::task::suspend_current_and_run_next

source · []
pub fn suspend_current_and_run_next()
Expand description

Suspend the current ‘Running’ task and run the next task in task list.

+
\ No newline at end of file diff --git a/ch5/os/task/fn.take_current_task.html b/ch5/os/task/fn.take_current_task.html new file mode 100644 index 00000000..0219d701 --- /dev/null +++ b/ch5/os/task/fn.take_current_task.html @@ -0,0 +1,9 @@ +take_current_task in os::task - Rust + +
pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
Expand description

Take the current task,leaving a None in its place

+
+ \ No newline at end of file diff --git a/ch5/os/task/index.html b/ch5/os/task/index.html index 6a955a39..a263fb31 100644 --- a/ch5/os/task/index.html +++ b/ch5/os/task/index.html @@ -1,12 +1,48 @@ -os::task - Rust +os::task - Rust
-

Module os::task

source · []

Re-exports

-
pub use context::TaskContext;
pub use manager::add_task;
pub use pid::pid_alloc;
pub use pid::KernelStack;
pub use pid::PidHandle;
pub use processor::current_task;
pub use processor::current_trap_cx;
pub use processor::current_user_token;
pub use processor::run_tasks;
pub use processor::schedule;
pub use processor::take_current_task;

Modules

-
context 🔒
manager 🔒
pid 🔒
processor 🔒
switch 🔒
task 🔒

Structs

-

Functions

-
+

Module os::task

source · []
Expand description

Task management implementation

+

Everything about task management, like starting and switching tasks is +implemented here.

+

A single global instance of TaskManager called TASK_MANAGER controls +all the tasks in the whole operating system.

+

A single global instance of Processor called PROCESSOR monitors running +task(s) for each core.

+

A single global instance of PidAllocator called PID_ALLOCATOR allocates +pid for user apps.

+

Be careful when you see __switch ASM function in switch.S. Control flow around this function +might not be what you expect.

+

Modules

+
context 🔒

Implementation of TaskContext

+
manager 🔒

Implementation of TaskManager

+
pid 🔒

Implementation of PidAllocator

+
processor 🔒

Implementation of Processor and Intersection of control flow

+
switch 🔒

Wrap switch.S as a function

+
task 🔒

Implementation of TaskControlBlock

+

Structs

+

Globle process that init user shell

+

Kernelstack for app

+

Pid Allocator struct

+

Bind pid lifetime to PidHandle

+

Processor management structure

+

task context structure containing some registers

+

A array of TaskControlBlock that is thread-safe

+

Functions

+

Add init process to the manager

+

Interface offered to add task

+

Get running task

+

Get the mutable reference to trap context of current task

+

Get token of the address space of current task

+

Exit the current ‘Running’ task and run the next task in task list.

+

Interface offered to pop the first task

+

Allocate a pid from PID_ALLOCATOR

+

The main part of process execution and scheduling +Loop fetch_task to get the process that needs to run, and switch the process through __switch

+

Return to idle control flow for new scheduling

+

Suspend the current ‘Running’ task and run the next task in task list.

+

Take the current task,leaving a None in its place

+
\ No newline at end of file diff --git a/ch5/os/task/manager/fn.add_task.html b/ch5/os/task/manager/fn.add_task.html index ca3e2057..cf550e9a 100644 --- a/ch5/os/task/manager/fn.add_task.html +++ b/ch5/os/task/manager/fn.add_task.html @@ -1,8 +1,9 @@ -add_task in os::task::manager - Rust +add_task in os::task::manager - Rust
-

Function os::task::manager::add_task

source · []
pub fn add_task(task: Arc<TaskControlBlock>)
+

Function os::task::manager::add_task

source · []
pub fn add_task(task: Arc<TaskControlBlock>)
Expand description

Interface offered to add task

+
\ No newline at end of file diff --git a/ch5/os/task/manager/fn.fetch_task.html b/ch5/os/task/manager/fn.fetch_task.html index 4ad84f26..ae80d78b 100644 --- a/ch5/os/task/manager/fn.fetch_task.html +++ b/ch5/os/task/manager/fn.fetch_task.html @@ -1,8 +1,9 @@ -fetch_task in os::task::manager - Rust +fetch_task in os::task::manager - Rust
pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
+

Function os::task::manager::fetch_task

source · []
pub fn fetch_task() -> Option<Arc<TaskControlBlock>>
Expand description

Interface offered to pop the first task

+
\ No newline at end of file diff --git a/ch5/os/task/manager/index.html b/ch5/os/task/manager/index.html index fc2f22e1..ef4a8063 100644 --- a/ch5/os/task/manager/index.html +++ b/ch5/os/task/manager/index.html @@ -1,10 +1,14 @@ -os::task::manager - Rust +os::task::manager - Rust
+

Module os::task::manager

source · []
Expand description

Implementation of TaskManager

+

Structs

+

A array of TaskControlBlock that is thread-safe

+

Functions

+

Interface offered to add task

+

Interface offered to pop the first task

+
\ No newline at end of file diff --git a/ch5/os/task/manager/sidebar-items.js b/ch5/os/task/manager/sidebar-items.js index 6318bf61..66fe2851 100644 --- a/ch5/os/task/manager/sidebar-items.js +++ b/ch5/os/task/manager/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["add_task",""],["fetch_task",""]],"struct":[["TASK_MANAGER",""],["TaskManager",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["add_task","Interface offered to add task"],["fetch_task","Interface offered to pop the first task"]],"struct":[["TASK_MANAGER",""],["TaskManager","A array of `TaskControlBlock` that is thread-safe"]]}); \ No newline at end of file diff --git a/ch5/os/task/manager/struct.TASK_MANAGER.html b/ch5/os/task/manager/struct.TASK_MANAGER.html index bffc4f98..f6b2ea71 100644 --- a/ch5/os/task/manager/struct.TASK_MANAGER.html +++ b/ch5/os/task/manager/struct.TASK_MANAGER.html @@ -4,12 +4,12 @@
pub struct TASK_MANAGER {
+    

Struct os::task::manager::TASK_MANAGER

source · []
pub struct TASK_MANAGER {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<TaskManager>>

Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<TaskManager>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/task/manager/struct.TaskManager.html b/ch5/os/task/manager/struct.TaskManager.html index 78cc2788..be9d8d65 100644 --- a/ch5/os/task/manager/struct.TaskManager.html +++ b/ch5/os/task/manager/struct.TaskManager.html @@ -1,13 +1,17 @@ -TaskManager in os::task::manager - Rust +TaskManager in os::task::manager - Rust
pub struct TaskManager {
+    

Struct os::task::manager::TaskManager

source · []
pub struct TaskManager {
     ready_queue: VecDeque<Arc<TaskControlBlock>>,
-}

Fields

ready_queue: VecDeque<Arc<TaskControlBlock>>

Implementations

A simple FIFO scheduler.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

A array of TaskControlBlock that is thread-safe

+

Fields

ready_queue: VecDeque<Arc<TaskControlBlock>>

Implementations

A simple FIFO scheduler.

+

Creat an empty TaskManager

+

Add a task to TaskManager

+

Remove the first task and return it,or None if TaskManager is empty

+

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/task/pid/fn.kernel_stack_position.html b/ch5/os/task/pid/fn.kernel_stack_position.html index b376fb97..1d753eb5 100644 --- a/ch5/os/task/pid/fn.kernel_stack_position.html +++ b/ch5/os/task/pid/fn.kernel_stack_position.html @@ -4,6 +4,6 @@
pub fn kernel_stack_position(app_id: usize) -> (usize, usize)
Expand description

Return (bottom, top) of a kernel stack in kernel space.

+

Function os::task::pid::kernel_stack_position

source · []
pub fn kernel_stack_position(app_id: usize) -> (usize, usize)
Expand description

Return (bottom, top) of a kernel stack in kernel space.

\ No newline at end of file diff --git a/ch5/os/task/pid/fn.pid_alloc.html b/ch5/os/task/pid/fn.pid_alloc.html index 62d78ef5..609c8046 100644 --- a/ch5/os/task/pid/fn.pid_alloc.html +++ b/ch5/os/task/pid/fn.pid_alloc.html @@ -1,8 +1,9 @@ -pid_alloc in os::task::pid - Rust +pid_alloc in os::task::pid - Rust
-

Function os::task::pid::pid_alloc

source · []
pub fn pid_alloc() -> PidHandle
+

Function os::task::pid::pid_alloc

source · []
pub fn pid_alloc() -> PidHandle
Expand description

Allocate a pid from PID_ALLOCATOR

+
\ No newline at end of file diff --git a/ch5/os/task/pid/index.html b/ch5/os/task/pid/index.html index 8d0caf50..6c018555 100644 --- a/ch5/os/task/pid/index.html +++ b/ch5/os/task/pid/index.html @@ -1,11 +1,16 @@ -os::task::pid - Rust +os::task::pid - Rust
Expand description

Implementation of PidAllocator

+

Structs

+

Kernelstack for app

+

Pid Allocator struct

+

Bind pid lifetime to PidHandle

+

Functions

Return (bottom, top) of a kernel stack in kernel space.

-
+

Allocate a pid from PID_ALLOCATOR

+
\ No newline at end of file diff --git a/ch5/os/task/pid/sidebar-items.js b/ch5/os/task/pid/sidebar-items.js index f95fd8fa..35d3f887 100644 --- a/ch5/os/task/pid/sidebar-items.js +++ b/ch5/os/task/pid/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["kernel_stack_position","Return (bottom, top) of a kernel stack in kernel space."],["pid_alloc",""]],"struct":[["KernelStack",""],["PID_ALLOCATOR",""],["PidAllocator",""],["PidHandle",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["kernel_stack_position","Return (bottom, top) of a kernel stack in kernel space."],["pid_alloc","Allocate a pid from PID_ALLOCATOR"]],"struct":[["KernelStack","Kernelstack for app "],["PID_ALLOCATOR",""],["PidAllocator","Pid Allocator struct"],["PidHandle","Bind pid lifetime to `PidHandle`"]]}); \ No newline at end of file diff --git a/ch5/os/task/pid/struct.KernelStack.html b/ch5/os/task/pid/struct.KernelStack.html index b52aa17d..550e4c8b 100644 --- a/ch5/os/task/pid/struct.KernelStack.html +++ b/ch5/os/task/pid/struct.KernelStack.html @@ -1,12 +1,16 @@ -KernelStack in os::task::pid - Rust +KernelStack in os::task::pid - Rust
pub struct KernelStack {
+    

Struct os::task::pid::KernelStack

source · []
pub struct KernelStack {
     pid: usize,
-}

Fields

pid: usize

Implementations

Trait Implementations

Executes the destructor for this type. Read more

+}
Expand description

Kernelstack for app

+

Fields

pid: usize

Implementations

Create a kernelstack from pid

+

Push a value on top of kernelstack

+

Get the value on the top of kernelstack

+

Trait Implementations

Executes the destructor for this type. 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

diff --git a/ch5/os/task/pid/struct.PID_ALLOCATOR.html b/ch5/os/task/pid/struct.PID_ALLOCATOR.html index 992d2ff1..450533db 100644 --- a/ch5/os/task/pid/struct.PID_ALLOCATOR.html +++ b/ch5/os/task/pid/struct.PID_ALLOCATOR.html @@ -4,12 +4,12 @@
struct PID_ALLOCATOR {
+    

Struct os::task::pid::PID_ALLOCATOR

source · []
pub struct PID_ALLOCATOR {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<PidAllocator>>

Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<PidAllocator>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/task/pid/struct.PidAllocator.html b/ch5/os/task/pid/struct.PidAllocator.html index 29906633..60033447 100644 --- a/ch5/os/task/pid/struct.PidAllocator.html +++ b/ch5/os/task/pid/struct.PidAllocator.html @@ -1,13 +1,17 @@ -PidAllocator in os::task::pid - Rust +PidAllocator in os::task::pid - Rust
struct PidAllocator {
+    

Struct os::task::pid::PidAllocator

source · []
pub struct PidAllocator {
     current: usize,
     recycled: Vec<usize>,
-}

Fields

current: usizerecycled: Vec<usize>

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

Pid Allocator struct

+

Fields

current: usizerecycled: Vec<usize>

Implementations

Create an empty PidAllocator

+

Allocate a pid

+

Recycle a pid

+

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/task/pid/struct.PidHandle.html b/ch5/os/task/pid/struct.PidHandle.html index ec8f976f..2440db00 100644 --- a/ch5/os/task/pid/struct.PidHandle.html +++ b/ch5/os/task/pid/struct.PidHandle.html @@ -1,10 +1,11 @@ -PidHandle in os::task::pid - Rust +PidHandle in os::task::pid - Rust
-

Struct os::task::pid::PidHandle

source · []
pub struct PidHandle(pub usize);

Tuple Fields

0: usize

Trait Implementations

Executes the destructor for this type. Read more

+

Struct os::task::pid::PidHandle

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

Bind pid lifetime to PidHandle

+

Tuple Fields

0: usize

Trait Implementations

Executes the destructor for this type. 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

diff --git a/ch5/os/task/processor/fn.current_task.html b/ch5/os/task/processor/fn.current_task.html index 4d215a57..0735123c 100644 --- a/ch5/os/task/processor/fn.current_task.html +++ b/ch5/os/task/processor/fn.current_task.html @@ -1,8 +1,9 @@ -current_task in os::task::processor - Rust +current_task in os::task::processor - Rust
pub fn current_task() -> Option<Arc<TaskControlBlock>>
+

Function os::task::processor::current_task

source · []
pub fn current_task() -> Option<Arc<TaskControlBlock>>
Expand description

Get running task

+
\ No newline at end of file diff --git a/ch5/os/task/processor/fn.current_trap_cx.html b/ch5/os/task/processor/fn.current_trap_cx.html index 9154b64a..5cafec54 100644 --- a/ch5/os/task/processor/fn.current_trap_cx.html +++ b/ch5/os/task/processor/fn.current_trap_cx.html @@ -1,8 +1,9 @@ -current_trap_cx in os::task::processor - Rust +current_trap_cx in os::task::processor - Rust
pub fn current_trap_cx() -> &'static mut TrapContext
+

Function os::task::processor::current_trap_cx

source · []
pub fn current_trap_cx() -> &'static mut TrapContext
Expand description

Get the mutable reference to trap context of current task

+
\ No newline at end of file diff --git a/ch5/os/task/processor/fn.current_user_token.html b/ch5/os/task/processor/fn.current_user_token.html index c759936a..1223abb4 100644 --- a/ch5/os/task/processor/fn.current_user_token.html +++ b/ch5/os/task/processor/fn.current_user_token.html @@ -1,8 +1,9 @@ -current_user_token in os::task::processor - Rust +current_user_token in os::task::processor - Rust
pub fn current_user_token() -> usize
+

Function os::task::processor::current_user_token

source · []
pub fn current_user_token() -> usize
Expand description

Get token of the address space of current task

+
\ No newline at end of file diff --git a/ch5/os/task/processor/fn.run_tasks.html b/ch5/os/task/processor/fn.run_tasks.html index e94dce0a..2016e34f 100644 --- a/ch5/os/task/processor/fn.run_tasks.html +++ b/ch5/os/task/processor/fn.run_tasks.html @@ -1,8 +1,10 @@ -run_tasks in os::task::processor - Rust +run_tasks in os::task::processor - Rust
pub fn run_tasks()
+

Function os::task::processor::run_tasks

source · []
pub fn run_tasks()
Expand description

The main part of process execution and scheduling +Loop fetch_task to get the process that needs to run, and switch the process through __switch

+
\ No newline at end of file diff --git a/ch5/os/task/processor/fn.schedule.html b/ch5/os/task/processor/fn.schedule.html index 35900ba3..00df90ea 100644 --- a/ch5/os/task/processor/fn.schedule.html +++ b/ch5/os/task/processor/fn.schedule.html @@ -1,8 +1,9 @@ -schedule in os::task::processor - Rust +schedule in os::task::processor - Rust
pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
+

Function os::task::processor::schedule

source · []
pub fn schedule(switched_task_cx_ptr: *mut TaskContext)
Expand description

Return to idle control flow for new scheduling

+
\ No newline at end of file diff --git a/ch5/os/task/processor/fn.take_current_task.html b/ch5/os/task/processor/fn.take_current_task.html index 9ee54b69..5041f930 100644 --- a/ch5/os/task/processor/fn.take_current_task.html +++ b/ch5/os/task/processor/fn.take_current_task.html @@ -1,8 +1,9 @@ -take_current_task in os::task::processor - Rust +take_current_task in os::task::processor - Rust
pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
+

Function os::task::processor::take_current_task

source · []
pub fn take_current_task() -> Option<Arc<TaskControlBlock>>
Expand description

Take the current task,leaving a None in its place

+
\ No newline at end of file diff --git a/ch5/os/task/processor/index.html b/ch5/os/task/processor/index.html index d99a8270..e3a83114 100644 --- a/ch5/os/task/processor/index.html +++ b/ch5/os/task/processor/index.html @@ -1,10 +1,19 @@ -os::task::processor - Rust +os::task::processor - Rust
+

Module os::task::processor

source · []
Expand description

Implementation of Processor and Intersection of control flow

+

Structs

+

Processor management structure

+

Functions

+

Get running task

+

Get the mutable reference to trap context of current task

+

Get token of the address space of current task

+

The main part of process execution and scheduling +Loop fetch_task to get the process that needs to run, and switch the process through __switch

+

Return to idle control flow for new scheduling

+

Take the current task,leaving a None in its place

+
\ No newline at end of file diff --git a/ch5/os/task/processor/sidebar-items.js b/ch5/os/task/processor/sidebar-items.js index 00277c5b..1ffd68de 100644 --- a/ch5/os/task/processor/sidebar-items.js +++ b/ch5/os/task/processor/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["current_task",""],["current_trap_cx",""],["current_user_token",""],["run_tasks",""],["schedule",""],["take_current_task",""]],"struct":[["PROCESSOR",""],["Processor",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["current_task","Get running task"],["current_trap_cx","Get the mutable reference to trap context of current task"],["current_user_token","Get token of the address space of current task"],["run_tasks","The main part of process execution and scheduling Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`"],["schedule","Return to idle control flow for new scheduling"],["take_current_task","Take the current task,leaving a None in its place"]],"struct":[["PROCESSOR",""],["Processor","Processor management structure"]]}); \ No newline at end of file diff --git a/ch5/os/task/processor/struct.PROCESSOR.html b/ch5/os/task/processor/struct.PROCESSOR.html index 0c4a9675..bd114840 100644 --- a/ch5/os/task/processor/struct.PROCESSOR.html +++ b/ch5/os/task/processor/struct.PROCESSOR.html @@ -4,12 +4,12 @@
pub struct PROCESSOR {
+    

Struct os::task::processor::PROCESSOR

source · []
pub struct PROCESSOR {
     __private_field: (),
-}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<Processor>>

Panic if the data has been borrowed.

-

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

__private_field: ()

Methods from Deref<Target = UPSafeCell<Processor>>

Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.

+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/task/processor/struct.Processor.html b/ch5/os/task/processor/struct.Processor.html index 48ca87af..7b7da15f 100644 --- a/ch5/os/task/processor/struct.Processor.html +++ b/ch5/os/task/processor/struct.Processor.html @@ -1,13 +1,20 @@ -Processor in os::task::processor - Rust +Processor in os::task::processor - Rust
pub struct Processor {
+    

Struct os::task::processor::Processor

source · []
pub struct Processor {
     current: Option<Arc<TaskControlBlock>>,
     idle_task_cx: TaskContext,
-}

Fields

current: Option<Arc<TaskControlBlock>>idle_task_cx: TaskContext

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

Processor management structure

+

Fields

current: Option<Arc<TaskControlBlock>>

The task currently executing on the current processor

+
idle_task_cx: TaskContext

The basic control flow of each core, helping to select and switch process

+

Implementations

Create an empty Processor

+

Get mutable reference to idle_task_cx

+

Get current task in moving semanteme

+

Get current task in cloning semanteme

+

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/task/sidebar-items.js b/ch5/os/task/sidebar-items.js index 1de546c2..1e550871 100644 --- a/ch5/os/task/sidebar-items.js +++ b/ch5/os/task/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["add_initproc",""],["exit_current_and_run_next",""],["suspend_current_and_run_next",""]],"mod":[["context",""],["manager",""],["pid",""],["processor",""],["switch",""],["task",""]],"struct":[["INITPROC",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["add_initproc","Add init process to the manager"],["add_task","Interface offered to add task"],["current_task","Get running task"],["current_trap_cx","Get the mutable reference to trap context of current task"],["current_user_token","Get token of the address space of current task"],["exit_current_and_run_next","Exit the current ‘Running’ task and run the next task in task list."],["fetch_task","Interface offered to pop the first task"],["pid_alloc","Allocate a pid from PID_ALLOCATOR"],["run_tasks","The main part of process execution and scheduling Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`"],["schedule","Return to idle control flow for new scheduling"],["suspend_current_and_run_next","Suspend the current ‘Running’ task and run the next task in task list."],["take_current_task","Take the current task,leaving a None in its place"]],"mod":[["context","Implementation of [`TaskContext`]"],["manager","Implementation of [`TaskManager`]"],["pid","Implementation of [`PidAllocator`]"],["processor","Implementation of [`Processor`] and Intersection of control flow"],["switch","Wrap `switch.S` as a function"],["task","Implementation of [`TaskControlBlock`] "]],"struct":[["INITPROC","Globle process that init user shell "],["KernelStack","Kernelstack for app "],["PidAllocator","Pid Allocator struct"],["PidHandle","Bind pid lifetime to `PidHandle`"],["Processor","Processor management structure"],["TaskContext","task context structure containing some registers"],["TaskManager","A array of `TaskControlBlock` that is thread-safe"]]}); \ No newline at end of file diff --git a/ch5/os/task/struct.INITPROC.html b/ch5/os/task/struct.INITPROC.html index 56bc8395..548729f4 100644 --- a/ch5/os/task/struct.INITPROC.html +++ b/ch5/os/task/struct.INITPROC.html @@ -1,14 +1,15 @@ -INITPROC in os::task - Rust +INITPROC in os::task - Rust
-

Struct os::task::INITPROC

source · []
pub struct INITPROC {
+    

Struct os::task::INITPROC

source · []
pub struct INITPROC {
     __private_field: (),
-}

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

-

Dereferences the value.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

Globle process that init user shell

+

Fields

__private_field: ()

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

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/task/struct.KernelStack.html b/ch5/os/task/struct.KernelStack.html new file mode 100644 index 00000000..1cb9a3f3 --- /dev/null +++ b/ch5/os/task/struct.KernelStack.html @@ -0,0 +1,26 @@ +KernelStack in os::task - Rust + +
pub struct KernelStack {
+    pid: usize,
+}
Expand description

Kernelstack for app

+

Fields

pid: usize

Implementations

Create a kernelstack from pid

+

Push a value on top of kernelstack

+

Get the value on the top of kernelstack

+

Trait Implementations

Executes the destructor for this type. 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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/struct.PidAllocator.html b/ch5/os/task/struct.PidAllocator.html new file mode 100644 index 00000000..98512e49 --- /dev/null +++ b/ch5/os/task/struct.PidAllocator.html @@ -0,0 +1,26 @@ +PidAllocator in os::task - Rust + +
pub struct PidAllocator {
+    current: usize,
+    recycled: Vec<usize>,
+}
Expand description

Pid Allocator struct

+

Fields

current: usizerecycled: Vec<usize>

Implementations

Create an empty PidAllocator

+

Allocate a pid

+

Recycle a pid

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/struct.PidHandle.html b/ch5/os/task/struct.PidHandle.html new file mode 100644 index 00000000..1433284b --- /dev/null +++ b/ch5/os/task/struct.PidHandle.html @@ -0,0 +1,21 @@ +PidHandle in os::task - Rust + +
+

Struct os::task::PidHandle

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

Bind pid lifetime to PidHandle

+

Tuple Fields

0: usize

Trait Implementations

Executes the destructor for this type. 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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/struct.Processor.html b/ch5/os/task/struct.Processor.html new file mode 100644 index 00000000..9abb91cb --- /dev/null +++ b/ch5/os/task/struct.Processor.html @@ -0,0 +1,29 @@ +Processor in os::task - Rust + +
+

Struct os::task::Processor

source · []
pub struct Processor {
+    current: Option<Arc<TaskControlBlock>>,
+    idle_task_cx: TaskContext,
+}
Expand description

Processor management structure

+

Fields

current: Option<Arc<TaskControlBlock>>

The task currently executing on the current processor

+
idle_task_cx: TaskContext

The basic control flow of each core, helping to select and switch process

+

Implementations

Create an empty Processor

+

Get mutable reference to idle_task_cx

+

Get current task in moving semanteme

+

Get current task in cloning semanteme

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/struct.TaskContext.html b/ch5/os/task/struct.TaskContext.html new file mode 100644 index 00000000..ae64a01c --- /dev/null +++ b/ch5/os/task/struct.TaskContext.html @@ -0,0 +1,29 @@ +TaskContext in os::task - Rust + +
#[repr(C)]
pub struct TaskContext { + ra: usize, + sp: usize, + s: [usize; 12], +}
Expand description

task context structure containing some registers

+

Fields

ra: usize

return address ( e.g. __restore ) of __switch ASM function

+
sp: usize

kernel stack pointer of app

+
s: [usize; 12]

s0-11 register, callee saved

+

Implementations

init task context

+

set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/struct.TaskManager.html b/ch5/os/task/struct.TaskManager.html new file mode 100644 index 00000000..1628852a --- /dev/null +++ b/ch5/os/task/struct.TaskManager.html @@ -0,0 +1,26 @@ +TaskManager in os::task - Rust + +
pub struct TaskManager {
+    ready_queue: VecDeque<Arc<TaskControlBlock>>,
+}
Expand description

A array of TaskControlBlock that is thread-safe

+

Fields

ready_queue: VecDeque<Arc<TaskControlBlock>>

Implementations

A simple FIFO scheduler.

+

Creat an empty TaskManager

+

Add a task to TaskManager

+

Remove the first task and return it,or None if TaskManager is empty

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/os/task/switch/fn.__switch.html b/ch5/os/task/switch/fn.__switch.html index 71540423..b609d6fc 100644 --- a/ch5/os/task/switch/fn.__switch.html +++ b/ch5/os/task/switch/fn.__switch.html @@ -4,5 +4,5 @@
-

Function os::task::switch::__switch

source · []
pub unsafe extern "C" fn __switch(
    current_task_cx_ptr: *mut TaskContext,
    next_task_cx_ptr: *const TaskContext
)
+

Function os::task::switch::__switch

source · []
pub unsafe extern "C" fn __switch(
    current_task_cx_ptr: *mut TaskContext,
    next_task_cx_ptr: *const TaskContext
)
\ No newline at end of file diff --git a/ch5/os/task/switch/index.html b/ch5/os/task/switch/index.html index 108eea14..2a16118b 100644 --- a/ch5/os/task/switch/index.html +++ b/ch5/os/task/switch/index.html @@ -1,9 +1,10 @@ -os::task::switch - Rust +os::task::switch - Rust
-

Module os::task::switch

source · []

Functions

+

Module os::task::switch

source · []
Expand description

Wrap switch.S as a function

+

Functions

\ No newline at end of file diff --git a/ch5/os/task/task/enum.TaskStatus.html b/ch5/os/task/task/enum.TaskStatus.html index fa126cf5..8295756d 100644 --- a/ch5/os/task/task/enum.TaskStatus.html +++ b/ch5/os/task/task/enum.TaskStatus.html @@ -4,16 +4,16 @@
pub enum TaskStatus {
+    

Enum os::task::task::TaskStatus

source · []
pub enum TaskStatus {
     Ready,
     Running,
     Zombie,
-}

Variants

Ready

Running

Zombie

Trait Implementations

Returns a copy of the value. Read more

+}

Variants

Ready

Running

Zombie

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used +

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

-

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/task/task/index.html b/ch5/os/task/task/index.html index f5a8b2ef..cfac60be 100644 --- a/ch5/os/task/task/index.html +++ b/ch5/os/task/task/index.html @@ -1,10 +1,11 @@ -os::task::task - Rust +os::task::task - Rust
-

Module os::task::task

source · []

Structs

+

Module os::task::task

source · []
Expand description

Implementation of TaskControlBlock

+

Structs

Enums

\ No newline at end of file diff --git a/ch5/os/task/task/struct.TaskControlBlock.html b/ch5/os/task/task/struct.TaskControlBlock.html index d1aa7363..032e71cc 100644 --- a/ch5/os/task/task/struct.TaskControlBlock.html +++ b/ch5/os/task/task/struct.TaskControlBlock.html @@ -4,11 +4,11 @@
pub struct TaskControlBlock {
+    

Struct os::task::task::TaskControlBlock

source · []
pub struct TaskControlBlock {
     pub pid: PidHandle,
     pub kernel_stack: KernelStack,
     inner: UPSafeCell<TaskControlBlockInner>,
-}

Fields

pid: PidHandlekernel_stack: KernelStackinner: UPSafeCell<TaskControlBlockInner>

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

pid: PidHandlekernel_stack: KernelStackinner: UPSafeCell<TaskControlBlockInner>

Implementations

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/task/task/struct.TaskControlBlockInner.html b/ch5/os/task/task/struct.TaskControlBlockInner.html index 3a55b911..a50aec4e 100644 --- a/ch5/os/task/task/struct.TaskControlBlockInner.html +++ b/ch5/os/task/task/struct.TaskControlBlockInner.html @@ -4,7 +4,7 @@
pub struct TaskControlBlockInner {
+    

Struct os::task::task::TaskControlBlockInner

source · []
pub struct TaskControlBlockInner {
     pub trap_cx_ppn: PhysPageNum,
     pub base_size: usize,
     pub task_cx: TaskContext,
@@ -13,7 +13,7 @@
     pub parent: Option<Weak<TaskControlBlock>>,
     pub children: Vec<Arc<TaskControlBlock>>,
     pub exit_code: i32,
-}

Fields

trap_cx_ppn: PhysPageNumbase_size: usizetask_cx: TaskContexttask_status: TaskStatusmemory_set: MemorySetparent: Option<Weak<TaskControlBlock>>children: Vec<Arc<TaskControlBlock>>exit_code: i32

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}

Fields

trap_cx_ppn: PhysPageNumbase_size: usizetask_cx: TaskContexttask_status: TaskStatusmemory_set: MemorySetparent: Option<Weak<TaskControlBlock>>children: Vec<Arc<TaskControlBlock>>exit_code: i32

Implementations

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/timer/constant.MSEC_PER_SEC.html b/ch5/os/timer/constant.MSEC_PER_SEC.html index a7764fdb..a69b66ba 100644 --- a/ch5/os/timer/constant.MSEC_PER_SEC.html +++ b/ch5/os/timer/constant.MSEC_PER_SEC.html @@ -4,5 +4,5 @@
-

Constant os::timer::MSEC_PER_SEC

source · []
const MSEC_PER_SEC: usize = 1000;
+

Constant os::timer::MSEC_PER_SEC

source · []
const MSEC_PER_SEC: usize = 1000;
\ No newline at end of file diff --git a/ch5/os/timer/constant.TICKS_PER_SEC.html b/ch5/os/timer/constant.TICKS_PER_SEC.html index 6fc1e532..f53b3940 100644 --- a/ch5/os/timer/constant.TICKS_PER_SEC.html +++ b/ch5/os/timer/constant.TICKS_PER_SEC.html @@ -4,5 +4,5 @@
const TICKS_PER_SEC: usize = 100;
+

Constant os::timer::TICKS_PER_SEC

source · []
const TICKS_PER_SEC: usize = 100;
\ No newline at end of file diff --git a/ch5/os/timer/fn.get_time.html b/ch5/os/timer/fn.get_time.html index 1aca5ac7..7feeb248 100644 --- a/ch5/os/timer/fn.get_time.html +++ b/ch5/os/timer/fn.get_time.html @@ -1,8 +1,9 @@ -get_time in os::timer - Rust +get_time in os::timer - Rust
-

Function os::timer::get_time

source · []
pub fn get_time() -> usize
+

Function os::timer::get_time

source · []
pub fn get_time() -> usize
Expand description

get current time

+
\ No newline at end of file diff --git a/ch5/os/timer/fn.get_time_ms.html b/ch5/os/timer/fn.get_time_ms.html index bb616663..d438c352 100644 --- a/ch5/os/timer/fn.get_time_ms.html +++ b/ch5/os/timer/fn.get_time_ms.html @@ -1,8 +1,9 @@ -get_time_ms in os::timer - Rust +get_time_ms in os::timer - Rust
-

Function os::timer::get_time_ms

source · []
pub fn get_time_ms() -> usize
+

Function os::timer::get_time_ms

source · []
pub fn get_time_ms() -> usize
Expand description

get current time in microseconds

+
\ No newline at end of file diff --git a/ch5/os/timer/fn.set_next_trigger.html b/ch5/os/timer/fn.set_next_trigger.html index 9fc42cec..9ee10e78 100644 --- a/ch5/os/timer/fn.set_next_trigger.html +++ b/ch5/os/timer/fn.set_next_trigger.html @@ -1,8 +1,9 @@ -set_next_trigger in os::timer - Rust +set_next_trigger in os::timer - Rust
pub fn set_next_trigger()
+

Function os::timer::set_next_trigger

source · []
pub fn set_next_trigger()
Expand description

set the next timer interrupt

+
\ No newline at end of file diff --git a/ch5/os/timer/index.html b/ch5/os/timer/index.html index f57fb966..f2d6cb9a 100644 --- a/ch5/os/timer/index.html +++ b/ch5/os/timer/index.html @@ -1,10 +1,14 @@ -os::timer - Rust +os::timer - Rust
-

Module os::timer

source · []

Constants

+

Module os::timer

source · []
Expand description

RISC-V timer-related functionality

+

Constants

Functions

-
+

get current time

+

get current time in microseconds

+

set the next timer interrupt

+
\ No newline at end of file diff --git a/ch5/os/timer/sidebar-items.js b/ch5/os/timer/sidebar-items.js index afc78589..cc248a10 100644 --- a/ch5/os/timer/sidebar-items.js +++ b/ch5/os/timer/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["MSEC_PER_SEC",""],["TICKS_PER_SEC",""]],"fn":[["get_time",""],["get_time_ms",""],["set_next_trigger",""]]}); \ No newline at end of file +initSidebarItems({"constant":[["MSEC_PER_SEC",""],["TICKS_PER_SEC",""]],"fn":[["get_time","get current time"],["get_time_ms","get current time in microseconds"],["set_next_trigger","set the next timer interrupt"]]}); \ No newline at end of file diff --git a/ch5/os/trap/context/index.html b/ch5/os/trap/context/index.html index 13f27840..d2e47c65 100644 --- a/ch5/os/trap/context/index.html +++ b/ch5/os/trap/context/index.html @@ -1,9 +1,11 @@ -os::trap::context - Rust +os::trap::context - Rust
+

Module os::trap::context

source · []
Expand description

Implementation of TrapContext

+

Structs

+

trap context structure containing sstatus, sepc and registers

+
\ No newline at end of file diff --git a/ch5/os/trap/context/sidebar-items.js b/ch5/os/trap/context/sidebar-items.js index d7c5bfe2..3f97d83e 100644 --- a/ch5/os/trap/context/sidebar-items.js +++ b/ch5/os/trap/context/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["TrapContext",""]]}); \ No newline at end of file +initSidebarItems({"struct":[["TrapContext","trap context structure containing sstatus, sepc and registers"]]}); \ No newline at end of file diff --git a/ch5/os/trap/context/struct.TrapContext.html b/ch5/os/trap/context/struct.TrapContext.html index 2d623688..cb7aaea7 100644 --- a/ch5/os/trap/context/struct.TrapContext.html +++ b/ch5/os/trap/context/struct.TrapContext.html @@ -1,17 +1,26 @@ -TrapContext in os::trap::context - Rust +TrapContext in os::trap::context - Rust
#[repr(C)]
pub struct TrapContext { +

Struct os::trap::context::TrapContext

source · []
#[repr(C)]
pub struct TrapContext { pub x: [usize; 32], pub sstatus: Sstatus, pub sepc: usize, pub kernel_satp: usize, pub kernel_sp: usize, pub trap_handler: usize, -}

Fields

x: [usize; 32]sstatus: Sstatussepc: usizekernel_satp: usizekernel_sp: usizetrap_handler: usize

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+}
Expand description

trap context structure containing sstatus, sepc and registers

+

Fields

x: [usize; 32]

general regs[0..31]

+
sstatus: Sstatus

CSR sstatus

+
sepc: usize

CSR sepc

+
kernel_satp: usize

Addr of Page Table

+
kernel_sp: usize

kernel stack

+
trap_handler: usize

Addr of trap_handler function

+

Implementations

set stack pointer to x_2 reg (sp)

+

init app context

+

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/trap/fn.enable_timer_interrupt.html b/ch5/os/trap/fn.enable_timer_interrupt.html index 91988237..c6f514af 100644 --- a/ch5/os/trap/fn.enable_timer_interrupt.html +++ b/ch5/os/trap/fn.enable_timer_interrupt.html @@ -1,8 +1,9 @@ -enable_timer_interrupt in os::trap - Rust +enable_timer_interrupt in os::trap - Rust
pub fn enable_timer_interrupt()
+

Function os::trap::enable_timer_interrupt

source · []
pub fn enable_timer_interrupt()
Expand description

enable timer interrupt in sie CSR

+
\ No newline at end of file diff --git a/ch5/os/trap/fn.init.html b/ch5/os/trap/fn.init.html index b5318088..d2f3ef65 100644 --- a/ch5/os/trap/fn.init.html +++ b/ch5/os/trap/fn.init.html @@ -1,8 +1,9 @@ -init in os::trap - Rust +init in os::trap - Rust
-

Function os::trap::init

source · []
pub fn init()
+

Function os::trap::init

source · []
pub fn init()
Expand description

initialize CSR stvec as the entry of __alltraps

+
\ No newline at end of file diff --git a/ch5/os/trap/fn.set_kernel_trap_entry.html b/ch5/os/trap/fn.set_kernel_trap_entry.html index 4d69dfa0..59e9cdad 100644 --- a/ch5/os/trap/fn.set_kernel_trap_entry.html +++ b/ch5/os/trap/fn.set_kernel_trap_entry.html @@ -4,5 +4,5 @@
fn set_kernel_trap_entry()
+

Function os::trap::set_kernel_trap_entry

source · []
fn set_kernel_trap_entry()
\ No newline at end of file diff --git a/ch5/os/trap/fn.set_user_trap_entry.html b/ch5/os/trap/fn.set_user_trap_entry.html index 77612a14..792b4705 100644 --- a/ch5/os/trap/fn.set_user_trap_entry.html +++ b/ch5/os/trap/fn.set_user_trap_entry.html @@ -4,5 +4,5 @@
fn set_user_trap_entry()
+

Function os::trap::set_user_trap_entry

source · []
fn set_user_trap_entry()
\ No newline at end of file diff --git a/ch5/os/trap/fn.trap_from_kernel.html b/ch5/os/trap/fn.trap_from_kernel.html index 6611b3fa..1eca88fd 100644 --- a/ch5/os/trap/fn.trap_from_kernel.html +++ b/ch5/os/trap/fn.trap_from_kernel.html @@ -1,9 +1,11 @@ -trap_from_kernel in os::trap - Rust +trap_from_kernel in os::trap - Rust
#[no_mangle]
-pub fn trap_from_kernel() -> !
+

Function os::trap::trap_from_kernel

source · []
#[no_mangle]
+pub fn trap_from_kernel() -> !
Expand description

Unimplement: traps/interrupts/exceptions from kernel mode +Todo: Chapter 9: I/O device

+
\ No newline at end of file diff --git a/ch5/os/trap/fn.trap_handler.html b/ch5/os/trap/fn.trap_handler.html index dcf830c5..cefb79cd 100644 --- a/ch5/os/trap/fn.trap_handler.html +++ b/ch5/os/trap/fn.trap_handler.html @@ -1,9 +1,10 @@ -trap_handler in os::trap - Rust +trap_handler in os::trap - Rust
-

Function os::trap::trap_handler

source · []
#[no_mangle]
-pub fn trap_handler() -> !
+

Function os::trap::trap_handler

source · []
#[no_mangle]
+pub fn trap_handler() -> !
Expand description

handle an interrupt, exception, or system call from user space

+
\ No newline at end of file diff --git a/ch5/os/trap/fn.trap_return.html b/ch5/os/trap/fn.trap_return.html index 6be329ca..4024da30 100644 --- a/ch5/os/trap/fn.trap_return.html +++ b/ch5/os/trap/fn.trap_return.html @@ -1,9 +1,12 @@ -trap_return in os::trap - Rust +trap_return in os::trap - Rust
-

Function os::trap::trap_return

source · []
#[no_mangle]
-pub fn trap_return() -> !
+

Function os::trap::trap_return

source · []
#[no_mangle]
+pub fn trap_return() -> !
Expand description

set the new addr of __restore asm function in TRAMPOLINE page, +set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, +finally, jump to new addr of __restore asm function

+
\ No newline at end of file diff --git a/ch5/os/trap/index.html b/ch5/os/trap/index.html index e269820d..ab86142e 100644 --- a/ch5/os/trap/index.html +++ b/ch5/os/trap/index.html @@ -1,11 +1,31 @@ -os::trap - Rust +os::trap - Rust
+

Module trap

+

Module os::trap

source · []
Expand description

Trap handling functionality

+

For rCore, we have a single trap entry point, namely __alltraps. At +initialization in init(), we set the stvec CSR to point to it.

+

All traps go through __alltraps, which is defined in trap.S. The +assembly language code does just enough work restore the kernel space +context, ensuring that Rust code safely runs, and transfers control to +trap_handler().

+

It then calls different functionality based on what exactly the exception +was. For example, timer interrupts trigger task preemption, and syscalls go +to syscall().

+

Modules

+
context 🔒

Implementation of TrapContext

+

Structs

+

trap context structure containing sstatus, sepc and registers

+

Functions

+

enable timer interrupt in sie CSR

+

initialize CSR stvec as the entry of __alltraps

+

Unimplement: traps/interrupts/exceptions from kernel mode +Todo: Chapter 9: I/O device

+

handle an interrupt, exception, or system call from user space

+

set the new addr of __restore asm function in TRAMPOLINE page, +set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, +finally, jump to new addr of __restore asm function

+
\ No newline at end of file diff --git a/ch5/os/trap/sidebar-items.js b/ch5/os/trap/sidebar-items.js index b976c179..92b38b41 100644 --- a/ch5/os/trap/sidebar-items.js +++ b/ch5/os/trap/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["enable_timer_interrupt",""],["init",""],["set_kernel_trap_entry",""],["set_user_trap_entry",""],["trap_from_kernel",""],["trap_handler",""],["trap_return",""]],"mod":[["context",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["enable_timer_interrupt","enable timer interrupt in sie CSR"],["init","initialize CSR `stvec` as the entry of `__alltraps`"],["set_kernel_trap_entry",""],["set_user_trap_entry",""],["trap_from_kernel","Unimplement: traps/interrupts/exceptions from kernel mode Todo: Chapter 9: I/O device "],["trap_handler","handle an interrupt, exception, or system call from user space"],["trap_return","set the new addr of __restore asm function in TRAMPOLINE page, set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table, finally, jump to new addr of __restore asm function "]],"mod":[["context","Implementation of [`TrapContext`]"]],"struct":[["TrapContext","trap context structure containing sstatus, sepc and registers"]]}); \ No newline at end of file diff --git a/ch5/os/trap/struct.TrapContext.html b/ch5/os/trap/struct.TrapContext.html new file mode 100644 index 00000000..5432c68f --- /dev/null +++ b/ch5/os/trap/struct.TrapContext.html @@ -0,0 +1,35 @@ +TrapContext in os::trap - Rust + +
#[repr(C)]
pub struct TrapContext { + pub x: [usize; 32], + pub sstatus: Sstatus, + pub sepc: usize, + pub kernel_satp: usize, + pub kernel_sp: usize, + pub trap_handler: usize, +}
Expand description

trap context structure containing sstatus, sepc and registers

+

Fields

x: [usize; 32]

general regs[0..31]

+
sstatus: Sstatus

CSR sstatus

+
sepc: usize

CSR sepc

+
kernel_satp: usize

Addr of Page Table

+
kernel_sp: usize

kernel stack

+
trap_handler: usize

Addr of trap_handler function

+

Implementations

set stack pointer to x_2 reg (sp)

+

init app context

+

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.

+

Calls U::from(self).

+

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

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/ch5/search-index.js b/ch5/search-index.js index 2682b628..f6bab414 100644 --- a/ch5/search-index.js +++ b/ch5/search-index.js @@ -1,4 +1,4 @@ var searchIndex = JSON.parse('{\ -"os":{"doc":"","t":[0,5,0,0,0,0,0,14,14,5,0,0,0,0,0,0,17,17,17,17,17,17,17,17,17,3,11,11,11,11,5,11,11,11,11,5,3,12,11,11,11,11,5,5,5,11,5,11,11,11,0,0,0,5,0,0,12,12,12,12,17,17,3,3,3,3,8,17,6,17,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,12,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,8,6,3,3,12,10,11,11,11,11,11,11,11,12,10,11,11,11,12,11,5,5,5,11,11,11,11,5,11,11,11,10,11,11,12,12,11,11,11,11,11,11,11,11,11,7,7,5,5,5,13,13,3,3,3,4,3,18,18,18,18,12,11,11,12,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,5,5,5,11,11,11,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,12,11,11,11,5,11,11,5,5,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,18,18,18,3,3,3,18,18,18,18,18,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,17,17,17,17,17,17,17,17,17,5,5,5,5,5,0,3,11,11,11,11,12,11,11,11,11,11,17,17,17,17,17,17,17,17,17,0,0,5,17,17,5,5,5,5,5,5,5,5,5,3,12,5,11,11,0,11,5,11,11,0,0,0,5,0,0,11,11,11,3,11,11,11,11,11,12,12,12,11,11,11,11,3,3,12,11,5,11,11,11,11,11,11,5,11,11,11,11,11,12,11,11,11,11,11,11,12,3,3,3,3,12,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,12,5,11,12,11,11,11,11,11,11,11,11,11,11,11,11,3,3,12,11,11,11,11,11,12,5,5,5,11,11,11,11,12,11,11,11,5,5,11,5,11,11,11,11,11,11,5,13,13,3,3,4,13,12,11,11,11,11,11,11,12,11,11,11,11,12,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,12,11,12,12,12,12,11,12,11,11,11,11,11,11,11,11,11,17,17,5,5,5,0,5,5,5,5,5,5,5,3,11,11,11,11,11,12,12,12,11,12,12,11,11,11,12],"n":["board","clear_bss","config","console","lang_items","loader","mm","print","println","rust_main","sbi","sync","syscall","task","timer","trap","CLOCK_FREQ","MEMORY_END","KERNEL_HEAP_SIZE","KERNEL_STACK_SIZE","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE","Stdout","borrow","borrow_mut","from","into","print","try_from","try_into","type_id","write_str","panic","APP_NAMES","__private_field","borrow","borrow_mut","deref","from","get_app_data","get_app_data_by_name","get_num_app","into","list_apps","try_from","try_into","type_id","address","frame_allocator","heap_allocator","init","memory_set","page_table","0","0","0","0","PA_WIDTH_SV39","PPN_WIDTH_SV39","PhysAddr","PhysPageNum","SimpleRange","SimpleRangeIterator","StepByOne","VA_WIDTH_SV39","VPNRange","VPN_WIDTH_SV39","VirtAddr","VirtPageNum","aligned","aligned","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","ceil","ceil","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","cmp","current","end","eq","eq","eq","eq","floor","floor","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","get_bytes_array","get_end","get_mut","get_mut","get_pte_array","get_start","indexes","into","into","into","into","into","into","into_iter","into_iter","l","ne","ne","ne","ne","new","new","next","page_offset","page_offset","partial_cmp","partial_cmp","partial_cmp","partial_cmp","r","step","step","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","FRAME_ALLOCATOR","FrameAllocator","FrameAllocatorImpl","FrameTracker","StackFrameAllocator","__private_field","alloc","alloc","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","current","dealloc","dealloc","deref","drop","end","fmt","frame_alloc","frame_allocator_test","frame_dealloc","from","from","from","init","init_frame_allocator","into","into","into","new","new","new","ppn","recycled","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","HEAP_ALLOCATOR","HEAP_SPACE","handle_alloc_error","heap_test","init_heap","Framed","Identical","KERNEL_SPACE","MapArea","MapPermission","MapType","MemorySet","R","U","W","X","__private_field","activate","all","areas","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","copy_data","data_frames","deref","difference","ebss","edata","ekernel","empty","eq","eq","erodata","etext","extend","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_another","from_bits","from_bits_truncate","from_bits_unchecked","from_elf","from_existed_user","from_iter","hash","insert","insert_framed_area","intersection","intersects","into","into","into","into","into","is_all","is_empty","map","map_one","map_perm","map_trampoline","map_type","ne","new","new_bare","new_kernel","not","page_table","partial_cmp","push","recycle_data_pages","remap_test","remove","remove_area_with_start_vpn","sbss_with_stack","sdata","set","srodata","stext","strampoline","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","unmap_one","vpn_range","A","D","G","PTEFlags","PageTable","PageTableEntry","R","U","V","W","X","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","difference","empty","empty","eq","executable","extend","find_pte","find_pte_create","flags","fmt","fmt","fmt","fmt","fmt","frames","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","from_token","hash","insert","intersection","intersects","into","into","into","is_all","is_empty","is_valid","map","ne","new","new","not","partial_cmp","ppn","readable","remove","root_ppn","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","translate_va","translated_byte_buffer","translated_refmut","translated_str","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","union","unmap","writable","SBI_CLEAR_IPI","SBI_CONSOLE_GETCHAR","SBI_CONSOLE_PUTCHAR","SBI_REMOTE_FENCE_I","SBI_REMOTE_SFENCE_VMA","SBI_REMOTE_SFENCE_VMA_ASID","SBI_SEND_IPI","SBI_SET_TIMER","SBI_SHUTDOWN","console_getchar","console_putchar","sbi_call","set_timer","shutdown","up","UPSafeCell","borrow","borrow_mut","exclusive_access","from","inner","into","new","try_from","try_into","type_id","SYSCALL_EXEC","SYSCALL_EXIT","SYSCALL_FORK","SYSCALL_GETPID","SYSCALL_GET_TIME","SYSCALL_READ","SYSCALL_WAITPID","SYSCALL_WRITE","SYSCALL_YIELD","fs","process","syscall","FD_STDIN","FD_STDOUT","sys_read","sys_write","sys_exec","sys_exit","sys_fork","sys_get_time","sys_getpid","sys_waitpid","sys_yield","INITPROC","__private_field","add_initproc","borrow","borrow_mut","context","deref","exit_current_and_run_next","from","into","manager","pid","processor","suspend_current_and_run_next","switch","task","try_from","try_into","type_id","TaskContext","borrow","borrow_mut","from","goto_trap_return","into","ra","s","sp","try_from","try_into","type_id","zero_init","TASK_MANAGER","TaskManager","__private_field","add","add_task","borrow","borrow","borrow_mut","borrow_mut","deref","fetch","fetch_task","from","from","into","into","new","ready_queue","try_from","try_from","try_into","try_into","type_id","type_id","0","KernelStack","PID_ALLOCATOR","PidAllocator","PidHandle","__private_field","alloc","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","current","dealloc","deref","drop","drop","from","from","from","from","get_top","into","into","into","into","kernel_stack_position","new","new","pid","pid_alloc","push_on_top","recycled","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","PROCESSOR","Processor","__private_field","borrow","borrow","borrow_mut","borrow_mut","current","current","current_task","current_trap_cx","current_user_token","deref","from","from","get_idle_task_cx_ptr","idle_task_cx","into","into","new","run_tasks","schedule","take_current","take_current_task","try_from","try_from","try_into","try_into","type_id","type_id","__switch","Ready","Running","TaskControlBlock","TaskControlBlockInner","TaskStatus","Zombie","base_size","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","children","clone","clone_into","eq","exec","exit_code","fork","from","from","from","get_status","get_trap_cx","get_user_token","getpid","inner","inner_exclusive_access","into","into","into","is_zombie","kernel_stack","memory_set","new","parent","pid","task_cx","task_status","to_owned","trap_cx_ppn","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","MSEC_PER_SEC","TICKS_PER_SEC","get_time","get_time_ms","set_next_trigger","context","enable_timer_interrupt","init","set_kernel_trap_entry","set_user_trap_entry","trap_from_kernel","trap_handler","trap_return","TrapContext","app_init_context","borrow","borrow_mut","from","into","kernel_satp","kernel_sp","sepc","set_sp","sstatus","trap_handler","try_from","try_into","type_id","x"],"q":["os","","","","","","","","","","","","","","","","os::board","","os::config","","","","","","","os::console","","","","","","","","","","os::lang_items","os::loader","","","","","","","","","","","","","","os::mm","","","","","","os::mm::address","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::frame_allocator","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::heap_allocator","","","","","os::mm::memory_set","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::page_table","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::sbi","","","","","","","","","","","","","","os::sync","os::sync::up","","","","","","","","","","","os::syscall","","","","","","","","","","","","os::syscall::fs","","","","os::syscall::process","","","","","","","os::task","","","","","","","","","","","","","","","","","","","os::task::context","","","","","","","","","","","","","os::task::manager","","","","","","","","","","","","","","","","","","","","","","","","os::task::pid","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::processor","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::switch","os::task::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::timer","","","","","os::trap","","","","","","","","os::trap::context","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","","","","","","","","","Definitions","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the set containing all flags.","","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","data: start-aligned but maybe with shorter length assume …","","","Returns the difference between the flags in self and other.","","","","Returns an empty set of flags.","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","Include sections in elf and trampoline and TrapContext and …","","","","Inserts the specified flags in-place.","Assume that no conflicts.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","","","","Mention that trampoline is not collected by areas.","","","","","Without kernel stacks.","Returns the complement of this set of flags.","","","","","","Removes the specified flags in-place.","","","","Inserts or removes the specified flags depending on the …","","","","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","","","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","","","","","","","","","","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","Returns the difference between the flags in self and other.","Returns an empty set of flags.","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","Temporarily used to get arguments from user space.","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","","","","","","Returns the complement of this set of flags.","","","","Removes the specified flags in-place.","","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","","","","","","","","","","","","","","Wrap a static data structure inside it so that we are able …","","","Panic if the data has been borrowed.","Returns the argument unchanged.","inner data","Calls U::from(self).","User is responsible to guarantee that inner struct is only …","","","","","","","","","","","","","","","","","","","","","","","","","If there is not a child process whose pid is same as …","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","Returns the argument unchanged.","","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Return (bottom, top) of a kernel stack in kernel space.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,2,2,2,2,2,0,0,0,2,0,2,2,2,0,0,0,0,0,0,3,4,5,6,0,0,0,0,0,0,0,0,0,0,0,0,3,4,7,3,4,5,6,8,7,3,4,5,6,8,3,4,3,4,5,6,8,3,4,5,6,8,3,4,5,6,7,7,3,4,5,6,3,4,3,4,5,6,7,3,3,3,4,4,4,5,5,5,6,6,6,8,5,8,3,5,5,8,6,7,3,4,5,6,8,7,8,8,3,4,5,6,7,8,7,3,4,3,4,5,6,8,9,6,3,4,5,6,8,7,3,4,5,6,8,7,3,4,5,6,8,7,3,4,5,6,8,0,0,0,0,0,10,11,12,13,12,10,13,12,10,12,11,12,10,13,12,13,0,0,0,13,12,10,12,0,13,12,10,11,13,12,13,12,13,12,10,13,12,10,13,12,10,0,0,0,0,0,14,14,0,0,0,0,0,15,15,15,15,16,17,15,17,15,15,15,15,15,15,15,15,17,18,16,14,15,17,18,16,14,15,14,15,14,15,15,15,15,18,18,16,15,0,0,0,15,14,15,0,0,15,14,15,15,15,15,15,17,18,16,14,15,18,15,15,15,17,17,15,15,15,17,15,15,17,18,16,14,15,15,15,18,18,18,17,18,15,18,17,17,15,17,15,17,17,0,15,17,0,0,15,0,0,0,15,15,15,14,15,15,17,17,17,18,16,14,15,17,18,16,14,15,17,18,16,14,15,15,18,18,18,19,19,19,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,20,19,19,21,19,20,21,19,20,19,20,19,20,19,19,19,19,19,20,19,20,19,21,21,20,19,19,19,19,19,21,21,19,20,19,19,19,19,21,19,19,19,19,21,19,20,19,19,20,21,19,21,20,19,19,20,20,19,21,19,19,19,19,19,20,19,21,21,21,0,0,0,21,19,20,21,19,20,21,19,20,19,21,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,22,22,22,22,22,22,22,22,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,23,23,0,23,0,23,23,0,0,0,0,0,0,23,23,23,0,24,24,24,24,24,24,24,24,24,24,24,24,0,0,25,26,0,26,25,26,25,25,26,0,26,25,26,25,26,26,26,25,26,25,26,25,27,0,0,0,0,28,29,29,27,30,28,29,27,30,28,29,29,28,27,30,29,27,30,28,30,29,27,30,28,0,29,30,30,0,30,29,29,27,30,28,29,27,30,28,29,27,30,28,0,0,31,32,31,32,31,32,32,0,0,0,31,32,31,32,32,32,31,32,0,0,32,0,32,31,32,31,32,31,0,33,33,0,0,0,33,34,35,34,33,35,34,33,34,33,33,33,35,34,35,35,34,33,34,34,34,35,35,35,35,34,33,34,35,34,35,34,35,34,34,33,34,35,34,33,35,34,33,35,34,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36],"f":[null,[[]],null,null,null,null,null,null,null,[[],["never",0]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],[[["arguments",3]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0],["str",0]],["result",6]],[[["panicinfo",3]],["never",0]],null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["vec",3]],[[]],[[["usize",0]]],[[["str",0]],["option",4]],[[],["usize",0]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,[[]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["physaddr",3]],[[["",0]],["virtaddr",3]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["simplerange",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["physaddr",3]],["ordering",4]],[[["",0],["virtaddr",3]],["ordering",4]],[[["",0],["physpagenum",3]],["ordering",4]],[[["",0],["virtpagenum",3]],["ordering",4]],null,null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[["usize",0]]],[[["physpagenum",3]]],[[["usize",0]]],[[]],[[["virtpagenum",3]]],[[]],[[["physaddr",3]]],[[["usize",0]]],[[]],[[["virtaddr",3]]],[[["usize",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[]],[[]],[[["",0]],["option",4]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],[[["",0],["physaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["virtaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["physpagenum",3]],["option",4,[["ordering",4]]]],[[["",0],["virtpagenum",3]],["option",4,[["ordering",4]]]],null,[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["physpagenum",3]]],[[["",0],["physpagenum",3]]],[[["",0]],["upsafecell",3]],[[["",0]]],null,[[["",0],["formatter",3]],["result",6]],[[],["option",4,[["frametracker",3]]]],[[]],[[["physpagenum",3]]],[[]],[[]],[[]],[[["",0],["physpagenum",3],["physpagenum",3]]],[[]],[[]],[[]],[[]],[[]],[[["physpagenum",3]]],[[]],null,null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[["layout",3]],["never",0]],[[]],[[]],null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]]],[[]],null,[[]],[[["",0]]],[[["mappermission",3]]],[[["",0]]],[[["",0]],["u8",0]],null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["maptype",4]],[[["",0]],["mappermission",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["mappermission",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[["",0],["pagetable",3]]],null,[[["",0]],["arc",3]],[[]],null,null,null,[[]],[[["",0],["maptype",4]],["bool",0]],[[["",0],["mappermission",3]],["bool",0]],null,null,[[["",0],["intoiterator",8]]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["maparea",3]]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[]],[[["memoryset",3]],["memoryset",3]],[[["intoiterator",8]]],[[["",0],["",0]]],[[["",0]]],[[["",0],["virtaddr",3],["virtaddr",3],["mappermission",3]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,[[["",0]]],null,[[["",0],["mappermission",3]],["bool",0]],[[["virtaddr",3],["virtaddr",3],["maptype",4],["mappermission",3]]],[[]],[[]],[[]],null,[[["",0],["mappermission",3]],["option",4,[["ordering",4]]]],[[["",0],["maparea",3],["option",4]]],[[["",0]]],[[]],[[["",0]]],[[["",0],["virtpagenum",3]]],null,null,[[["",0],["bool",0]]],null,null,null,[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[["",0]]],[[["pteflags",3]]],[[["",0]]],[[["",0]],["u8",0]],null,null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["pteflags",3]],[[["",0]],["pagetableentry",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["pteflags",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[["",0],["pteflags",3]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["intoiterator",8]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0]],["pteflags",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],null,[[]],[[]],[[]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[["intoiterator",8]]],[[["usize",0]]],[[["",0],["",0]]],[[["",0]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["virtpagenum",3],["physpagenum",3],["pteflags",3]]],[[["",0],["pteflags",3]],["bool",0]],[[]],[[["physpagenum",3],["pteflags",3]]],[[]],[[["",0],["pteflags",3]],["option",4,[["ordering",4]]]],[[["",0]],["physpagenum",3]],[[["",0]],["bool",0]],[[["",0]]],null,[[["",0],["bool",0]]],[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtaddr",3]],["option",4,[["physaddr",3]]]],[[["usize",0],["usize",0]],["vec",3]],[[["usize",0]],["",0]],[[["usize",0]],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["virtpagenum",3]]],[[["",0]],["bool",0]],null,null,null,null,null,null,null,null,null,[[],["usize",0]],[[["usize",0]]],[[["usize",0],["usize",0],["usize",0],["usize",0]],["usize",0]],[[["usize",0]]],[[],["never",0]],null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["refmut",3]],[[]],null,[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,[[["usize",0]],["isize",0]],null,null,[[["usize",0],["usize",0]],["isize",0]],[[["usize",0],["usize",0]],["isize",0]],[[],["isize",0]],[[["i32",0]],["never",0]],[[],["isize",0]],[[],["isize",0]],[[],["isize",0]],[[["isize",0]],["isize",0]],[[],["isize",0]],null,null,[[]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0]],["arc",3]],[[["i32",0]]],[[]],[[]],null,null,null,[[]],null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[["usize",0]]],[[]],null,null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[]],null,null,null,[[["",0],["arc",3,[["taskcontrolblock",3]]]]],[[["arc",3,[["taskcontrolblock",3]]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["upsafecell",3]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[]],[[]],[[]],[[]],[[]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["pidhandle",3]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["usize",0]]],[[["",0]],["upsafecell",3]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[["",0]],["usize",0]],[[]],[[]],[[]],[[]],[[["usize",0]]],[[]],[[["pidhandle",3]]],null,[[],["pidhandle",3]],[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["upsafecell",3]],[[]],[[]],[[["",0]]],null,[[]],[[]],[[]],[[]],[[]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0]],["taskstatus",4]],[[["",0],["",0]]],[[["",0],["taskstatus",4]],["bool",0]],[[["",0]]],null,[[["arc",3]],["arc",3,[["taskcontrolblock",3]]]],[[]],[[]],[[]],[[["",0]],["taskstatus",4]],[[["",0]],["trapcontext",3]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],null,[[["",0]],["refmut",3,[["taskcontrolblockinner",3]]]],[[]],[[]],[[]],[[["",0]],["bool",0]],null,null,[[]],null,null,null,null,[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[],["usize",0]],[[],["usize",0]],[[]],null,[[]],[[]],[[]],[[]],[[],["never",0]],[[],["never",0]],[[],["never",0]],null,[[["usize",0],["usize",0],["usize",0],["usize",0],["usize",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],null,null,null,[[["",0],["usize",0]]],null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null],"p":[[3,"Stdout"],[3,"APP_NAMES"],[3,"PhysAddr"],[3,"VirtAddr"],[3,"PhysPageNum"],[3,"VirtPageNum"],[3,"SimpleRangeIterator"],[3,"SimpleRange"],[8,"StepByOne"],[3,"FRAME_ALLOCATOR"],[8,"FrameAllocator"],[3,"StackFrameAllocator"],[3,"FrameTracker"],[4,"MapType"],[3,"MapPermission"],[3,"KERNEL_SPACE"],[3,"MemorySet"],[3,"MapArea"],[3,"PTEFlags"],[3,"PageTableEntry"],[3,"PageTable"],[3,"UPSafeCell"],[3,"INITPROC"],[3,"TaskContext"],[3,"TASK_MANAGER"],[3,"TaskManager"],[3,"PidHandle"],[3,"PID_ALLOCATOR"],[3,"PidAllocator"],[3,"KernelStack"],[3,"PROCESSOR"],[3,"Processor"],[4,"TaskStatus"],[3,"TaskControlBlockInner"],[3,"TaskControlBlock"],[3,"TrapContext"]]}\ +"os":{"doc":"The main module and entrypoint","t":[0,5,0,0,0,0,0,14,14,5,0,0,0,0,0,0,17,17,17,17,17,17,17,17,17,3,11,11,11,11,5,11,11,11,11,5,3,12,11,11,11,11,5,5,5,11,5,11,11,11,12,12,12,12,3,3,3,3,3,3,3,3,3,12,0,12,12,12,5,0,0,5,0,0,12,12,5,5,5,5,12,12,12,12,17,17,3,3,3,3,8,17,6,17,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,12,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,8,6,3,3,12,10,11,11,11,11,11,11,11,12,10,11,11,11,12,11,5,5,5,11,11,11,11,5,11,11,11,10,11,11,12,12,11,11,11,11,11,11,11,11,11,7,7,5,5,5,13,13,3,3,3,4,3,18,18,18,18,12,11,11,12,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,5,5,5,11,11,11,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,12,11,11,11,5,11,11,5,5,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,18,18,18,3,3,3,18,18,18,18,18,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,11,17,17,17,17,17,17,17,17,17,5,5,5,5,5,3,12,0,3,11,11,11,11,12,11,11,11,11,11,17,17,17,17,17,17,17,17,17,0,0,5,17,17,5,5,5,5,5,5,5,5,5,12,3,3,3,3,3,3,3,12,5,5,11,11,0,12,12,5,5,5,11,5,5,11,12,11,0,0,12,5,0,12,12,12,5,12,5,12,5,0,5,0,11,11,11,3,11,11,11,11,11,12,12,12,11,11,11,11,3,3,12,11,5,11,11,11,11,11,11,5,11,11,11,11,11,12,11,11,11,11,11,11,12,3,3,3,3,12,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,12,5,11,12,11,11,11,11,11,11,11,11,11,11,11,11,3,3,12,11,11,11,11,11,12,5,5,5,11,11,11,11,12,11,11,11,5,5,11,5,11,11,11,11,11,11,5,13,13,3,3,4,13,12,11,11,11,11,11,11,12,11,11,11,11,12,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,12,11,12,12,12,12,11,12,11,11,11,11,11,11,11,11,11,17,17,5,5,5,3,0,5,5,12,12,12,5,5,12,5,5,12,5,12,3,11,11,11,11,11,12,12,12,11,12,12,11,11,11,12],"n":["board","clear_bss","config","console","lang_items","loader","mm","print","println","rust_main","sbi","sync","syscall","task","timer","trap","CLOCK_FREQ","MEMORY_END","KERNEL_HEAP_SIZE","KERNEL_STACK_SIZE","PAGE_SIZE","PAGE_SIZE_BITS","TRAMPOLINE","TRAP_CONTEXT","USER_STACK_SIZE","Stdout","borrow","borrow_mut","from","into","print","try_from","try_into","type_id","write_str","panic","APP_NAMES","__private_field","borrow","borrow_mut","deref","from","get_app_data","get_app_data_by_name","get_num_app","into","list_apps","try_from","try_into","type_id","0","0","0","0","FrameTracker","KERNEL_SPACE","MapPermission","MemorySet","PageTableEntry","PhysAddr","PhysPageNum","VirtAddr","VirtPageNum","__private_field","address","areas","bits","bits","frame_alloc","frame_allocator","heap_allocator","init","memory_set","page_table","page_table","ppn","remap_test","translated_byte_buffer","translated_refmut","translated_str","0","0","0","0","PA_WIDTH_SV39","PPN_WIDTH_SV39","PhysAddr","PhysPageNum","SimpleRange","SimpleRangeIterator","StepByOne","VA_WIDTH_SV39","VPNRange","VPN_WIDTH_SV39","VirtAddr","VirtPageNum","aligned","aligned","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","ceil","ceil","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","cmp","current","end","eq","eq","eq","eq","floor","floor","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","get_bytes_array","get_end","get_mut","get_mut","get_pte_array","get_start","indexes","into","into","into","into","into","into","into_iter","into_iter","l","ne","ne","ne","ne","new","new","next","page_offset","page_offset","partial_cmp","partial_cmp","partial_cmp","partial_cmp","r","step","step","to_owned","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","FRAME_ALLOCATOR","FrameAllocator","FrameAllocatorImpl","FrameTracker","StackFrameAllocator","__private_field","alloc","alloc","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","current","dealloc","dealloc","deref","drop","end","fmt","frame_alloc","frame_allocator_test","frame_dealloc","from","from","from","init","init_frame_allocator","into","into","into","new","new","new","ppn","recycled","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","HEAP_ALLOCATOR","HEAP_SPACE","handle_alloc_error","heap_test","init_heap","Framed","Identical","KERNEL_SPACE","MapArea","MapPermission","MapType","MemorySet","R","U","W","X","__private_field","activate","all","areas","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","copy_data","data_frames","deref","difference","ebss","edata","ekernel","empty","eq","eq","erodata","etext","extend","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_another","from_bits","from_bits_truncate","from_bits_unchecked","from_elf","from_existed_user","from_iter","hash","insert","insert_framed_area","intersection","intersects","into","into","into","into","into","is_all","is_empty","map","map_one","map_perm","map_trampoline","map_type","ne","new","new_bare","new_kernel","not","page_table","partial_cmp","push","recycle_data_pages","remap_test","remove","remove_area_with_start_vpn","sbss_with_stack","sdata","set","srodata","stext","strampoline","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap","unmap_one","vpn_range","A","D","G","PTEFlags","PageTable","PageTableEntry","R","U","V","W","X","all","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","cmp","complement","contains","difference","empty","empty","eq","executable","extend","find_pte","find_pte_create","flags","fmt","fmt","fmt","fmt","fmt","frames","from","from","from","from_bits","from_bits_truncate","from_bits_unchecked","from_iter","from_token","hash","insert","intersection","intersects","into","into","into","is_all","is_empty","is_valid","map","ne","new","new","not","partial_cmp","ppn","readable","remove","root_ppn","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","token","translate","translate_va","translated_byte_buffer","translated_refmut","translated_str","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","union","unmap","writable","SBI_CLEAR_IPI","SBI_CONSOLE_GETCHAR","SBI_CONSOLE_PUTCHAR","SBI_REMOTE_FENCE_I","SBI_REMOTE_SFENCE_VMA","SBI_REMOTE_SFENCE_VMA_ASID","SBI_SEND_IPI","SBI_SET_TIMER","SBI_SHUTDOWN","console_getchar","console_putchar","sbi_call","set_timer","shutdown","UPSafeCell","inner","up","UPSafeCell","borrow","borrow_mut","exclusive_access","from","inner","into","new","try_from","try_into","type_id","SYSCALL_EXEC","SYSCALL_EXIT","SYSCALL_FORK","SYSCALL_GETPID","SYSCALL_GET_TIME","SYSCALL_READ","SYSCALL_WAITPID","SYSCALL_WRITE","SYSCALL_YIELD","fs","process","syscall","FD_STDIN","FD_STDOUT","sys_read","sys_write","sys_exec","sys_exit","sys_fork","sys_get_time","sys_getpid","sys_waitpid","sys_yield","0","INITPROC","KernelStack","PidAllocator","PidHandle","Processor","TaskContext","TaskManager","__private_field","add_initproc","add_task","borrow","borrow_mut","context","current","current","current_task","current_trap_cx","current_user_token","deref","exit_current_and_run_next","fetch_task","from","idle_task_cx","into","manager","pid","pid","pid_alloc","processor","ra","ready_queue","recycled","run_tasks","s","schedule","sp","suspend_current_and_run_next","switch","take_current_task","task","try_from","try_into","type_id","TaskContext","borrow","borrow_mut","from","goto_trap_return","into","ra","s","sp","try_from","try_into","type_id","zero_init","TASK_MANAGER","TaskManager","__private_field","add","add_task","borrow","borrow","borrow_mut","borrow_mut","deref","fetch","fetch_task","from","from","into","into","new","ready_queue","try_from","try_from","try_into","try_into","type_id","type_id","0","KernelStack","PID_ALLOCATOR","PidAllocator","PidHandle","__private_field","alloc","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","current","dealloc","deref","drop","drop","from","from","from","from","get_top","into","into","into","into","kernel_stack_position","new","new","pid","pid_alloc","push_on_top","recycled","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","PROCESSOR","Processor","__private_field","borrow","borrow","borrow_mut","borrow_mut","current","current","current_task","current_trap_cx","current_user_token","deref","from","from","get_idle_task_cx_ptr","idle_task_cx","into","into","new","run_tasks","schedule","take_current","take_current_task","try_from","try_from","try_into","try_into","type_id","type_id","__switch","Ready","Running","TaskControlBlock","TaskControlBlockInner","TaskStatus","Zombie","base_size","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","children","clone","clone_into","eq","exec","exit_code","fork","from","from","from","get_status","get_trap_cx","get_user_token","getpid","inner","inner_exclusive_access","into","into","into","is_zombie","kernel_stack","memory_set","new","parent","pid","task_cx","task_status","to_owned","trap_cx_ppn","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","MSEC_PER_SEC","TICKS_PER_SEC","get_time","get_time_ms","set_next_trigger","TrapContext","context","enable_timer_interrupt","init","kernel_satp","kernel_sp","sepc","set_kernel_trap_entry","set_user_trap_entry","sstatus","trap_from_kernel","trap_handler","trap_handler","trap_return","x","TrapContext","app_init_context","borrow","borrow_mut","from","into","kernel_satp","kernel_sp","sepc","set_sp","sstatus","trap_handler","try_from","try_into","type_id","x"],"q":["os","","","","","","","","","","","","","","","","os::board","","os::config","","","","","","","os::console","","","","","","","","","","os::lang_items","os::loader","","","","","","","","","","","","","","os::mm","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::address","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::frame_allocator","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::heap_allocator","","","","","os::mm::memory_set","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::mm::page_table","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::sbi","","","","","","","","","","","","","","os::sync","","","os::sync::up","","","","","","","","","","","os::syscall","","","","","","","","","","","","os::syscall::fs","","","","os::syscall::process","","","","","","","os::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::context","","","","","","","","","","","","","os::task::manager","","","","","","","","","","","","","","","","","","","","","","","","os::task::pid","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::processor","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::task::switch","os::task::task","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","os::timer","","","","","os::trap","","","","","","","","","","","","","","","os::trap::context","","","","","","","","","","","","","","",""],"d":["","clear BSS segment","Constants used in rCore","SBI console driver, for text output","The panic handler","Loading user applications into memory","Memory management implementation","print string macro","println string macro","the rust entry-point of os","SBI call wrappers","Synchronization and interior mutability primitives","Implementation of syscalls","Task management implementation","RISC-V timer-related functionality","Trap handling functionality","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","All of app’s name","","","","","Returns the argument unchanged.","get applications data","get app data from name","get app number","Calls U::from(self).","list all apps","","","","","","","","manage a frame which has the same lifecycle as the tracker","a memory set instance through lazy_static! managing kernel …","map permission corresponding to that in pte: R W X U","memory set structure, controls virtual-memory space","page table entry structure","physical address","physical page number","virtual address","virtual page number","","Implementation of physical and virtual address and page …","","","PTE","allocate a frame","Implementation of FrameAllocator which controls all the …","The global allocator","initiate heap allocator, frame allocator and kernel space","Implementation of MapArea and MemorySet.","Implementation of PageTableEntry and PageTable.","","","Check PageTable running correctly","translate a pointer to a mutable u8 Vec through page table","translate a generic through page table and return a …","translate a pointer to a mutable u8 Vec end with \\\\0 …","","","","","physical address","","physical address","physical page number","a simple range structure for type T","iterator for the simple range structure","","","a simple range structure for virtual page number","","virtual address","virtual page number","Check page aligned ","Check page aligned ","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","","","","","","","","","","","","","","","","","PhysAddr->PhysPageNum","VirtAddr->VirtPageNum","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","Returns the argument unchanged.","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Get mutable reference to PhysAddr value ","","Get PageTableEntry on PhysPageNum","","Return VPN 3 level index ","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","Get page offset ","Get page offset ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","frame allocator instance through lazy_static!","","","manage a frame which has the same lifecycle as the tracker","an implementation for frame allocator","","","","","","","","","","","","","","","","","allocate a frame","a simple test for frame allocator","deallocate a frame","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","initiate the frame allocator using ekernel and MEMORY_END","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Create an empty FrameTracker","","","","","","","","","","","","","heap allocator instance","heap space ([u8; KERNEL_HEAP_SIZE])","panic when heap allocation error occurs","","initiate heap allocator","","","a memory set instance through lazy_static! managing kernel …","map area structure, controls a contiguous piece of virtual …","map permission corresponding to that in pte: R W X U","map type for memory set: identical or framed","memory set structure, controls virtual-memory space","Readable","Accessible in U mode","Writable","Excutable","","Refresh TLB with sfence.vma","Returns the set containing all flags.","","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","data: start-aligned but maybe with shorter length assume …","","","Returns the difference between the flags in self and other.","","","","Returns an empty set of flags.","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","Include sections in elf and trampoline and TrapContext and …","Clone a same MemorySet","","","Inserts the specified flags in-place.","Assume that no conflicts.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","","","","Mention that trampoline is not collected by areas.","","","","Create an empty MemorySet","Without kernel stacks.","Returns the complement of this set of flags.","","","","Remove all MapArea","Check PageTable running correctly","Removes the specified flags in-place.","Remove MapArea that starts with start_vpn","","","Inserts or removes the specified flags depending on the …","","","","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","Get pagetable root_ppn","Translate throuth pagetable","","","","","","","","","","","","","","","","Returns the union of between the flags in self and other.","","","","","","","","","page table entry structure","","","","","","Returns the set containing all flags.","Returns the intersection between the two sets of flags.","Disables all flags disabled in the set.","Returns the union of the two sets of flags.","Adds the set of flags.","Returns the raw value of the flags currently stored.","","PTE","Returns the left flags, but with all the right flags …","Toggles the set of flags.","","","","","","","","","","","","Returns the complement of this set of flags.","Returns true if all of the flags in other are contained …","Returns the difference between the flags in self and other.","Returns an empty set of flags.","Return an empty PTE","","Check PTE executable","","","","Return 10bit flag","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from underlying bit representation, unless that …","Convert from underlying bit representation, dropping any …","Convert from underlying bit representation, preserving all …","","Temporarily used to get arguments from user space.","","Inserts the specified flags in-place.","Returns the intersection between the flags in self and …","Returns true if there are flags common to both self and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Returns true if all flags are currently set.","Returns true if no flags are currently stored.","Check PTE valid","","","","Create a PTE from ppn","Returns the complement of this set of flags.","","Return 44bit ppn ","Check PTE readable","Removes the specified flags in-place.","","Inserts or removes the specified flags depending on the …","Returns the set difference of the two sets of flags.","Disables all flags enabled in the set.","Returns the symmetric difference between the flags in self …","","","Toggles the specified flags in-place.","","","","translate a pointer to a mutable u8 Vec through page table","translate a generic through page table and return a …","translate a pointer to a mutable u8 Vec end with \\\\0 …","","","","","","","","","","Returns the union of between the flags in self and other.","","Check PTE writable","","","","","","","","","","use sbi call to getchar from console (qemu uart handler)","use sbi call to putchar in console (qemu uart handler)","general sbi call","use sbi call to set timer","use sbi call to shutdown the kernel","Wrap a static data structure inside it so that we are able …","inner data","Uniprocessor interior mutability primitives","Wrap a static data structure inside it so that we are able …","","","Exclusive access inner data in UPSafeCell. Panic if the …","Returns the argument unchanged.","inner data","Calls U::from(self).","User is responsible to guarantee that inner struct is only …","","","","","","","","","","","","","File and filesystem-related syscalls","","handle syscall exception with syscall_id and other …","","","","","","","","","","If there is not a child process whose pid is same as …","","","Globle process that init user shell ","Kernelstack for app ","Pid Allocator struct","Bind pid lifetime to PidHandle","Processor management structure","task context structure containing some registers","A array of TaskControlBlock that is thread-safe","","Add init process to the manager","Interface offered to add task","","","Implementation of TaskContext","","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Exit the current ‘Running’ task and run the next task …","Interface offered to pop the first task","Returns the argument unchanged.","The basic control flow of each core, helping to select and …","Calls U::from(self).","Implementation of TaskManager","Implementation of PidAllocator","","Allocate a pid from PID_ALLOCATOR","Implementation of Processor and Intersection of control …","return address ( e.g. __restore ) of __switch ASM function","","","The main part of process execution and scheduling Loop …","s0-11 register, callee saved","Return to idle control flow for new scheduling","kernel stack pointer of app","Suspend the current ‘Running’ task and run the next …","Wrap switch.S as a function","Take the current task,leaving a None in its place","Implementation of TaskControlBlock ","","","","task context structure containing some registers","","","Returns the argument unchanged.","set Task Context{__restore ASM funciton: trap_return, sp: …","Calls U::from(self).","return address ( e.g. __restore ) of __switch ASM function","s0-11 register, callee saved","kernel stack pointer of app","","","","init task context","","A array of TaskControlBlock that is thread-safe","","Add a task to TaskManager","Interface offered to add task","","","","","","Remove the first task and return it,or None if TaskManager …","Interface offered to pop the first task","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Creat an empty TaskManager","","","","","","","","","Kernelstack for app ","","Pid Allocator struct","Bind pid lifetime to PidHandle","","Allocate a pid","","","","","","","","","","Recycle a pid","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get the value on the top of kernelstack","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Return (bottom, top) of a kernel stack in kernel space.","Create an empty PidAllocator","Create a kernelstack from pid","","Allocate a pid from PID_ALLOCATOR","Push a value on top of kernelstack","","","","","","","","","","","","","","","Processor management structure","","","","","","Get current task in cloning semanteme","The task currently executing on the current processor","Get running task","Get the mutable reference to trap context of current task","Get token of the address space of current task","","Returns the argument unchanged.","Returns the argument unchanged.","Get mutable reference to idle_task_cx","The basic control flow of each core, helping to select and …","Calls U::from(self).","Calls U::from(self).","Create an empty Processor","The main part of process execution and scheduling Loop …","Return to idle control flow for new scheduling","Get current task in moving semanteme","Take the current task,leaving a None in its place","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","get current time","get current time in microseconds","set the next timer interrupt","trap context structure containing sstatus, sepc and …","Implementation of TrapContext","enable timer interrupt in sie CSR","initialize CSR stvec as the entry of __alltraps","Addr of Page Table","kernel stack","CSR sepc","","","CSR sstatus ","Unimplement: traps/interrupts/exceptions from kernel mode …","handle an interrupt, exception, or system call from user …","Addr of trap_handler function","set the new addr of __restore asm function in TRAMPOLINE …","general regs[0..31]","trap context structure containing sstatus, sepc and …","init app context","","","Returns the argument unchanged.","Calls U::from(self).","Addr of Page Table","kernel stack","CSR sepc","set stack pointer to x_2 reg (sp)","CSR sstatus ","Addr of trap_handler function","","","","general regs[0..31]"],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,2,2,2,2,2,0,0,0,2,0,2,2,2,3,4,5,6,0,0,0,0,0,0,0,0,0,7,0,8,9,10,0,0,0,0,0,0,8,11,0,0,0,0,3,4,5,6,0,0,0,0,0,0,0,0,0,0,0,0,3,4,12,3,4,5,6,13,12,3,4,5,6,13,3,4,3,4,5,6,13,3,4,5,6,13,3,4,5,6,12,12,3,4,5,6,3,4,3,4,5,6,12,3,3,3,4,4,4,5,5,5,6,6,6,13,5,13,3,5,5,13,6,12,3,4,5,6,13,12,13,13,3,4,5,6,12,13,12,3,4,3,4,5,6,13,14,6,3,4,5,6,13,12,3,4,5,6,13,12,3,4,5,6,13,12,3,4,5,6,13,0,0,0,0,0,15,16,17,11,17,15,11,17,15,17,16,17,15,11,17,11,0,0,0,11,17,15,17,0,11,17,15,16,11,17,11,17,11,17,15,11,17,15,11,17,15,0,0,0,0,0,18,18,0,0,0,0,0,9,9,9,9,7,8,9,8,9,9,9,9,9,9,9,9,8,19,7,18,9,8,19,7,18,9,18,9,18,9,9,9,9,19,19,7,9,0,0,0,9,18,9,0,0,9,18,9,9,9,9,9,8,19,7,18,9,19,9,9,9,8,8,9,9,9,8,9,9,8,19,7,18,9,9,9,19,19,19,8,19,9,19,8,8,9,8,9,8,8,0,9,8,0,0,9,0,0,0,9,9,9,18,9,9,8,8,8,19,7,18,9,8,19,7,18,9,8,19,7,18,9,9,19,19,19,20,20,20,0,0,0,20,20,20,20,20,20,20,20,20,20,20,20,10,20,20,21,20,10,21,20,10,20,10,20,10,20,20,20,20,20,10,20,10,20,21,21,10,20,20,20,20,20,21,21,20,10,20,20,20,20,21,20,20,20,20,21,20,10,20,20,10,21,20,21,10,20,20,10,10,20,21,20,20,20,20,20,10,20,21,21,21,0,0,0,21,20,10,21,20,10,21,20,10,20,21,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,22,22,22,22,22,22,22,22,22,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,0,0,0,0,0,0,24,0,0,24,24,0,25,26,0,0,0,24,0,0,24,26,24,0,0,27,0,0,28,29,25,0,28,0,28,0,0,0,0,24,24,24,0,28,28,28,28,28,28,28,28,28,28,28,28,0,0,30,29,0,29,30,29,30,30,29,0,29,30,29,30,29,29,29,30,29,30,29,30,23,0,0,0,0,31,25,25,23,27,31,25,23,27,31,25,25,31,23,27,25,23,27,31,27,25,23,27,31,0,25,27,27,0,27,25,25,23,27,31,25,23,27,31,25,23,27,31,0,0,32,26,32,26,32,26,26,0,0,0,32,26,32,26,26,26,32,26,0,0,26,0,26,32,26,32,26,32,0,33,33,0,0,0,33,34,35,34,33,35,34,33,34,33,33,33,35,34,35,35,34,33,34,34,34,35,35,35,35,34,33,34,35,34,35,34,35,34,34,33,34,35,34,33,35,34,33,35,34,33,0,0,0,0,0,0,0,0,0,36,36,36,0,0,36,0,0,36,0,36,0,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36],"f":[null,[[]],null,null,null,null,null,null,null,[[],["never",0]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],[[["arguments",3]]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0],["str",0]],["result",6]],[[["panicinfo",3]],["never",0]],null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["vec",3]],[[]],[[["usize",0]]],[[["str",0]],["option",4]],[[],["usize",0]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[],["option",4,[["frametracker",3]]]],null,null,[[]],null,null,null,null,[[]],[[["usize",0],["usize",0]],["vec",3]],[[["usize",0]],["",0]],[[["usize",0]],["string",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["physaddr",3]],[[["",0]],["virtaddr",3]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0]],["simplerange",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["physaddr",3]],["ordering",4]],[[["",0],["virtaddr",3]],["ordering",4]],[[["",0],["physpagenum",3]],["ordering",4]],[[["",0],["virtpagenum",3]],["ordering",4]],null,null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[["",0]],["physpagenum",3]],[[["",0]],["virtpagenum",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[["usize",0]]],[[["physpagenum",3]]],[[]],[[["virtpagenum",3]]],[[["usize",0]]],[[["usize",0]]],[[]],[[["physaddr",3]]],[[["virtaddr",3]]],[[["usize",0]]],[[]],[[]],[[["",0]]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,[[["",0],["physaddr",3]],["bool",0]],[[["",0],["virtaddr",3]],["bool",0]],[[["",0],["physpagenum",3]],["bool",0]],[[["",0],["virtpagenum",3]],["bool",0]],[[]],[[]],[[["",0]],["option",4]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],[[["",0],["physaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["virtaddr",3]],["option",4,[["ordering",4]]]],[[["",0],["physpagenum",3]],["option",4,[["ordering",4]]]],[[["",0],["virtpagenum",3]],["option",4,[["ordering",4]]]],null,[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["option",4,[["physpagenum",3]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["physpagenum",3]]],[[["",0],["physpagenum",3]]],[[["",0]],["upsafecell",3]],[[["",0]]],null,[[["",0],["formatter",3]],["result",6]],[[],["option",4,[["frametracker",3]]]],[[]],[[["physpagenum",3]]],[[]],[[]],[[]],[[["",0],["physpagenum",3],["physpagenum",3]]],[[]],[[]],[[]],[[]],[[]],[[["physpagenum",3]]],[[]],null,null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[["layout",3]],["never",0]],[[]],[[]],null,null,null,null,null,null,null,null,null,null,null,null,[[["",0]]],[[]],null,[[]],[[["",0]]],[[["mappermission",3]]],[[["",0]]],[[["",0]],["u8",0]],null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["maptype",4]],[[["",0]],["mappermission",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["mappermission",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[["",0],["pagetable",3]]],null,[[["",0]],["arc",3]],[[]],null,null,null,[[]],[[["",0],["maptype",4]],["bool",0]],[[["",0],["mappermission",3]],["bool",0]],null,null,[[["",0],["intoiterator",8]]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["maparea",3]]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[]],[[["memoryset",3]],["memoryset",3]],[[["intoiterator",8]]],[[["",0],["",0]]],[[["",0]]],[[["",0],["virtaddr",3],["virtaddr",3],["mappermission",3]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,[[["",0]]],null,[[["",0],["mappermission",3]],["bool",0]],[[["virtaddr",3],["virtaddr",3],["maptype",4],["mappermission",3]]],[[]],[[]],[[]],null,[[["",0],["mappermission",3]],["option",4,[["ordering",4]]]],[[["",0],["maparea",3],["option",4]]],[[["",0]]],[[]],[[["",0]]],[[["",0],["virtpagenum",3]]],null,null,[[["",0],["bool",0]]],null,null,null,[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["pagetable",3]]],[[["",0],["pagetable",3],["virtpagenum",3]]],null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[["",0]]],[[["pteflags",3]]],[[["",0]]],[[["",0]],["u8",0]],null,null,[[]],[[["",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["pteflags",3]],[[["",0]],["pagetableentry",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["pteflags",3]],["ordering",4]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[["",0],["pteflags",3]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["intoiterator",8]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0]],["pteflags",3]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],[[["",0],["formatter",3]],["result",6]],null,[[]],[[]],[[]],[[["u8",0]],["option",4]],[[["u8",0]]],[[["u8",0]]],[[["intoiterator",8]]],[[["usize",0]]],[[["",0],["",0]]],[[["",0]]],[[]],[[["",0]],["bool",0]],[[]],[[]],[[]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0]],["bool",0]],[[["",0],["virtpagenum",3],["physpagenum",3],["pteflags",3]]],[[["",0],["pteflags",3]],["bool",0]],[[]],[[["physpagenum",3],["pteflags",3]]],[[]],[[["",0],["pteflags",3]],["option",4,[["ordering",4]]]],[[["",0]],["physpagenum",3]],[[["",0]],["bool",0]],[[["",0]]],null,[[["",0],["bool",0]]],[[]],[[["",0]]],[[]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["usize",0]],[[["",0],["virtpagenum",3]],["option",4,[["pagetableentry",3]]]],[[["",0],["virtaddr",3]],["option",4,[["physaddr",3]]]],[[["usize",0],["usize",0]],["vec",3]],[[["usize",0]],["",0]],[[["usize",0]],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[]],[[["",0],["virtpagenum",3]]],[[["",0]],["bool",0]],null,null,null,null,null,null,null,null,null,[[],["usize",0]],[[["usize",0]]],[[["usize",0],["usize",0],["usize",0],["usize",0]],["usize",0]],[[["usize",0]]],[[],["never",0]],null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["refmut",3]],[[]],null,[[]],[[]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,[[["usize",0]],["isize",0]],null,null,[[["usize",0],["usize",0]],["isize",0]],[[["usize",0],["usize",0]],["isize",0]],[[],["isize",0]],[[["i32",0]],["never",0]],[[],["isize",0]],[[],["isize",0]],[[],["isize",0]],[[["isize",0]],["isize",0]],[[],["isize",0]],null,null,null,null,null,null,null,null,null,[[]],[[["arc",3,[["taskcontrolblock",3]]]]],[[["",0]],["",0]],[[["",0]],["",0]],null,null,null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["arc",3]],[[["i32",0]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[]],null,[[]],null,null,null,[[],["pidhandle",3]],null,null,null,null,[[]],null,[[]],null,[[]],null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null,[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[["usize",0]]],[[]],null,null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[]],null,null,null,[[["",0],["arc",3,[["taskcontrolblock",3]]]]],[[["arc",3,[["taskcontrolblock",3]]]]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["upsafecell",3]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[]],[[]],[[]],[[]],[[]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,[[["",0]],["pidhandle",3]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0],["usize",0]]],[[["",0]],["upsafecell",3]],[[["",0]]],[[["",0]]],[[]],[[]],[[]],[[]],[[["",0]],["usize",0]],[[]],[[]],[[]],[[]],[[["usize",0]]],[[]],[[["pidhandle",3]]],null,[[],["pidhandle",3]],[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],null,[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["trapcontext",3]],[[],["usize",0]],[[["",0]],["upsafecell",3]],[[]],[[]],[[["",0]]],null,[[]],[[]],[[]],[[]],[[]],[[["",0]],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["option",4,[["arc",3,[["taskcontrolblock",3]]]]]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,null,null,null,null,null,null,[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],null,[[["",0]],["taskstatus",4]],[[["",0],["",0]]],[[["",0],["taskstatus",4]],["bool",0]],[[["",0]]],null,[[["arc",3]],["arc",3,[["taskcontrolblock",3]]]],[[]],[[]],[[]],[[["",0]],["taskstatus",4]],[[["",0]],["trapcontext",3]],[[["",0]],["usize",0]],[[["",0]],["usize",0]],null,[[["",0]],["refmut",3,[["taskcontrolblockinner",3]]]],[[]],[[]],[[]],[[["",0]],["bool",0]],null,null,[[]],null,null,null,null,[[["",0]]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,null,[[],["usize",0]],[[],["usize",0]],[[]],null,null,[[]],[[]],null,null,null,[[]],[[]],null,[[],["never",0]],[[],["never",0]],null,[[],["never",0]],null,null,[[["usize",0],["usize",0],["usize",0],["usize",0],["usize",0]]],[[["",0]],["",0]],[[["",0]],["",0]],[[]],[[]],null,null,null,[[["",0],["usize",0]]],null,null,[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],null],"p":[[3,"Stdout"],[3,"APP_NAMES"],[3,"PhysAddr"],[3,"VirtAddr"],[3,"PhysPageNum"],[3,"VirtPageNum"],[3,"KERNEL_SPACE"],[3,"MemorySet"],[3,"MapPermission"],[3,"PageTableEntry"],[3,"FrameTracker"],[3,"SimpleRangeIterator"],[3,"SimpleRange"],[8,"StepByOne"],[3,"FRAME_ALLOCATOR"],[8,"FrameAllocator"],[3,"StackFrameAllocator"],[4,"MapType"],[3,"MapArea"],[3,"PTEFlags"],[3,"PageTable"],[3,"UPSafeCell"],[3,"PidHandle"],[3,"INITPROC"],[3,"PidAllocator"],[3,"Processor"],[3,"KernelStack"],[3,"TaskContext"],[3,"TaskManager"],[3,"TASK_MANAGER"],[3,"PID_ALLOCATOR"],[3,"PROCESSOR"],[4,"TaskStatus"],[3,"TaskControlBlockInner"],[3,"TaskControlBlock"],[3,"TrapContext"]]}\ }'); if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/ch5/src/os/config.rs.html b/ch5/src/os/config.rs.html index df639a82..27013a9f 100644 --- a/ch5/src/os/config.rs.html +++ b/ch5/src/os/config.rs.html @@ -15,7 +15,9 @@ 10 11 12 -
pub const USER_STACK_SIZE: usize = 4096 * 2;
+13
+
//! Constants used in rCore
+pub const USER_STACK_SIZE: usize = 4096 * 2;
 pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
 pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
 
diff --git a/ch5/src/os/console.rs.html b/ch5/src/os/console.rs.html
index 2d7067f4..5022b66b 100644
--- a/ch5/src/os/console.rs.html
+++ b/ch5/src/os/console.rs.html
@@ -34,7 +34,11 @@
 29
 30
 31
-
use crate::sbi::console_putchar;
+32
+33
+34
+
//! SBI console driver, for text output
+use crate::sbi::console_putchar;
 use core::fmt::{self, Write};
 
 struct Stdout;
@@ -53,6 +57,7 @@
 }
 
 #[macro_export]
+/// print string macro
 macro_rules! print {
     ($fmt: literal $(, $($arg: tt)+)?) => {
         $crate::console::print(format_args!($fmt $(, $($arg)+)?));
@@ -60,6 +65,7 @@
 }
 
 #[macro_export]
+/// println string macro
 macro_rules! println {
     ($fmt: literal $(, $($arg: tt)+)?) => {
         $crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
diff --git a/ch5/src/os/lang_items.rs.html b/ch5/src/os/lang_items.rs.html
index d2f78eb1..7e0aedab 100644
--- a/ch5/src/os/lang_items.rs.html
+++ b/ch5/src/os/lang_items.rs.html
@@ -20,7 +20,9 @@
 15
 16
 17
-
use crate::sbi::shutdown;
+18
+
//! The panic handler
+use crate::sbi::shutdown;
 use core::panic::PanicInfo;
 
 #[panic_handler]
diff --git a/ch5/src/os/loader.rs.html b/ch5/src/os/loader.rs.html
index 48ae8271..4836978f 100644
--- a/ch5/src/os/loader.rs.html
+++ b/ch5/src/os/loader.rs.html
@@ -68,16 +68,24 @@
 63
 64
 65
-
use alloc::vec::Vec;
-use lazy_static::*;
+66
+67
+68
+69
+70
+
//! Loading user applications into memory
 
+/// Get the total number of applications.
+use alloc::vec::Vec;
+use lazy_static::*;
+///get app number
 pub fn get_num_app() -> usize {
     extern "C" {
         fn _num_app();
     }
     unsafe { (_num_app as usize as *const usize).read_volatile() }
 }
-
+/// get applications data
 pub fn get_app_data(app_id: usize) -> &'static [u8] {
     extern "C" {
         fn _num_app();
@@ -95,6 +103,7 @@
 }
 
 lazy_static! {
+    ///All of app's name
     static ref APP_NAMES: Vec<&'static str> = {
         let num_app = get_num_app();
         extern "C" {
@@ -119,13 +128,14 @@
 }
 
 #[allow(unused)]
+///get app data from name
 pub fn get_app_data_by_name(name: &str) -> Option<&'static [u8]> {
     let num_app = get_num_app();
     (0..num_app)
         .find(|&i| APP_NAMES[i] == name)
         .map(get_app_data)
 }
-
+///list all apps
 pub fn list_apps() {
     println!("/**** APPS ****");
     for app in APP_NAMES.iter() {
diff --git a/ch5/src/os/main.rs.html b/ch5/src/os/main.rs.html
index 1a235cd7..76f9c68c 100644
--- a/ch5/src/os/main.rs.html
+++ b/ch5/src/os/main.rs.html
@@ -64,7 +64,53 @@
 59
 60
 61
-
#![no_std]
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+
//! The main module and entrypoint
+//!
+//! Various facilities of the kernels are implemented as submodules. The most
+//! important ones are:
+//!
+//! - [`trap`]: Handles all cases of switching from userspace to the kernel
+//! - [`task`]: Task management
+//! - [`syscall`]: System call handling and implementation
+//! - [`mm`]: Address map using SV39
+//! - [`sync`]:Wrap a static data structure inside it so that we are able to access it without any `unsafe`.
+//!
+//! The operating system also starts in this module. Kernel code starts
+//! executing from `entry.asm`, after which [`rust_main()`] is called to
+//! initialize various pieces of functionality. (See its source code for
+//! details.)
+//!
+//! We then call [`task::run_tasks()`] and for the first time go to
+//! userspace.
+
+#![deny(missing_docs)]
+#![deny(warnings)]
+
+#![no_std]
 #![no_main]
 #![feature(panic_info_message)]
 #![feature(alloc_error_handler)]
@@ -86,19 +132,19 @@
 mod config;
 mod lang_items;
 mod loader;
-mod mm;
+pub mod mm;
 mod sbi;
-mod sync;
-mod syscall;
-mod task;
+pub mod sync;
+pub mod syscall;
+pub mod task;
 mod timer;
-mod trap;
+pub mod trap;
 
 use core::arch::global_asm;
 
 global_asm!(include_str!("entry.asm"));
 global_asm!(include_str!("link_app.S"));
-
+/// clear BSS segment
 fn clear_bss() {
     extern "C" {
         fn sbss();
@@ -111,6 +157,7 @@
 }
 
 #[no_mangle]
+/// the rust entry-point of os
 pub fn rust_main() -> ! {
     clear_bss();
     println!("[kernel] Hello, world!");
@@ -119,6 +166,7 @@
     task::add_initproc();
     println!("after initproc!");
     trap::init();
+    //trap::enable_interrupt();
     trap::enable_timer_interrupt();
     timer::set_next_trigger();
     loader::list_apps();
diff --git a/ch5/src/os/mm/address.rs.html b/ch5/src/os/mm/address.rs.html
index 54851ab1..d52fc1a8 100644
--- a/ch5/src/os/mm/address.rs.html
+++ b/ch5/src/os/mm/address.rs.html
@@ -249,25 +249,43 @@
 244
 245
 246
-
use super::PageTableEntry;
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+
//! Implementation of physical and virtual address and page number.
+use super::PageTableEntry;
 use crate::config::{PAGE_SIZE, PAGE_SIZE_BITS};
 use core::fmt::{self, Debug, Formatter};
-
+/// physical address
 const PA_WIDTH_SV39: usize = 56;
 const VA_WIDTH_SV39: usize = 39;
 const PPN_WIDTH_SV39: usize = PA_WIDTH_SV39 - PAGE_SIZE_BITS;
 const VPN_WIDTH_SV39: usize = VA_WIDTH_SV39 - PAGE_SIZE_BITS;
 
-/// Definitions
+/// physical address
 #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
 pub struct PhysAddr(pub usize);
-
+/// virtual address
 #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
 pub struct VirtAddr(pub usize);
-
+/// physical page number
 #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
 pub struct PhysPageNum(pub usize);
-
+/// virtual page number
 #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
 pub struct VirtPageNum(pub usize);
 
@@ -338,17 +356,21 @@
         v.0
     }
 }
-
+///
 impl VirtAddr {
+    ///`VirtAddr`->`VirtPageNum`
     pub fn floor(&self) -> VirtPageNum {
         VirtPageNum(self.0 / PAGE_SIZE)
     }
+    ///`VirtAddr`->`VirtPageNum`
     pub fn ceil(&self) -> VirtPageNum {
         VirtPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
     }
+    ///Get page offset 
     pub fn page_offset(&self) -> usize {
         self.0 & (PAGE_SIZE - 1)
     }
+    ///Check page aligned 
     pub fn aligned(&self) -> bool {
         self.page_offset() == 0
     }
@@ -365,15 +387,19 @@
     }
 }
 impl PhysAddr {
+    ///`PhysAddr`->`PhysPageNum`
     pub fn floor(&self) -> PhysPageNum {
         PhysPageNum(self.0 / PAGE_SIZE)
     }
+    ///`PhysAddr`->`PhysPageNum`
     pub fn ceil(&self) -> PhysPageNum {
         PhysPageNum((self.0 - 1 + PAGE_SIZE) / PAGE_SIZE)
     }
+    ///Get page offset 
     pub fn page_offset(&self) -> usize {
         self.0 & (PAGE_SIZE - 1)
     }
+    ///Check page aligned 
     pub fn aligned(&self) -> bool {
         self.page_offset() == 0
     }
@@ -391,6 +417,7 @@
 }
 
 impl VirtPageNum {
+    ///Return VPN 3 level index 
     pub fn indexes(&self) -> [usize; 3] {
         let mut vpn = self.0;
         let mut idx = [0usize; 3];
@@ -403,19 +430,23 @@
 }
 
 impl PhysAddr {
+    ///Get mutable reference to `PhysAddr` value 
     pub fn get_mut<T>(&self) -> &'static mut T {
         unsafe { (self.0 as *mut T).as_mut().unwrap() }
     }
 }
 impl PhysPageNum {
+    ///Get `PageTableEntry` on `PhysPageNum`
     pub fn get_pte_array(&self) -> &'static mut [PageTableEntry] {
         let pa: PhysAddr = (*self).into();
         unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut PageTableEntry, 512) }
     }
+    ///
     pub fn get_bytes_array(&self) -> &'static mut [u8] {
         let pa: PhysAddr = (*self).into();
         unsafe { core::slice::from_raw_parts_mut(pa.0 as *mut u8, 4096) }
     }
+    ///
     pub fn get_mut<T>(&self) -> &'static mut T {
         let pa: PhysAddr = (*self).into();
         pa.get_mut()
@@ -432,6 +463,7 @@
 }
 
 #[derive(Copy, Clone)]
+/// a simple range structure for type T
 pub struct SimpleRange<T>
 where
     T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
@@ -464,6 +496,7 @@
         SimpleRangeIterator::new(self.l, self.r)
     }
 }
+/// iterator for the simple range structure
 pub struct SimpleRangeIterator<T>
 where
     T: StepByOne + Copy + PartialEq + PartialOrd + Debug,
@@ -494,6 +527,7 @@
         }
     }
 }
+/// a simple range structure for virtual page number
 pub type VPNRange = SimpleRange<VirtPageNum>;
 
diff --git a/ch5/src/os/mm/frame_allocator.rs.html b/ch5/src/os/mm/frame_allocator.rs.html index b8c48f2a..0641e4ea 100644 --- a/ch5/src/os/mm/frame_allocator.rs.html +++ b/ch5/src/os/mm/frame_allocator.rs.html @@ -130,18 +130,30 @@ 125 126 127 -
use super::{PhysAddr, PhysPageNum};
+128
+129
+130
+131
+132
+133
+134
+
//! Implementation of [`FrameAllocator`] which 
+//! controls all the frames in the operating system.
+use super::{PhysAddr, PhysPageNum};
 use crate::config::MEMORY_END;
 use crate::sync::UPSafeCell;
 use alloc::vec::Vec;
 use core::fmt::{self, Debug, Formatter};
 use lazy_static::*;
 
+/// manage a frame which has the same lifecycle as the tracker
 pub struct FrameTracker {
+    ///
     pub ppn: PhysPageNum,
 }
 
 impl FrameTracker {
+    ///Create an empty `FrameTracker`
     pub fn new(ppn: PhysPageNum) -> Self {
         // page cleaning
         let bytes_array = ppn.get_bytes_array();
@@ -169,7 +181,7 @@
     fn alloc(&mut self) -> Option<PhysPageNum>;
     fn dealloc(&mut self, ppn: PhysPageNum);
 }
-
+/// an implementation for frame allocator
 pub struct StackFrameAllocator {
     current: usize,
     end: usize,
@@ -215,10 +227,11 @@
 type FrameAllocatorImpl = StackFrameAllocator;
 
 lazy_static! {
+    /// frame allocator instance through lazy_static!
     pub static ref FRAME_ALLOCATOR: UPSafeCell<FrameAllocatorImpl> =
         unsafe { UPSafeCell::new(FrameAllocatorImpl::new()) };
 }
-
+/// initiate the frame allocator using `ekernel` and `MEMORY_END`
 pub fn init_frame_allocator() {
     extern "C" {
         fn ekernel();
@@ -228,19 +241,20 @@
         PhysAddr::from(MEMORY_END).floor(),
     );
 }
-
+/// allocate a frame
 pub fn frame_alloc() -> Option<FrameTracker> {
     FRAME_ALLOCATOR
         .exclusive_access()
         .alloc()
         .map(FrameTracker::new)
 }
-
+/// deallocate a frame
 fn frame_dealloc(ppn: PhysPageNum) {
     FRAME_ALLOCATOR.exclusive_access().dealloc(ppn);
 }
 
 #[allow(unused)]
+/// a simple test for frame allocator
 pub fn frame_allocator_test() {
     let mut v: Vec<FrameTracker> = Vec::new();
     for i in 0..5 {
diff --git a/ch5/src/os/mm/heap_allocator.rs.html b/ch5/src/os/mm/heap_allocator.rs.html
index 532cbad3..bf02b012 100644
--- a/ch5/src/os/mm/heap_allocator.rs.html
+++ b/ch5/src/os/mm/heap_allocator.rs.html
@@ -48,19 +48,25 @@
 43
 44
 45
-
use crate::config::KERNEL_HEAP_SIZE;
+46
+47
+48
+
//! The global allocator
+use crate::config::KERNEL_HEAP_SIZE;
 use buddy_system_allocator::LockedHeap;
 
 #[global_allocator]
+/// heap allocator instance
 static HEAP_ALLOCATOR: LockedHeap = LockedHeap::empty();
 
 #[alloc_error_handler]
+/// panic when heap allocation error occurs
 pub fn handle_alloc_error(layout: core::alloc::Layout) -> ! {
     panic!("Heap allocation error, layout = {:?}", layout);
 }
-
+/// heap space ([u8; KERNEL_HEAP_SIZE])
 static mut HEAP_SPACE: [u8; KERNEL_HEAP_SIZE] = [0; KERNEL_HEAP_SIZE];
-
+/// initiate heap allocator
 pub fn init_heap() {
     unsafe {
         HEAP_ALLOCATOR
diff --git a/ch5/src/os/mm/memory_set.rs.html b/ch5/src/os/mm/memory_set.rs.html
index 83142269..c304062e 100644
--- a/ch5/src/os/mm/memory_set.rs.html
+++ b/ch5/src/os/mm/memory_set.rs.html
@@ -385,7 +385,24 @@
 380
 381
 382
-
use super::{frame_alloc, FrameTracker};
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+
//! Implementation of [`MapArea`] and [`MemorySet`].
+use super::{frame_alloc, FrameTracker};
 use super::{PTEFlags, PageTable, PageTableEntry};
 use super::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
 use super::{StepByOne, VPNRange};
@@ -412,22 +429,25 @@
 }
 
 lazy_static! {
+    /// a memory set instance through lazy_static! managing kernel space
     pub static ref KERNEL_SPACE: Arc<UPSafeCell<MemorySet>> =
         Arc::new(unsafe { UPSafeCell::new(MemorySet::new_kernel()) });
 }
-
+/// memory set structure, controls virtual-memory space
 pub struct MemorySet {
     page_table: PageTable,
     areas: Vec<MapArea>,
 }
 
 impl MemorySet {
+    ///Create an empty `MemorySet`
     pub fn new_bare() -> Self {
         Self {
             page_table: PageTable::new(),
             areas: Vec::new(),
         }
     }
+    ///Get pagetable `root_ppn`
     pub fn token(&self) -> usize {
         self.page_table.token()
     }
@@ -443,6 +463,7 @@
             None,
         );
     }
+    ///Remove `MapArea` that starts with `start_vpn`
     pub fn remove_area_with_start_vpn(&mut self, start_vpn: VirtPageNum) {
         if let Some((idx, area)) = self
             .areas
@@ -602,6 +623,7 @@
             elf.header.pt2.entry_point() as usize,
         )
     }
+    ///Clone a same `MemorySet`
     pub fn from_existed_user(user_space: &MemorySet) -> MemorySet {
         let mut memory_set = Self::new_bare();
         // map trampoline
@@ -621,6 +643,7 @@
         }
         memory_set
     }
+    ///Refresh TLB with `sfence.vma`
     pub fn activate(&self) {
         let satp = self.page_table.token();
         unsafe {
@@ -628,15 +651,17 @@
             asm!("sfence.vma");
         }
     }
+    ///Translate throuth pagetable
     pub fn translate(&self, vpn: VirtPageNum) -> Option<PageTableEntry> {
         self.page_table.translate(vpn)
     }
+    ///Remove all `MapArea`
     pub fn recycle_data_pages(&mut self) {
         //*self = Self::new_bare();
         self.areas.clear();
     }
 }
-
+/// map area structure, controls a contiguous piece of virtual memory
 pub struct MapArea {
     vpn_range: VPNRange,
     data_frames: BTreeMap<VirtPageNum, FrameTracker>,
@@ -724,21 +749,28 @@
 }
 
 #[derive(Copy, Clone, PartialEq, Debug)]
+/// map type for memory set: identical or framed
 pub enum MapType {
     Identical,
     Framed,
 }
 
 bitflags! {
+    /// map permission corresponding to that in pte: `R W X U`
     pub struct MapPermission: u8 {
+        ///Readable
         const R = 1 << 1;
+        ///Writable
         const W = 1 << 2;
+        ///Excutable
         const X = 1 << 3;
+        ///Accessible in U mode
         const U = 1 << 4;
     }
 }
 
 #[allow(unused)]
+///Check PageTable running correctly
 pub fn remap_test() {
     let mut kernel_space = KERNEL_SPACE.exclusive_access();
     let mid_text: VirtAddr = ((stext as usize + etext as usize) / 2).into();
diff --git a/ch5/src/os/mm/mod.rs.html b/ch5/src/os/mm/mod.rs.html
index 28234b36..4ca2afbc 100644
--- a/ch5/src/os/mm/mod.rs.html
+++ b/ch5/src/os/mm/mod.rs.html
@@ -22,7 +22,21 @@
 17
 18
 19
-
mod address;
+20
+21
+22
+23
+24
+25
+26
+
//! Memory management implementation
+//! 
+//! SV39 page-based virtual-memory architecture for RV64 systems, and
+//! everything about memory management, like frame allocator, page table,
+//! map area and memory set, is implemented here.
+//! 
+//! Every task or process has a memory_set to control its virtual memory.
+mod address;
 mod frame_allocator;
 mod heap_allocator;
 mod memory_set;
@@ -35,7 +49,7 @@
 pub use memory_set::{MapPermission, MemorySet, KERNEL_SPACE};
 pub use page_table::{translated_byte_buffer, translated_refmut, translated_str, PageTableEntry};
 use page_table::{PTEFlags, PageTable};
-
+/// initiate heap allocator, frame allocator and kernel space
 pub fn init() {
     heap_allocator::init_heap();
     frame_allocator::init_frame_allocator();
diff --git a/ch5/src/os/mm/page_table.rs.html b/ch5/src/os/mm/page_table.rs.html
index 2ace9b1c..d8d2e88e 100644
--- a/ch5/src/os/mm/page_table.rs.html
+++ b/ch5/src/os/mm/page_table.rs.html
@@ -195,7 +195,19 @@
 190
 191
 192
-
use super::{frame_alloc, FrameTracker, PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+
//! Implementation of [`PageTableEntry`] and [`PageTable`].
+use super::{frame_alloc, FrameTracker, PhysAddr, PhysPageNum, StepByOne, VirtAddr, VirtPageNum};
 use alloc::string::String;
 use alloc::vec;
 use alloc::vec::Vec;
@@ -216,34 +228,44 @@
 
 #[derive(Copy, Clone)]
 #[repr(C)]
+/// page table entry structure
 pub struct PageTableEntry {
+    ///PTE
     pub bits: usize,
 }
 
 impl PageTableEntry {
+    ///Create a PTE from ppn
     pub fn new(ppn: PhysPageNum, flags: PTEFlags) -> Self {
         PageTableEntry {
             bits: ppn.0 << 10 | flags.bits as usize,
         }
     }
+    ///Return an empty PTE
     pub fn empty() -> Self {
         PageTableEntry { bits: 0 }
     }
+    ///Return 44bit ppn 
     pub fn ppn(&self) -> PhysPageNum {
         (self.bits >> 10 & ((1usize << 44) - 1)).into()
     }
+    ///Return 10bit flag
     pub fn flags(&self) -> PTEFlags {
         PTEFlags::from_bits(self.bits as u8).unwrap()
     }
+    ///Check PTE valid
     pub fn is_valid(&self) -> bool {
         (self.flags() & PTEFlags::V) != PTEFlags::empty()
     }
+    ///Check PTE readable
     pub fn readable(&self) -> bool {
         (self.flags() & PTEFlags::R) != PTEFlags::empty()
     }
+    ///Check PTE writable
     pub fn writable(&self) -> bool {
         (self.flags() & PTEFlags::W) != PTEFlags::empty()
     }
+    ///Check PTE executable
     pub fn executable(&self) -> bool {
         (self.flags() & PTEFlags::X) != PTEFlags::empty()
     }
@@ -335,8 +357,8 @@
         8usize << 60 | self.root_ppn.0
     }
 }
-
-pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
+    /// translate a pointer to a mutable u8 Vec through page table
+    pub fn translated_byte_buffer(token: usize, ptr: *const u8, len: usize) -> Vec<&'static mut [u8]> {
     let page_table = PageTable::from_token(token);
     let mut start = ptr as usize;
     let end = start + len;
@@ -356,9 +378,9 @@
         start = end_va.into();
     }
     v
-}
-
-pub fn translated_str(token: usize, ptr: *const u8) -> String {
+    }
+    /// translate a pointer to a mutable u8 Vec end with `\0` through page table to a `String`
+    pub fn translated_str(token: usize, ptr: *const u8) -> String {
     let page_table = PageTable::from_token(token);
     let mut string = String::new();
     let mut va = ptr as usize;
@@ -375,9 +397,9 @@
         }
     }
     string
-}
-
-pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T {
+    }
+    ///translate a generic through page table and return a mutable reference
+    pub fn translated_refmut<T>(token: usize, ptr: *mut T) -> &'static mut T {
     //println!("into translated_refmut!");
     let page_table = PageTable::from_token(token);
     let va = ptr as usize;
@@ -386,7 +408,7 @@
         .translate_va(VirtAddr::from(va))
         .unwrap()
         .get_mut()
-}
+    }
 
\ No newline at end of file diff --git a/ch5/src/os/sbi.rs.html b/ch5/src/os/sbi.rs.html index f39290ab..f7a61651 100644 --- a/ch5/src/os/sbi.rs.html +++ b/ch5/src/os/sbi.rs.html @@ -48,7 +48,9 @@ 43 44 45 -
#![allow(unused)]
+46
+
//! SBI call wrappers
+#![allow(unused)]
 
 use core::arch::asm;
 
@@ -61,7 +63,7 @@
 const SBI_REMOTE_SFENCE_VMA: usize = 6;
 const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
 const SBI_SHUTDOWN: usize = 8;
-
+/// general sbi call
 #[inline(always)]
 fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
     let mut ret;
@@ -76,19 +78,19 @@
     }
     ret
 }
-
+/// use sbi call to set timer
 pub fn set_timer(timer: usize) {
     sbi_call(SBI_SET_TIMER, timer, 0, 0);
 }
-
+/// use sbi call to putchar in console (qemu uart handler)
 pub fn console_putchar(c: usize) {
     sbi_call(SBI_CONSOLE_PUTCHAR, c, 0, 0);
 }
-
+/// use sbi call to getchar from console (qemu uart handler)
 pub fn console_getchar() -> usize {
     sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0)
 }
-
+/// use sbi call to shutdown the kernel
 pub fn shutdown() -> ! {
     sbi_call(SBI_SHUTDOWN, 0, 0, 0);
     panic!("It should shutdown!");
diff --git a/ch5/src/os/sync/mod.rs.html b/ch5/src/os/sync/mod.rs.html
index 59a0becc..ddac4110 100644
--- a/ch5/src/os/sync/mod.rs.html
+++ b/ch5/src/os/sync/mod.rs.html
@@ -6,7 +6,9 @@
         
1
 2
 3
-
mod up;
+4
+
//! Synchronization and interior mutability primitives
+mod up;
 
 pub use up::UPSafeCell;
 
diff --git a/ch5/src/os/sync/up.rs.html b/ch5/src/os/sync/up.rs.html index a50c9b57..ebbd89d3 100644 --- a/ch5/src/os/sync/up.rs.html +++ b/ch5/src/os/sync/up.rs.html @@ -32,7 +32,9 @@ 27 28 29 -
use core::cell::{RefCell, RefMut};
+30
+
//! Uniprocessor interior mutability primitives
+use core::cell::{RefCell, RefMut};
 
 /// Wrap a static data structure inside it so that we are
 /// able to access it without any `unsafe`.
@@ -56,7 +58,7 @@
             inner: RefCell::new(value),
         }
     }
-    /// Panic if the data has been borrowed.
+    /// Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.
     pub fn exclusive_access(&self) -> RefMut<'_, T> {
         self.inner.borrow_mut()
     }
diff --git a/ch5/src/os/syscall/fs.rs.html b/ch5/src/os/syscall/fs.rs.html
index 8bd2c074..35c227f5 100644
--- a/ch5/src/os/syscall/fs.rs.html
+++ b/ch5/src/os/syscall/fs.rs.html
@@ -51,7 +51,9 @@
 46
 47
 48
-
use crate::mm::translated_byte_buffer;
+49
+
//! File and filesystem-related syscalls
+use crate::mm::translated_byte_buffer;
 use crate::sbi::console_getchar;
 use crate::task::{current_user_token, suspend_current_and_run_next};
 
diff --git a/ch5/src/os/syscall/mod.rs.html b/ch5/src/os/syscall/mod.rs.html
index 22ff9995..e916bbf4 100644
--- a/ch5/src/os/syscall/mod.rs.html
+++ b/ch5/src/os/syscall/mod.rs.html
@@ -33,7 +33,29 @@
 28
 29
 30
-
const SYSCALL_READ: usize = 63;
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+
//! Implementation of syscalls
+//!
+//! The single entry point to all system calls, [`syscall()`], is called
+//! whenever userspace wishes to perform a system call using the `ecall`
+//! instruction. In this case, the processor raises an 'Environment call from
+//! U-mode' exception, which is handled as one of the cases in
+//! [`crate::trap::trap_handler`].
+//!
+//! For clarity, each single syscall is implemented as its own function, named
+//! `sys_` then the name of the syscall. You can find functions like this in
+//! submodules, and you should also implement syscalls this way.
+const SYSCALL_READ: usize = 63;
 const SYSCALL_WRITE: usize = 64;
 const SYSCALL_EXIT: usize = 93;
 const SYSCALL_YIELD: usize = 124;
@@ -48,7 +70,7 @@
 
 use fs::*;
 use process::*;
-
+/// handle syscall exception with `syscall_id` and other arguments
 pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
     match syscall_id {
         SYSCALL_READ => sys_read(args[0], args[1] as *const u8, args[2]),
diff --git a/ch5/src/os/task/context.rs.html b/ch5/src/os/task/context.rs.html
index d9313a1d..74f63852 100644
--- a/ch5/src/os/task/context.rs.html
+++ b/ch5/src/os/task/context.rs.html
@@ -28,16 +28,29 @@
 23
 24
 25
-
use crate::trap::trap_return;
+26
+27
+28
+29
+30
+31
+32
+
//! Implementation of [`TaskContext`]
+use crate::trap::trap_return;
 
 #[repr(C)]
+/// task context structure containing some registers
 pub struct TaskContext {
+    /// return address ( e.g. __restore ) of __switch ASM function
     ra: usize,
+    /// kernel stack pointer of app
     sp: usize,
+    /// s0-11 register, callee saved
     s: [usize; 12],
 }
 
 impl TaskContext {
+    /// init task context
     pub fn zero_init() -> Self {
         Self {
             ra: 0,
@@ -45,6 +58,7 @@
             s: [0; 12],
         }
     }
+    /// set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}
     pub fn goto_trap_return(kstack_ptr: usize) -> Self {
         Self {
             ra: trap_return as usize,
diff --git a/ch5/src/os/task/manager.rs.html b/ch5/src/os/task/manager.rs.html
index 632e67b7..7b725e41 100644
--- a/ch5/src/os/task/manager.rs.html
+++ b/ch5/src/os/task/manager.rs.html
@@ -40,26 +40,34 @@
 35
 36
 37
-
use super::TaskControlBlock;
+38
+39
+40
+41
+
//!Implementation of [`TaskManager`]
+use super::TaskControlBlock;
 use crate::sync::UPSafeCell;
 use alloc::collections::VecDeque;
 use alloc::sync::Arc;
 use lazy_static::*;
-
+///A array of `TaskControlBlock` that is thread-safe
 pub struct TaskManager {
     ready_queue: VecDeque<Arc<TaskControlBlock>>,
 }
 
 /// A simple FIFO scheduler.
 impl TaskManager {
+    ///Creat an empty TaskManager
     pub fn new() -> Self {
         Self {
             ready_queue: VecDeque::new(),
         }
     }
+    ///Add a task to `TaskManager`
     pub fn add(&mut self, task: Arc<TaskControlBlock>) {
         self.ready_queue.push_back(task);
     }
+    ///Remove the first task and return it,or `None` if `TaskManager` is empty
     pub fn fetch(&mut self) -> Option<Arc<TaskControlBlock>> {
         self.ready_queue.pop_front()
     }
@@ -69,11 +77,11 @@
     pub static ref TASK_MANAGER: UPSafeCell<TaskManager> =
         unsafe { UPSafeCell::new(TaskManager::new()) };
 }
-
+///Interface offered to add task
 pub fn add_task(task: Arc<TaskControlBlock>) {
     TASK_MANAGER.exclusive_access().add(task);
 }
-
+///Interface offered to pop the first task
 pub fn fetch_task() -> Option<Arc<TaskControlBlock>> {
     TASK_MANAGER.exclusive_access().fetch()
 }
diff --git a/ch5/src/os/task/mod.rs.html b/ch5/src/os/task/mod.rs.html
index 812e56a5..facdc142 100644
--- a/ch5/src/os/task/mod.rs.html
+++ b/ch5/src/os/task/mod.rs.html
@@ -85,28 +85,63 @@
 80
 81
 82
-
mod context;
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+
//! Task management implementation
+//!
+//! Everything about task management, like starting and switching tasks is
+//! implemented here.
+//!
+//! A single global instance of [`TaskManager`] called `TASK_MANAGER` controls
+//! all the tasks in the whole operating system.
+//! 
+//! A single global instance of [`Processor`] called `PROCESSOR` monitors running 
+//! task(s) for each core. 
+//! 
+//! A single global instance of [`PidAllocator`] called `PID_ALLOCATOR` allocates 
+//! pid for user apps.
+//! 
+//! Be careful when you see `__switch` ASM function in `switch.S`. Control flow around this function
+//! might not be what you expect.
+mod context;
 mod manager;
 mod pid;
 mod processor;
 mod switch;
 #[allow(clippy::module_inception)]
+
 mod task;
 
 use crate::loader::get_app_data_by_name;
 use alloc::sync::Arc;
 use lazy_static::*;
-use manager::fetch_task;
+pub use manager::{fetch_task,TaskManager};
 use switch::__switch;
 use task::{TaskControlBlock, TaskStatus};
 
 pub use context::TaskContext;
 pub use manager::add_task;
-pub use pid::{pid_alloc, KernelStack, PidHandle};
+pub use pid::{pid_alloc, KernelStack, PidHandle,PidAllocator};
 pub use processor::{
-    current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,
+    current_task, current_trap_cx, current_user_token, run_tasks, schedule, take_current_task,Processor
 };
-
+/// Suspend the current 'Running' task and run the next task in task list.
 pub fn suspend_current_and_run_next() {
     // There must be an application running.
     let task = take_current_task().unwrap();
@@ -124,7 +159,7 @@
     // jump to scheduling cycle
     schedule(task_cx_ptr);
 }
-
+/// Exit the current 'Running' task and run the next task in task list.
 pub fn exit_current_and_run_next(exit_code: i32) {
     // take from Processor
     let task = take_current_task().unwrap();
@@ -159,11 +194,12 @@
 }
 
 lazy_static! {
+    ///Globle process that init user shell 
     pub static ref INITPROC: Arc<TaskControlBlock> = Arc::new(TaskControlBlock::new(
         get_app_data_by_name("initproc").unwrap()
     ));
 }
-
+///Add init process to the manager
 pub fn add_initproc() {
     add_task(INITPROC.clone());
 }
diff --git a/ch5/src/os/task/pid.rs.html b/ch5/src/os/task/pid.rs.html
index 97be7d9e..cdac9211 100644
--- a/ch5/src/os/task/pid.rs.html
+++ b/ch5/src/os/task/pid.rs.html
@@ -107,24 +107,34 @@
 102
 103
 104
-
use crate::config::{KERNEL_STACK_SIZE, PAGE_SIZE, TRAMPOLINE};
+105
+106
+107
+108
+109
+110
+111
+
//!Implementation of [`PidAllocator`]
+use crate::config::{KERNEL_STACK_SIZE, PAGE_SIZE, TRAMPOLINE};
 use crate::mm::{MapPermission, VirtAddr, KERNEL_SPACE};
 use crate::sync::UPSafeCell;
 use alloc::vec::Vec;
 use lazy_static::*;
-
-struct PidAllocator {
+///Pid Allocator struct
+pub struct PidAllocator {
     current: usize,
     recycled: Vec<usize>,
 }
 
 impl PidAllocator {
+    ///Create an empty `PidAllocator`
     pub fn new() -> Self {
         PidAllocator {
             current: 0,
             recycled: Vec::new(),
         }
     }
+    ///Allocate a pid
     pub fn alloc(&mut self) -> PidHandle {
         if let Some(pid) = self.recycled.pop() {
             PidHandle(pid)
@@ -133,6 +143,7 @@
             PidHandle(self.current - 1)
         }
     }
+    ///Recycle a pid
     pub fn dealloc(&mut self, pid: usize) {
         assert!(pid < self.current);
         assert!(
@@ -145,10 +156,10 @@
 }
 
 lazy_static! {
-    static ref PID_ALLOCATOR: UPSafeCell<PidAllocator> =
+    pub static ref PID_ALLOCATOR: UPSafeCell<PidAllocator> =
         unsafe { UPSafeCell::new(PidAllocator::new()) };
 }
-
+///Bind pid lifetime to `PidHandle`
 pub struct PidHandle(pub usize);
 
 impl Drop for PidHandle {
@@ -157,7 +168,7 @@
         PID_ALLOCATOR.exclusive_access().dealloc(self.0);
     }
 }
-
+///Allocate a pid from PID_ALLOCATOR
 pub fn pid_alloc() -> PidHandle {
     PID_ALLOCATOR.exclusive_access().alloc()
 }
@@ -168,12 +179,13 @@
     let bottom = top - KERNEL_STACK_SIZE;
     (bottom, top)
 }
-
+///Kernelstack for app 
 pub struct KernelStack {
     pid: usize,
 }
 
 impl KernelStack {
+    ///Create a kernelstack from pid
     pub fn new(pid_handle: &PidHandle) -> Self {
         let pid = pid_handle.0;
         let (kernel_stack_bottom, kernel_stack_top) = kernel_stack_position(pid);
@@ -185,6 +197,7 @@
         KernelStack { pid: pid_handle.0 }
     }
     #[allow(unused)]
+    ///Push a value on top of kernelstack
     pub fn push_on_top<T>(&self, value: T) -> *mut T
     where
         T: Sized,
@@ -196,6 +209,7 @@
         }
         ptr_mut
     }
+    ///Get the value on the top of kernelstack
     pub fn get_top(&self) -> usize {
         let (_, kernel_stack_top) = kernel_stack_position(self.pid);
         kernel_stack_top
diff --git a/ch5/src/os/task/processor.rs.html b/ch5/src/os/task/processor.rs.html
index 0bf1d005..c9d0690a 100644
--- a/ch5/src/os/task/processor.rs.html
+++ b/ch5/src/os/task/processor.rs.html
@@ -88,32 +88,47 @@
 83
 84
 85
-
use super::__switch;
+86
+87
+88
+89
+90
+91
+92
+93
+
//!Implementation of [`Processor`] and Intersection of control flow
+use super::__switch;
 use super::{fetch_task, TaskStatus};
 use super::{TaskContext, TaskControlBlock};
 use crate::sync::UPSafeCell;
 use crate::trap::TrapContext;
 use alloc::sync::Arc;
 use lazy_static::*;
-
+///Processor management structure
 pub struct Processor {
+    ///The task currently executing on the current processor
     current: Option<Arc<TaskControlBlock>>,
+    ///The basic control flow of each core, helping to select and switch process
     idle_task_cx: TaskContext,
 }
 
 impl Processor {
+    ///Create an empty Processor
     pub fn new() -> Self {
         Self {
             current: None,
             idle_task_cx: TaskContext::zero_init(),
         }
     }
+    ///Get mutable reference to `idle_task_cx`
     fn get_idle_task_cx_ptr(&mut self) -> *mut TaskContext {
         &mut self.idle_task_cx as *mut _
     }
+    ///Get current task in moving semanteme
     pub fn take_current(&mut self) -> Option<Arc<TaskControlBlock>> {
         self.current.take()
     }
+    ///Get current task in cloning semanteme
     pub fn current(&self) -> Option<Arc<TaskControlBlock>> {
         self.current.as_ref().map(Arc::clone)
     }
@@ -122,7 +137,8 @@
 lazy_static! {
     pub static ref PROCESSOR: UPSafeCell<Processor> = unsafe { UPSafeCell::new(Processor::new()) };
 }
-
+///The main part of process execution and scheduling
+///Loop `fetch_task` to get the process that needs to run, and switch the process through `__switch`
 pub fn run_tasks() {
     loop {
         let mut processor = PROCESSOR.exclusive_access();
@@ -143,28 +159,28 @@
         }
     }
 }
-
+///Take the current task,leaving a None in its place
 pub fn take_current_task() -> Option<Arc<TaskControlBlock>> {
     PROCESSOR.exclusive_access().take_current()
 }
-
+///Get running task
 pub fn current_task() -> Option<Arc<TaskControlBlock>> {
     PROCESSOR.exclusive_access().current()
 }
-
+///Get token of the address space of current task
 pub fn current_user_token() -> usize {
     let task = current_task().unwrap();
     let token = task.inner_exclusive_access().get_user_token();
     token
 }
-
+///Get the mutable reference to trap context of current task
 pub fn current_trap_cx() -> &'static mut TrapContext {
     current_task()
         .unwrap()
         .inner_exclusive_access()
         .get_trap_cx()
 }
-
+///Return to idle control flow for new scheduling
 pub fn schedule(switched_task_cx_ptr: *mut TaskContext) {
     let mut processor = PROCESSOR.exclusive_access();
     let idle_task_cx_ptr = processor.get_idle_task_cx_ptr();
diff --git a/ch5/src/os/task/switch.rs.html b/ch5/src/os/task/switch.rs.html
index 18b475c6..d2bb7497 100644
--- a/ch5/src/os/task/switch.rs.html
+++ b/ch5/src/os/task/switch.rs.html
@@ -11,7 +11,9 @@
 6
 7
 8
-
use super::TaskContext;
+9
+
//!Wrap `switch.S` as a function
+use super::TaskContext;
 use core::arch::global_asm;
 
 global_asm!(include_str!("switch.S"));
diff --git a/ch5/src/os/task/task.rs.html b/ch5/src/os/task/task.rs.html
index 73c3abb6..1fd3db22 100644
--- a/ch5/src/os/task/task.rs.html
+++ b/ch5/src/os/task/task.rs.html
@@ -171,7 +171,9 @@
 166
 167
 168
-
use super::TaskContext;
+169
+
//!Implementation of [`TaskControlBlock`] 
+use super::TaskContext;
 use super::{pid_alloc, KernelStack, PidHandle};
 use crate::config::TRAP_CONTEXT;
 use crate::mm::{MemorySet, PhysPageNum, VirtAddr, KERNEL_SPACE};
diff --git a/ch5/src/os/timer.rs.html b/ch5/src/os/timer.rs.html
index 3ced983c..e8c2cdfa 100644
--- a/ch5/src/os/timer.rs.html
+++ b/ch5/src/os/timer.rs.html
@@ -21,21 +21,27 @@
 16
 17
 18
-
use crate::config::CLOCK_FREQ;
+19
+20
+21
+

+//! RISC-V timer-related functionality
+
+use crate::config::CLOCK_FREQ;
 use crate::sbi::set_timer;
 use riscv::register::time;
 
 const TICKS_PER_SEC: usize = 100;
 const MSEC_PER_SEC: usize = 1000;
-
+///get current time
 pub fn get_time() -> usize {
     time::read()
 }
-
+/// get current time in microseconds
 pub fn get_time_ms() -> usize {
     time::read() / (CLOCK_FREQ / MSEC_PER_SEC)
 }
-
+/// set the next timer interrupt
 pub fn set_next_trigger() {
     set_timer(get_time() + CLOCK_FREQ / TICKS_PER_SEC);
 }
diff --git a/ch5/src/os/trap/context.rs.html b/ch5/src/os/trap/context.rs.html
index a80f771a..c937acf5 100644
--- a/ch5/src/os/trap/context.rs.html
+++ b/ch5/src/os/trap/context.rs.html
@@ -41,22 +41,42 @@
 36
 37
 38
-
use riscv::register::sstatus::{self, Sstatus, SPP};
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
//! Implementation of [`TrapContext`]
+use riscv::register::sstatus::{self, Sstatus, SPP};
 
 #[repr(C)]
+///trap context structure containing sstatus, sepc and registers
 pub struct TrapContext {
+    /// general regs[0..31]
     pub x: [usize; 32],
+    /// CSR sstatus      
     pub sstatus: Sstatus,
+    /// CSR sepc
     pub sepc: usize,
+    /// Addr of Page Table
     pub kernel_satp: usize,
+    /// kernel stack
     pub kernel_sp: usize,
+    /// Addr of trap_handler function
     pub trap_handler: usize,
 }
 
 impl TrapContext {
+    ///set stack pointer to x_2 reg (sp)
     pub fn set_sp(&mut self, sp: usize) {
         self.x[2] = sp;
     }
+    ///init app context
     pub fn app_init_context(
         entry: usize,
         sp: usize,
diff --git a/ch5/src/os/trap/mod.rs.html b/ch5/src/os/trap/mod.rs.html
index 76607a64..60371edb 100644
--- a/ch5/src/os/trap/mod.rs.html
+++ b/ch5/src/os/trap/mod.rs.html
@@ -121,7 +121,39 @@
 116
 117
 118
-
mod context;
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
//! Trap handling functionality
+//!
+//! For rCore, we have a single trap entry point, namely `__alltraps`. At
+//! initialization in [`init()`], we set the `stvec` CSR to point to it.
+//!
+//! All traps go through `__alltraps`, which is defined in `trap.S`. The
+//! assembly language code does just enough work restore the kernel space
+//! context, ensuring that Rust code safely runs, and transfers control to
+//! [`trap_handler()`].
+//!
+//! It then calls different functionality based on what exactly the exception
+//! was. For example, timer interrupts trigger task preemption, and syscalls go
+//! to [`syscall()`].
+mod context;
 
 use crate::config::{TRAMPOLINE, TRAP_CONTEXT};
 use crate::syscall::syscall;
@@ -137,7 +169,7 @@
 };
 
 global_asm!(include_str!("trap.S"));
-
+/// initialize CSR `stvec` as the entry of `__alltraps`
 pub fn init() {
     set_kernel_trap_entry();
 }
@@ -153,7 +185,7 @@
         stvec::write(TRAMPOLINE as usize, TrapMode::Direct);
     }
 }
-
+/// enable timer interrupt in sie CSR
 pub fn enable_timer_interrupt() {
     unsafe {
         sie::set_stimer();
@@ -161,6 +193,7 @@
 }
 
 #[no_mangle]
+/// handle an interrupt, exception, or system call from user space
 pub fn trap_handler() -> ! {
     set_kernel_trap_entry();
     let scause = scause::read();
@@ -212,6 +245,9 @@
 }
 
 #[no_mangle]
+/// set the new addr of __restore asm function in TRAMPOLINE page,
+/// set the reg a0 = trap_cx_ptr, reg a1 = phy addr of usr page table,
+/// finally, jump to new addr of __restore asm function 
 pub fn trap_return() -> ! {
     set_user_trap_entry();
     let trap_cx_ptr = TRAP_CONTEXT;
@@ -234,6 +270,8 @@
 }
 
 #[no_mangle]
+/// Unimplement: traps/interrupts/exceptions from kernel mode
+/// Todo: Chapter 9: I/O device 
 pub fn trap_from_kernel() -> ! {
     panic!("a trap {:?} from kernel!", scause::read().cause());
 }