From 8c7ac34af41367d2e6fed1facc47d9ddc8122ba8 Mon Sep 17 00:00:00 2001 From: wyfcyx Date: Sat, 28 May 2022 06:38:24 +0000 Subject: [PATCH] deploy: 4c049f6274cd7722ac8620101cb237322fb8ad4b --- ch7/os/drivers/block/index.html | 2 +- ch7/os/mm/memory_set/fn.remap_test.html | 2 +- ch7/os/mm/memory_set/index.html | 2 +- ch7/os/syscall/fn.syscall.html | 2 +- ch7/os/syscall/index.html | 2 +- .../process/fn.check_sigaction_error.html | 2 +- ch7/os/syscall/process/fn.sys_sigaction.html | 2 +- ch7/os/syscall/process/index.html | 2 +- ch7/os/task/action/index.html | 2 +- ch7/os/task/action/struct.SignalAction.html | 10 ++--- ch7/os/task/action/struct.SignalActions.html | 6 +-- ch7/src/os/boards/qemu.rs.html | 2 - ch7/src/os/config.rs.html | 2 - ch7/src/os/drivers/block/mod.rs.html | 4 +- ch7/src/os/fs/stdio.rs.html | 2 +- ch7/src/os/mm/memory_set.rs.html | 42 +++++++------------ ch7/src/os/syscall/mod.rs.html | 10 ++++- ch7/src/os/syscall/process.rs.html | 22 ++++++++-- ch7/src/os/task/action.rs.html | 8 ++-- ch7/src/os/task/task.rs.html | 10 ++--- ch7/src/os/trap/mod.rs.html | 2 +- 21 files changed, 71 insertions(+), 67 deletions(-) diff --git a/ch7/os/drivers/block/index.html b/ch7/os/drivers/block/index.html index 246f4994..a231a5d6 100644 --- a/ch7/os/drivers/block/index.html +++ b/ch7/os/drivers/block/index.html @@ -5,7 +5,7 @@

Re-exports

-
pub use virtio_blk::VirtIOBlock;
pub use sdcard::SDCardWrapper;

Modules

+
pub use sdcard::SDCardWrapper;
pub use virtio_blk::VirtIOBlock;

Modules

sdcard 🔒
virtio_blk 🔒

Structs

Functions

diff --git a/ch7/os/mm/memory_set/fn.remap_test.html b/ch7/os/mm/memory_set/fn.remap_test.html index e6872493..296a2e9f 100644 --- a/ch7/os/mm/memory_set/fn.remap_test.html +++ b/ch7/os/mm/memory_set/fn.remap_test.html @@ -4,5 +4,5 @@
pub fn remap_test()
+

Function os::mm::memory_set::remap_test

source · []
pub fn remap_test()
\ No newline at end of file diff --git a/ch7/os/mm/memory_set/index.html b/ch7/os/mm/memory_set/index.html index 41dce3bb..18e8d77f 100644 --- a/ch7/os/mm/memory_set/index.html +++ b/ch7/os/mm/memory_set/index.html @@ -4,7 +4,7 @@

Structs

Enums

Functions

diff --git a/ch7/os/syscall/fn.syscall.html b/ch7/os/syscall/fn.syscall.html index b9acdd04..e9e268a9 100644 --- a/ch7/os/syscall/fn.syscall.html +++ b/ch7/os/syscall/fn.syscall.html @@ -4,5 +4,5 @@
-

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
\ No newline at end of file diff --git a/ch7/os/syscall/index.html b/ch7/os/syscall/index.html index 3a9a5f31..d85d6d25 100644 --- a/ch7/os/syscall/index.html +++ b/ch7/os/syscall/index.html @@ -4,7 +4,7 @@
-

Module os::syscall

source · []

Modules

+

Module os::syscall

source · []

Modules

fs 🔒
process 🔒

Constants

Functions

diff --git a/ch7/os/syscall/process/fn.check_sigaction_error.html b/ch7/os/syscall/process/fn.check_sigaction_error.html index c1293856..d3102dd7 100644 --- a/ch7/os/syscall/process/fn.check_sigaction_error.html +++ b/ch7/os/syscall/process/fn.check_sigaction_error.html @@ -4,5 +4,5 @@
fn check_sigaction_error(
    signal: SignalFlags,
    action: usize,
    old_action: usize
) -> bool
+

Function os::syscall::process::check_sigaction_error

source · []
fn check_sigaction_error(
    signal: SignalFlags,
    action: usize,
    old_action: usize
) -> bool
\ No newline at end of file diff --git a/ch7/os/syscall/process/fn.sys_sigaction.html b/ch7/os/syscall/process/fn.sys_sigaction.html index 3126d6cd..1105806b 100644 --- a/ch7/os/syscall/process/fn.sys_sigaction.html +++ b/ch7/os/syscall/process/fn.sys_sigaction.html @@ -4,5 +4,5 @@
pub fn sys_sigaction(
    signum: i32,
    action: *const SignalAction,
    old_action: *mut SignalAction
) -> isize
+

Function os::syscall::process::sys_sigaction

source · []
pub fn sys_sigaction(
    signum: i32,
    action: *const SignalAction,
    old_action: *mut SignalAction
) -> isize
\ No newline at end of file diff --git a/ch7/os/syscall/process/index.html b/ch7/os/syscall/process/index.html index ee602bfb..57946db7 100644 --- a/ch7/os/syscall/process/index.html +++ b/ch7/os/syscall/process/index.html @@ -4,7 +4,7 @@

Functions

If there is not a child process whose pid is same as given, return -1. Else if there is a child process but it is still running, return -2.

diff --git a/ch7/os/task/action/index.html b/ch7/os/task/action/index.html index 974a4f17..266c4826 100644 --- a/ch7/os/task/action/index.html +++ b/ch7/os/task/action/index.html @@ -4,7 +4,7 @@
-

Module os::task::action

source · []

Structs

+

Module os::task::action

source · []

Structs

Action for a signal

\ No newline at end of file diff --git a/ch7/os/task/action/struct.SignalAction.html b/ch7/os/task/action/struct.SignalAction.html index 6db583c4..6d66ce71 100644 --- a/ch7/os/task/action/struct.SignalAction.html +++ b/ch7/os/task/action/struct.SignalAction.html @@ -4,15 +4,15 @@
#[repr(C)]
pub struct SignalAction { +

Struct os::task::action::SignalAction

source · []
#[repr(C)]
pub struct SignalAction { pub handler: usize, pub mask: SignalFlags, }
Expand description

Action for a signal

-

Fields

handler: usizemask: SignalFlags

Trait Implementations

Returns a copy of the value. Read more

+

Fields

handler: usizemask: SignalFlags

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

-

Returns the “default value” for a type. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Formats the value using the given formatter. Read more

+

Returns the “default value” for a 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.

diff --git a/ch7/os/task/action/struct.SignalActions.html b/ch7/os/task/action/struct.SignalActions.html index e1810131..93b7b1c5 100644 --- a/ch7/os/task/action/struct.SignalActions.html +++ b/ch7/os/task/action/struct.SignalActions.html @@ -4,11 +4,11 @@
pub struct SignalActions {
+    

Struct os::task::action::SignalActions

source · []
pub struct SignalActions {
     pub table: [SignalAction; 32],
-}

Fields

table: [SignalAction; 32]

Trait Implementations

Returns a copy of the value. Read more

+}

Fields

table: [SignalAction; 32]

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

-

Returns the “default value” for a type. Read more

+

Returns the “default value” for a 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/ch7/src/os/boards/qemu.rs.html b/ch7/src/os/boards/qemu.rs.html index 13672cff..fac00b73 100644 --- a/ch7/src/os/boards/qemu.rs.html +++ b/ch7/src/os/boards/qemu.rs.html @@ -8,13 +8,11 @@ 3 4 5 -6
pub const CLOCK_FREQ: usize = 12500000;
 
 pub const MMIO: &[(usize, usize)] = &[(0x10001000, 0x1000)];
 
 pub type BlockDeviceImpl = crate::drivers::block::VirtIOBlock;
-
 
\ No newline at end of file diff --git a/ch7/src/os/config.rs.html b/ch7/src/os/config.rs.html index 863044c7..11bb72e1 100644 --- a/ch7/src/os/config.rs.html +++ b/ch7/src/os/config.rs.html @@ -16,7 +16,6 @@ 11 12 13 -14
#[allow(unused)]
 
 pub const USER_STACK_SIZE: usize = 4096 * 2;
@@ -30,7 +29,6 @@
 pub const TRAP_CONTEXT: usize = TRAMPOLINE - PAGE_SIZE;
 
 pub use crate::board::{CLOCK_FREQ, MMIO};
-
 
\ No newline at end of file diff --git a/ch7/src/os/drivers/block/mod.rs.html b/ch7/src/os/drivers/block/mod.rs.html index 3b38b5c5..bdff2da9 100644 --- a/ch7/src/os/drivers/block/mod.rs.html +++ b/ch7/src/os/drivers/block/mod.rs.html @@ -36,13 +36,13 @@
mod sdcard;
 mod virtio_blk;
 
-pub use virtio_blk::VirtIOBlock;
 pub use sdcard::SDCardWrapper;
+pub use virtio_blk::VirtIOBlock;
 
+use crate::board::BlockDeviceImpl;
 use alloc::sync::Arc;
 use easy_fs::BlockDevice;
 use lazy_static::*;
-use crate::board::BlockDeviceImpl;
 
 lazy_static! {
     pub static ref BLOCK_DEVICE: Arc<dyn BlockDevice> = Arc::new(BlockDeviceImpl::new());
diff --git a/ch7/src/os/fs/stdio.rs.html b/ch7/src/os/fs/stdio.rs.html
index 4e971d3c..15373c99 100644
--- a/ch7/src/os/fs/stdio.rs.html
+++ b/ch7/src/os/fs/stdio.rs.html
@@ -68,7 +68,7 @@
 
use super::File;
 use crate::mm::UserBuffer;
 use crate::sbi::console_getchar;
-use crate::task::{suspend_current_and_run_next,current_add_signal,SignalFlags,};
+use crate::task::{current_add_signal, suspend_current_and_run_next, SignalFlags};
 
 pub struct Stdin;
 
diff --git a/ch7/src/os/mm/memory_set.rs.html b/ch7/src/os/mm/memory_set.rs.html
index 9ce4aa24..9df097fb 100644
--- a/ch7/src/os/mm/memory_set.rs.html
+++ b/ch7/src/os/mm/memory_set.rs.html
@@ -395,12 +395,6 @@
 390
 391
 392
-393
-394
-395
-396
-397
-398
 
use super::{frame_alloc, FrameTracker};
 use super::{PTEFlags, PageTable, PageTableEntry};
 use super::{PhysAddr, PhysPageNum, VirtAddr, VirtPageNum};
@@ -776,27 +770,21 @@
     let mid_text: VirtAddr = ((stext as usize + etext as usize) / 2).into();
     let mid_rodata: VirtAddr = ((srodata as usize + erodata as usize) / 2).into();
     let mid_data: VirtAddr = ((sdata as usize + edata as usize) / 2).into();
-    assert!(
-        !kernel_space
-            .page_table
-            .translate(mid_text.floor())
-            .unwrap()
-            .writable(),
-    );
-    assert!(
-        !kernel_space
-            .page_table
-            .translate(mid_rodata.floor())
-            .unwrap()
-            .writable(),
-    );
-    assert!(
-        !kernel_space
-            .page_table
-            .translate(mid_data.floor())
-            .unwrap()
-            .executable(),
-    );
+    assert!(!kernel_space
+        .page_table
+        .translate(mid_text.floor())
+        .unwrap()
+        .writable(),);
+    assert!(!kernel_space
+        .page_table
+        .translate(mid_rodata.floor())
+        .unwrap()
+        .writable(),);
+    assert!(!kernel_space
+        .page_table
+        .translate(mid_data.floor())
+        .unwrap()
+        .executable(),);
     println!("remap_test passed!");
 }
 
diff --git a/ch7/src/os/syscall/mod.rs.html b/ch7/src/os/syscall/mod.rs.html index b119c938..d388d2ca 100644 --- a/ch7/src/os/syscall/mod.rs.html +++ b/ch7/src/os/syscall/mod.rs.html @@ -51,6 +51,10 @@ 46 47 48 +49 +50 +51 +52
const SYSCALL_DUP: usize = 24;
 const SYSCALL_OPEN: usize = 56;
 const SYSCALL_CLOSE: usize = 57;
@@ -88,7 +92,11 @@
         SYSCALL_EXIT => sys_exit(args[0] as i32),
         SYSCALL_YIELD => sys_yield(),
         SYSCALL_KILL => sys_kill(args[0], args[1] as i32),
-        SYSCALL_SIGACTION => sys_sigaction(args[0] as i32, args[1] as *const SignalAction, args[2] as *mut SignalAction),
+        SYSCALL_SIGACTION => sys_sigaction(
+            args[0] as i32,
+            args[1] as *const SignalAction,
+            args[2] as *mut SignalAction,
+        ),
         SYSCALL_SIGPROCMASK => sys_sigprocmask(args[0] as u32),
         SYSCALL_SIGRETURN => sys_sigretrun(),
         SYSCALL_GET_TIME => sys_get_time(),
diff --git a/ch7/src/os/syscall/process.rs.html b/ch7/src/os/syscall/process.rs.html
index 619acfaa..7507c0d2 100644
--- a/ch7/src/os/syscall/process.rs.html
+++ b/ch7/src/os/syscall/process.rs.html
@@ -189,11 +189,18 @@
 184
 185
 186
+187
+188
+189
+190
+191
+192
+193
 
use crate::fs::{open_file, OpenFlags};
 use crate::mm::{translated_ref, translated_refmut, translated_str};
 use crate::task::{
     add_task, current_task, current_user_token, exit_current_and_run_next, pid2task,
-    suspend_current_and_run_next, SignalFlags, SignalAction, MAX_SIG,
+    suspend_current_and_run_next, SignalAction, SignalFlags, MAX_SIG,
 };
 use crate::timer::get_time_ms;
 use alloc::string::String;
@@ -342,15 +349,22 @@
 }
 
 fn check_sigaction_error(signal: SignalFlags, action: usize, old_action: usize) -> bool {
-    if action == 0 || old_action == 0 || signal == SignalFlags::SIGKILL ||
-        signal == SignalFlags::SIGSTOP {
+    if action == 0
+        || old_action == 0
+        || signal == SignalFlags::SIGKILL
+        || signal == SignalFlags::SIGSTOP
+    {
         true
     } else {
         false
     }
 }
 
-pub fn sys_sigaction(signum: i32, action: *const SignalAction, old_action: *mut SignalAction) -> isize {
+pub fn sys_sigaction(
+    signum: i32,
+    action: *const SignalAction,
+    old_action: *mut SignalAction,
+) -> isize {
     let token = current_user_token();
     if let Some(task) = current_task() {
         let mut inner = task.inner_exclusive_access();
diff --git a/ch7/src/os/task/action.rs.html b/ch7/src/os/task/action.rs.html
index 20696c65..171f2160 100644
--- a/ch7/src/os/task/action.rs.html
+++ b/ch7/src/os/task/action.rs.html
@@ -34,23 +34,21 @@
 29
 30
 31
-32
 
use crate::task::{SignalFlags, MAX_SIG};
 
-
 /// Action for a signal
 #[repr(C)]
 #[derive(Debug, Clone, Copy)]
 pub struct SignalAction {
-    pub handler: usize, 
-    pub mask: SignalFlags
+    pub handler: usize,
+    pub mask: SignalFlags,
 }
 
 impl Default for SignalAction {
     fn default() -> Self {
         Self {
             handler: 0,
-            mask: SignalFlags::from_bits(40).unwrap()
+            mask: SignalFlags::from_bits(40).unwrap(),
         }
     }
 }
diff --git a/ch7/src/os/task/task.rs.html b/ch7/src/os/task/task.rs.html
index 1d5b6a6a..07c9ea13 100644
--- a/ch7/src/os/task/task.rs.html
+++ b/ch7/src/os/task/task.rs.html
@@ -247,8 +247,8 @@
 242
 243
 244
-
use super::{TaskContext, SignalActions};
-use super::{pid_alloc, KernelStack, PidHandle, SignalFlags};
+
use super::{pid_alloc, KernelStack, PidHandle, SignalFlags};
+use super::{SignalActions, TaskContext};
 use crate::config::TRAP_CONTEXT;
 use crate::fs::{File, Stdin, Stdout};
 use crate::mm::{translated_refmut, MemorySet, PhysPageNum, VirtAddr, KERNEL_SPACE};
@@ -288,7 +288,7 @@
     pub killed: bool,
     // if the task is frozen by a signal
     pub frozen: bool,
-    pub trap_ctx_backup: Option<TrapContext>
+    pub trap_ctx_backup: Option<TrapContext>,
 }
 
 impl TaskControlBlockInner {
@@ -356,7 +356,7 @@
                     signal_actions: SignalActions::default(),
                     killed: false,
                     frozen: false,
-                    trap_ctx_backup: None
+                    trap_ctx_backup: None,
                 })
             },
         };
@@ -465,7 +465,7 @@
                     signal_actions: parent_inner.signal_actions.clone(),
                     killed: false,
                     frozen: false,
-                    trap_ctx_backup: None
+                    trap_ctx_backup: None,
                 })
             },
         });
diff --git a/ch7/src/os/trap/mod.rs.html b/ch7/src/os/trap/mod.rs.html
index 6d4e3c6f..f9367c53 100644
--- a/ch7/src/os/trap/mod.rs.html
+++ b/ch7/src/os/trap/mod.rs.html
@@ -138,7 +138,7 @@
 use crate::syscall::syscall;
 use crate::task::{
     check_signals_error_of_current, current_add_signal, current_trap_cx, current_user_token,
-    exit_current_and_run_next, suspend_current_and_run_next, SignalFlags, handle_signals,
+    exit_current_and_run_next, handle_signals, suspend_current_and_run_next, SignalFlags,
 };
 use crate::timer::set_next_trigger;
 use core::arch::{asm, global_asm};