src/bare-metal/aps/exceptions.md
AArch64 defines an exception vector table with 16 entries, for 4 types of exceptions (synchronous, IRQ, FIQ, SError) from 4 states (current EL with SP0, current EL with SPx, lower EL using AArch64, lower EL using AArch32). We implement this in assembly to save volatile registers to the stack before calling into Rust code:
<!-- mdbook-xgettext: skip --># // Copyright 2023 Google LLC
# // SPDX-License-Identifier: Apache-2.0
#
{{#include examples/src/exceptions.rs:exceptions}}
Send and Sync will control what we can share
between them, just like with threads. For example, if we want to share some
value between exception handlers and the rest of the program, and it's Send
but not Sync, then we'll need to wrap it in something like a Mutex and put
it in a static.The assembly code for the exception vector:
<!-- mdbook-xgettext: skip -->{{#include examples/src/exceptions.S:exceptions}}