Skip to content

Commit b5b6058

Browse files
authored
Merge branch 'main' into main
2 parents 688ee48 + 6d53a9a commit b5b6058

File tree

169 files changed

+55833
-4807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+55833
-4807
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ jobs:
1010

1111
steps:
1212
- uses: actions/checkout@v2
13+
with:
14+
submodules: "true"
1315
- uses: actions/setup-python@v2
1416
with:
15-
python-version: "3.8.10"
17+
python-version: "3.10"
1618
- name: Install dependencies
1719
run: pip install -r requirements.txt
1820

1921
- name: build doc
20-
run: make html
22+
run: |
23+
make html
24+
cp scripts/mermaid.js build/html/_static/
2125
2226
- name: create .nojekyll
2327
run: touch build/html/.nojekyll

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build/
33
.idea
44
source/_build/
55
pushall.sh
6+
os-lectures

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "os-lectures"]
2+
path = os-lectures
3+
url = [email protected]:LearningOS/os-lectures.git

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33

44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
6-
SPHINXOPTS ?=
6+
SPHINXOPTS ?= -W
77
SPHINXBUILD ?= sphinx-build
8+
SPHINXAUTOBUILD ?= sphinx-autobuild
89
SOURCEDIR = source
910
BUILDDIR = build
1011

1112
# Put it first so that "make" without argument is like "make help".
1213
help:
1314
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1415

15-
.PHONY: help Makefile deploy
16+
html:
17+
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
18+
@cp scripts/mermaid.js build/html/_static/
19+
20+
.PHONY: help html Makefile deploy liveview
1621

1722
# Catch-all target: route all unknown targets to Sphinx using the new
1823
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
@@ -22,9 +27,14 @@ help:
2227
view:
2328
make html && firefox build/html/index.html
2429

30+
# http://127.0.0.1:8000
31+
liveview:
32+
@$(SPHINXAUTOBUILD) "$(SOURCEDIR)" "$(BUILDDIR)/html"
33+
2534
deploy:
2635
@make clean
2736
@make html
37+
@cp scripts/mermaid.js build/html/_static/
2838
@python3 scripts/fix-comments.py
2939
@rm -rf docs
3040
@cp -r build/html docs

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
# rCore-Tutorial-Book-v3
22
Documentation of rCore-Tutorial version 3 in Chinese.
33

