It seems that whatever bug or config mistake gave us .got entries back then has
since been resolved. Also add a sanity check to recognize should this happen
again.
The LLVM assembler apparently causes the .equ directive to create symbols
instead of just a local and temporary variable.
Work around this by using const operands with global_asm!.
This patch refactors big chunks of the memory subsystem code.
Most of all, it does away with the the design being based around the raw pointer
type "*const Page". While raw pointers to an actual page seemed like a
compelling idea, in practice it turned out difficult. Rust feels a bit
inconsistent with respect to raw pointers. While it is safe to create them out
of nowhere (only dereferencing is unsafe), it gets weird when multi-threading
comes into picture.
For example, wrapping them into synchronization primitives caused issues because
they don't implement Send. For this reason, we switch to the PageAddress type
which is based on usize, which makes things a lot easier.
Other changes/benefits include:
- Gets rid of unsafe code in the removed PageSlice type.
- Decouple the translation table code and MMIO VA allocation.
- For the translation table tool, make better use of what the ELF format already
provides with respect to memory segmentation and translation. For example, the
tool now queries the ELF file for VA->PA translations and other segment
attributes. This has also the added benefit of reduced BSP code and more
generic code in the tool.
- Packs rbelftools in the Docker image now (used by translation table tool).
- In tutorials 14/15/16, rearrange the PA and VA layout.
It is too risky to rely on the compiler to not insert any operations using the
stack.
Having a stack-setting call in Rust using the cortex-a crate as the first action
in a Rust-only _start() function does not work if you're subsequently using the
stack, because the compiler often inserts the operations to make room on the
stack to prepare a function call BEFORE the call to set the stack, which crashes
the boot process.
Hence, keep on using a small piece of assembly boot code throughout.
- Don't wildcard-import from arch modules. Make it explicit.
- Put translation table code into its own module.
- Put boot code in boot.rs instead of cpu.rs
- Other minor changes, most memory subsystem.