From 492b9e2dce835509efa221fbe9807be8dc0ede90 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 08:37:44 +0800 Subject: [PATCH 01/12] update CI --- .github/workflows/main.yml | 9 ++++++++- code/Cargo.toml | 2 +- code/ch01-03/src/object/handle.rs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 000332a..3997edf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,8 @@ jobs: run: | cd code cargo fmt --all -- --check + cd ../ch02-03 + cargo fmt --all -- --check # uses: actions-rs/cargo@v1 # with: # command: fmt @@ -29,6 +31,8 @@ jobs: run: | cd code cargo clippy + cd ../ch02-03 + cargo clippy # uses: actions-rs/cargo@v1 # with: # command: clippy @@ -50,10 +54,11 @@ jobs: run: | cd code cargo build + cd ../ch02-03 + cargo build # uses: actions-rs/cargo@v1 # with: # command: build - test: runs-on: ${{ matrix.os }} strategy: @@ -72,3 +77,5 @@ jobs: run: | cd code cargo test + cd ../ch02-03 + cargo test diff --git a/code/Cargo.toml b/code/Cargo.toml index 94ab6b8..4d425da 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -4,5 +4,5 @@ members = [ "ch01-02", "ch01-03", "ch02-02", - "ch02-03", +# "ch02-03", ] diff --git a/code/ch01-03/src/object/handle.rs b/code/ch01-03/src/object/handle.rs index 592282d..58a0b47 100644 --- a/code/ch01-03/src/object/handle.rs +++ b/code/ch01-03/src/object/handle.rs @@ -1,5 +1,5 @@ // ANCHOR: handle -use super::{DummyObject, KernelObject, Rights}; +use super::{KernelObject, Rights}; use alloc::sync::Arc; /// 内核对象句柄 From 29f901638c0201b62c2f68bbdd07f7df78006254 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 08:40:09 +0800 Subject: [PATCH 02/12] update CI --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3997edf..2a76a17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: run: | cd code cargo fmt --all -- --check - cd ../ch02-03 + cd ch02-03 cargo fmt --all -- --check # uses: actions-rs/cargo@v1 # with: @@ -31,7 +31,7 @@ jobs: run: | cd code cargo clippy - cd ../ch02-03 + cd ch02-03 cargo clippy # uses: actions-rs/cargo@v1 # with: @@ -54,7 +54,7 @@ jobs: run: | cd code cargo build - cd ../ch02-03 + cd ch02-03 cargo build # uses: actions-rs/cargo@v1 # with: @@ -77,5 +77,5 @@ jobs: run: | cd code cargo test - cd ../ch02-03 + cd ch02-03 cargo test From 17688ab3dfcb6b9031596d278f5929847064de4e Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:07:30 +0800 Subject: [PATCH 03/12] cargo fmt passed --- code/ch02-03/object/src/task/thread.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/ch02-03/object/src/task/thread.rs b/code/ch02-03/object/src/task/thread.rs index 20edb89..a8be3c4 100644 --- a/code/ch02-03/object/src/task/thread.rs +++ b/code/ch02-03/object/src/task/thread.rs @@ -10,8 +10,8 @@ use { pin::Pin, task::{Context, Poll, Waker}, }, - trapframe::{UserContext}, spin::Mutex, + trapframe::UserContext, }; pub use self::thread_state::*; @@ -258,7 +258,6 @@ impl Task for Thread { } } - /// A handle to current thread. /// /// This is a wrapper of [`Thread`] that provides additional methods for the thread runner. @@ -397,9 +396,9 @@ pub struct ThreadInfo { mod tests { use super::job::Job; use super::*; + use core::time::Duration; use kernel_hal::timer_now; use kernel_hal::GeneralRegs; - use core::time::Duration; #[test] fn create() { @@ -469,7 +468,6 @@ mod tests { assert_eq!(thread.state(), ThreadState::Dead); } - #[test] fn info() { let root_job = Job::root(); From 83ba5558ffe8a7ef1a84e0cfaa1afe5836ba0f12 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:10:25 +0800 Subject: [PATCH 04/12] cargo test passed --- code/ch01-02/src/object/handle.rs | 3 ++- code/ch01-03/src/object/handle.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/ch01-02/src/object/handle.rs b/code/ch01-02/src/object/handle.rs index 592282d..a36d3df 100644 --- a/code/ch01-02/src/object/handle.rs +++ b/code/ch01-02/src/object/handle.rs @@ -20,7 +20,8 @@ impl Handle { #[cfg(test)] mod tests { use super::*; - + use crate::object::DummyObject; + #[test] fn new_obj_handle() { let obj = DummyObject::new(); diff --git a/code/ch01-03/src/object/handle.rs b/code/ch01-03/src/object/handle.rs index 58a0b47..328fddf 100644 --- a/code/ch01-03/src/object/handle.rs +++ b/code/ch01-03/src/object/handle.rs @@ -20,6 +20,7 @@ impl Handle { #[cfg(test)] mod tests { use super::*; + use crate::object::DummyObject; #[test] fn new_obj_handle() { From 0e0acd623f7ccc6452015cdc8f9d0d43e5d9ae9d Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:15:16 +0800 Subject: [PATCH 05/12] cargo fmt passed --- code/ch01-02/src/object/handle.rs | 1 - code/ch01-03/src/object/handle.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/code/ch01-02/src/object/handle.rs b/code/ch01-02/src/object/handle.rs index a36d3df..aab012d 100644 --- a/code/ch01-02/src/object/handle.rs +++ b/code/ch01-02/src/object/handle.rs @@ -21,7 +21,6 @@ impl Handle { mod tests { use super::*; use crate::object::DummyObject; - #[test] fn new_obj_handle() { let obj = DummyObject::new(); diff --git a/code/ch01-03/src/object/handle.rs b/code/ch01-03/src/object/handle.rs index 328fddf..455a462 100644 --- a/code/ch01-03/src/object/handle.rs +++ b/code/ch01-03/src/object/handle.rs @@ -21,7 +21,6 @@ impl Handle { mod tests { use super::*; use crate::object::DummyObject; - #[test] fn new_obj_handle() { let obj = DummyObject::new(); From 79311feb8e14855cdffc0363f09c19f39b40249e Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:20:55 +0800 Subject: [PATCH 06/12] disable macos-latest for CI (for ch2/thread related tests) --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a76a17..7765b42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, macos-latest] + os: [ubuntu-20.04] +# os: [ubuntu-20.04, macos-latest] steps: - uses: actions/checkout@v2 with: @@ -63,7 +64,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, macos-latest] + os: [ubuntu-20.04] +# os: [ubuntu-20.04, macos-latest] steps: - uses: actions/checkout@v2 with: From 3e894091efeff12be96cfd86d65b5e081475923a Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:34:55 +0800 Subject: [PATCH 07/12] update RADME.md for CI pass info --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8fdc113..fa80da6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # zCore Tutorial +[![CI](https://github.com/rcore-os/zCore-Tutorial/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore-Tutorial/actions) + + ## 仓库目录 * `docs/`: 教学实验指导 From ec189b0f68b4c42965286b58f311c722f64b8135 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 09:38:51 +0800 Subject: [PATCH 08/12] update RADME.md for CI doc deploy info --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa80da6..4134234 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # zCore Tutorial [![CI](https://github.com/rcore-os/zCore-Tutorial/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore-Tutorial/actions) - +[![Docs](https://img.shields.io/badge/docs-alpha-blue)](https://rcore-os.github.io/zCore-Tutorial/) ## 仓库目录 From 7b034148870201b37f50912b055c3f9257223264 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 5 Aug 2021 13:52:20 +0800 Subject: [PATCH 09/12] update CI for doc --- .github/workflows/main.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7765b42..8caee93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,3 +81,25 @@ jobs: cargo test cd ch02-03 cargo test + + doc: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] +# os: [ubuntu-20.04, macos-latest] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-07-27 + components: rust-src + - name: Build docs + run: | + cd code + cargo doc --no-deps --all-features + cd ch02-03 + cargo doc --no-deps --all-features From 9e068ff1498a96cc04f68ae52cccf150359de42f Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Fri, 6 Aug 2021 10:00:13 +0800 Subject: [PATCH 10/12] update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 4134234..d59d136 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,18 @@ mdbook serve docs ``` rustc 1.56.0-nightly (08095fc1f 2021-07-26) ``` + +## 参考 +- https://fuchsia.dev/ + - https://fuchsia.dev/fuchsia-src/concepts/kernel + - https://fuchsia.dev/fuchsia-src/reference/kernel_objects/objects + - https://fuchsia.dev/fuchsia-src/reference/syscalls + - https://github.com/zhangpf/fuchsia-docs-zh-CN/tree/master/zircon + - [许中兴博士演讲:Fuchsia OS 简介](https://xuzhongxing.github.io/201806fuchsia.pdf) + +- 毕设论文 + - [Rust语言操作系统的设计与实现,王润基本科毕设论文,2019](https://github.com/rcore-os/zCore/wiki/files/wrj-thesis.pdf) + - [zCore操作系统内核的设计与实现,潘庆霖本科毕设论文,2020](https://github.com/rcore-os/zCore/wiki/files/pql-thesis.pdf) + +- 开发文档 + - https://github.com/rcore-os/zCore/wiki/documents-of-zcore From a8bd0f95bb984d7269f890225c110fbacf26583e Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Fri, 6 Aug 2021 10:22:48 +0800 Subject: [PATCH 11/12] update README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d59d136..f1df43e 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,14 @@ [![CI](https://github.com/rcore-os/zCore-Tutorial/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore-Tutorial/actions) [![Docs](https://img.shields.io/badge/docs-alpha-blue)](https://rcore-os.github.io/zCore-Tutorial/) +zCore Toturial 的目标是通过`step by step`地建立一个简化的zCore kernel的过程来学习和掌握zCore Kernel的核心概念和对应实现,从而为进一步分析掌握zCore的完整内核打下基础。 + +zCore Toturial 的特点是所有的code都在用户态运行,便于调试和分析。 + ## 仓库目录 * `docs/`: 教学实验指导 -* `zcore`: 操作系统代码 +* `code`: 操作系统代码 ## 实验指导 From aebdd919606648e1f9118dfd43fb05ab645d9c88 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Fri, 6 Aug 2021 11:10:19 +0800 Subject: [PATCH 12/12] update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1df43e..4a15be7 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,6 @@ rustc 1.56.0-nightly (08095fc1f 2021-07-26) - [zCore操作系统内核的设计与实现,潘庆霖本科毕设论文,2020](https://github.com/rcore-os/zCore/wiki/files/pql-thesis.pdf) - 开发文档 - - https://github.com/rcore-os/zCore/wiki/documents-of-zcore + - https://github.com/rcore-os/zCore/wiki/documents-of-zcore + +- 更简单和基础的[rCore-Tutorial v3](https://rcore-os.github.io/rCore-Tutorial-Book-v3/):如果看不懂上面的内容,可以先看看这个教程。