4-
Deployed version can be found [here](https://rcore-os.github.io/rCore-Tutorial-Book-v3/).
4+
## news
55

6-
If you cannot access `github.io` normally due to network problems, please visit the [synchronized version](http://wyfcyx.gitee.io/rcore-tutorial-book-v3) hosted on gitee.
7-
8-
## Todo List
6+
- 2022.07.01 Welcome to JOIN [**Open-Source-OS-Training-Camp-2022 !**](https://learningos.github.io/rust-based-os-comp2022/)
97

10-
- [x] code tree in introduction
11-
- [ ] rust module system in chapter1
12-
- [x] update rustsbi to 0.1.1
8+
## [Deployed Page](https://rcore-os.github.io/rCore-Tutorial-Book-v3/).
139

10+
If you cannot access `github.io` normally due to network problems, please visit the [synchronized version](http://wyfcyx.gitee.io/rcore-tutorial-book-v3) hosted on gitee.
1411

15-
## Deploy docs on [github](https://rcore-os.github.io/rCore-Tutorial-Book-v3/)
12+
## Deploy your own docs
1613

17-
```
18-
$ git checkout deploy
19-
$ git merge main
20-
$ make deploy
21-
$ git check main
14+
```sh
15+
$ FORK https://github.com/rcore-os/rCore-Tutorial-Book-v3.git to YOUR REPO
16+
$ git clone YOUR REPO(e.g. https://github.com/YOUR/rCore-Tutorial-Book-v3.git)
17+
$ cd rCore-Tutorial-Book-v3
18+
$ make html # After that, the generated doc can be found in rCore-Tutorial-Book-v3/build/html
19+
$ # modify the doc
20+
$ git push # or pull request
2221
```

os-lectures

Submodule os-lectures added at 214def5

puppeteerConfigFile.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"executablePath": "/usr/bin/google-chrome"
3+
}

requirements.txt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
alabaster==0.7.12
2-
Babel==2.9.1
3-
certifi==2021.5.30
4-
charset-normalizer==2.0.4
1+
alabaster==0.7.13
2+
Babel==2.11.0
3+
certifi==2022.12.7
4+
charset-normalizer==2.1.1
55
docutils==0.16
6-
idna==3.2
7-
imagesize==1.2.0
6+
idna==3.4
7+
imagesize==1.4.1
88
jieba==0.42.1
9-
Jinja2==3.0.1
10-
MarkupSafe==2.0.1
11-
packaging==21.0
12-
Pygments==2.10.0
13-
pyparsing==2.4.7
14-
pytz==2021.1
15-
requests==2.26.0
16-
snowballstemmer==2.1.0
17-
Sphinx==4.1.2
9+
Jinja2==3.1.2
10+
MarkupSafe==2.1.1
11+
packaging==23.0
12+
Pygments==2.14.0
13+
pyparsing==3.0.9
14+
pytz==2022.7
15+
requests==2.28.2
16+
snowballstemmer==2.2.0
17+
Sphinx==4.3.2
1818
sphinx-comments==0.0.3
19-
sphinx-rtd-theme==0.5.2
20-
sphinx-tabs==3.2.0
19+
sphinx-rtd-theme==1.2.0rc2
20+
sphinx-tabs==3.2
2121
sphinxcontrib-applehelp==1.0.2
2222
sphinxcontrib-devhelp==1.0.2
2323
sphinxcontrib-htmlhelp==2.0.0
2424
sphinxcontrib-jsmath==1.0.1
2525
sphinxcontrib-qthelp==1.0.3
2626
sphinxcontrib-serializinghtml==1.1.5
27-
urllib3==1.26.6
28-
furo==2021.8.31
27+
urllib3==1.26.14
28+
furo==2022.6.21
29+
sphinxcontrib-mermaid==0.7.1
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
7+
jobs:
8+
deploy-doc:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: "true"
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.10"
18+
- name: Install dependencies
19+
run: pip install -r requirements.txt
20+
21+
- name: install chrome
22+
run: apt-get update \
23+
&& apt-get install -y wget gnupg \
24+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
25+
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
26+
&& apt-get update \
27+
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
28+
--no-install-recommends \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
- name: Use Node.js
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: "16.x"
35+
36+
- name: Install dependencies
37+
run: npm install -g @mermaid-js/mermaid-cli
38+
39+
- name: build doc
40+
run: make html
41+
42+
- name: create .nojekyll
43+
run: touch build/html/.nojekyll
44+
45+
- name: Push to gh-pages
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./build/html

scripts/latexpdf.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/source/chapter4/3sv39-implementation-1.rst b/source/chapter4/3sv39-implementation-1.rst
2+
index 8275f627..cf698c0f 100644
3+
--- a/source/chapter4/3sv39-implementation-1.rst
4+
+++ b/source/chapter4/3sv39-implementation-1.rst
5+
@@ -269,13 +269,13 @@ SV39 多级页表的硬件机制
6+
多级页表
7+
-------------------------------
8+
9+
-页表的一种最简单的实现是线性表,也就是按照地址从低到高、输入的虚拟页号从 :math:`0` 开始递增的顺序依次在内存中(我们之前提到过页表的容量过大无法保存在 CPU 中)放置每个虚拟页号对应的页表项。由于每个页表项的大小是 :math:`8` 字节,我们只要知道第一个页表项(对应虚拟页号 :math:`0` )被放在的物理地址 :math:`\text{base_addr}` ,就能直接计算出每个输入的虚拟页号对应的页表项所在的位置。如下图所示:
10+
+页表的一种最简单的实现是线性表,也就是按照地址从低到高、输入的虚拟页号从 :math:`0` 开始递增的顺序依次在内存中(我们之前提到过页表的容量过大无法保存在 CPU 中)放置每个虚拟页号对应的页表项。由于每个页表项的大小是 :math:`8` 字节,我们只要知道第一个页表项(对应虚拟页号 :math:`0` )被放在的物理地址 :math:`\text{base\_addr}` ,就能直接计算出每个输入的虚拟页号对应的页表项所在的位置。如下图所示:
11+
12+
.. image:: linear-table.png
13+
:height: 400
14+
:align: center
15+
16+
-事实上,对于虚拟页号 :math:`i` ,如果页表(每个应用都有一个页表,这里指其中某一个)的起始地址为 :math:`\text{base_addr}` ,则这个虚拟页号对应的页表项可以在物理地址 :math:`\text{base_addr}+8i` 处找到。这使得 MMU 的实现和内核的软件控制都变得非常简单。然而遗憾的是,这远远超出了我们的物理内存限制。由于虚拟页号有 :math:`2^{27}` 种,每个虚拟页号对应一个 :math:`8` 字节的页表项,则每个页表都需要消耗掉 :math:`1\text{GiB}` 内存!应用的数据还需要保存在内存的其他位置,这就使得每个应用要吃掉 :math:`1\text{GiB}` 以上的内存。作为对比,我们的 K210 开发板目前只有 :math:`8\text{MiB}` 的内存,因此从空间占用角度来说,这种线性表实现是完全不可行的。
17+
+事实上,对于虚拟页号 :math:`i` ,如果页表(每个应用都有一个页表,这里指其中某一个)的起始地址为 :math:`\text{base\_addr}` ,则这个虚拟页号对应的页表项可以在物理地址 :math:`\text{base\_addr}+8i` 处找到。这使得 MMU 的实现和内核的软件控制都变得非常简单。然而遗憾的是,这远远超出了我们的物理内存限制。由于虚拟页号有 :math:`2^{27}` 种,每个虚拟页号对应一个 :math:`8` 字节的页表项,则每个页表都需要消耗掉 :math:`1\text{GiB}` 内存!应用的数据还需要保存在内存的其他位置,这就使得每个应用要吃掉 :math:`1\text{GiB}` 以上的内存。作为对比,我们的 K210 开发板目前只有 :math:`8\text{MiB}` 的内存,因此从空间占用角度来说,这种线性表实现是完全不可行的。
18+
19+
线性表的问题在于:它保存了所有虚拟页号对应的页表项,但是高达 :math:`512\text{GiB}` 的地址空间中真正会被应用使用到的只是其中极小的一个子集(本教程中的应用内存使用量约在数十~数百 :math:`\text{KiB}` 量级),也就导致有意义并能在页表中查到实际的物理页号的虚拟页号在 :math:`2^{27}` 中也只是很小的一部分。由此线性表的绝大部分空间其实都是被浪费掉的。
20+

0 commit comments

Comments
 (0)