2019-09-25 09:56:41 +00:00
|
|
|
# Tutorial 02 - Runtime Init
|
|
|
|
|
|
|
|
## tl;dr
|
|
|
|
|
2020-03-28 12:27:23 +00:00
|
|
|
We extend `cpu.S` to call into Rust code for the first time. There,we zero the [bss] section before
|
|
|
|
execution is halted with a call to `panic()`. Check out `make qemu` again to see the additional code
|
|
|
|
run.
|
|
|
|
|
|
|
|
## Notable additions
|
2019-09-25 09:56:41 +00:00
|
|
|
|
|
|
|
- More sections in linker script:
|
|
|
|
- `.rodata`, `.data`
|
|
|
|
- `.bss`
|
|
|
|
- `_start()`:
|
|
|
|
- Halt core if core != `core0`.
|
2020-03-28 12:27:23 +00:00
|
|
|
- `core0` jumps to the `runtime_init()` Rust function.
|
2019-12-30 21:31:55 +00:00
|
|
|
- `runtime_init()` in `runtime_init.rs`
|
2019-09-25 09:56:41 +00:00
|
|
|
- Zeros the `.bss` section.
|
2020-03-28 12:27:23 +00:00
|
|
|
- Calls `kernel_init()`, which calls `panic!()`, which eventually halts `core0` as well.
|
2019-09-25 09:56:41 +00:00
|
|
|
|
2019-12-30 23:00:09 +00:00
|
|
|
[bss]: https://en.wikipedia.org/wiki/.bss
|
|
|
|
|
2019-09-25 09:56:41 +00:00
|
|
|
## Diff to previous
|