1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-20 21:18:26 +02:00

Explain entry point and entry.S.

This commit is contained in:
Andrew Walbran 2023-04-05 14:16:13 +01:00
parent 2e94a80d9d
commit b85c893390
2 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,8 @@ bytes.
<details>
* As in the [inline assembly](../inline-assembly.md) example, this `main` function is called from our
entry point code in `entry.S`. See the speaker notes there for details.
* Run the example in QEMU with `make qemu` under `src/bare-metal/aps/examples`.
</details>

View File

@ -17,6 +17,13 @@ to make an <abbr title="hypervisor call">HVC</abbr> to tell the firmware to powe
* The `0 => _` syntax means initialise the register to 0 before running the inline assembly code,
and ignore its contents afterwards. We need to use `inout` rather than `in` because the call could
potentially clobber the contents of the registers.
* This `main` function needs to be `#[no_mangle]` and `extern "C"` because it is called from our
entry point in `entry.S`.
* `_x0``_x3` are the values of registers `x0``x3`, which are conventionally used by the bootloader
to pass things like a pointer to the device tree. According to the standard aarch64 calling
convention (which is what `extern "C"` specifies to use), registers `x0``x7` are used for the
first 8 arguments passed to a function, so `entry.S` doesn't need to do anything special except
make sure it doesn't change these registers.
* Run the example in QEMU with `make qemu_psci` under `src/bare-metal/aps/examples`.
</details>