Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ac3ea0e

Browse files
Tutorial 02: update chinese translate. (#175)
1 parent a952d6d commit ac3ea0e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

‎02_runtime_init/README.CN.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@
22

33
## tl;dr
44

5-
我们拓展了`boot.S`,在第一次启动的时候调用Rust代码。在Rust的代码中先清零了[bss] section,然后通过调用`panic()`挂起CPU。再次运行`make qemu`看看新增加的代码是怎么运行的。
5+
- 我们拓展了`boot.S`,在第一次启动的时候调用Rust代码。
6+
在跳转到rust代码前,对运行时进行了一些初始化工作。
7+
- Rust通过调用`panic()`挂起CPU。
8+
- 再次运行`make qemu`看看新增加的代码是怎么运行的。
69

710
## 值得注意的变化
811

9-
- 链接脚本(linker script)中有了更多的section。
10-
- `.rodata`, `.data`
11-
- `.bss`
12-
- `_start()`:
13-
- 当核心不是`core0`第0号核心的时候,挂起该CPU核心。
14-
- `core0`会调用Rust的函数`runtime_init()`
15-
- `runtime_init.rs`内的`runtime_init()`
16-
- 清零了`.bss` section.
17-
- 它调用了`kernel_init()`, 这个函数又调用了`panic!()`, panic函数最终把`core0`和其他核心一样挂起了。
12+
- 链接脚本(linker script)中的变化:
13+
- 新程序段(sections): `.rodata`, `.got`, `.data`, `.bss`.
14+
- 使用一个独立的位置(`.text._start_arguments`)来保存`_start()`引导函数所使用的参数。
15+
- `_start()` in `_arch/__arch_name__/cpu/boot.s`:
16+
1. 当核心不是`core0`第0号核心的时候,挂起该CPU核心。
17+
1. 通过清零`.bss`程序段来初始化`DRAM`.
18+
1. 初始化堆栈指针(`stack pointer`).
19+
1. 跳转到`arch/__arch_name__/cpu/boot.rs`文件中定义的`_start_rust()`函数
20+
- `_start_rust()`:
21+
1. 它调用了`kernel_init()`, 这个函数又调用了`panic!()`, panic函数最终把`core0`和其他核心一样挂起了。
22+
- 目前依赖 [aarch64-cpu] 程序库, 这个库零成本的包装了处理 CPU 资源时的"不安全"部分。
23+
- 详细请参考 `_arch/__arch_name__/cpu.rs`.
1824

1925
[bss]: https://en.wikipedia.org/wiki/.bss
26+
[aarch64-cpu]: https://github.com/rust-embedded/aarch64-cpu
2027

2128
## 相比之前的变化(diff)
2229
请检查[英文版本](README.md#diff-to-previous),这是最新的。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /