Skip to content

Support aarch32 without requiring codegen flags - #33

Merged
qwandor merged 1 commit into
google:mainfrom
nspin:pr/inst-workaround
May 28, 2026
Merged

qwandor merged 1 commit into
google:mainfrom
nspin:pr/inst-workaround

Conversation

@nspin

@nspin nspin commented May 20, 2026

Copy link
Copy Markdown
Contributor

As noted in #10, for aarch32, using the hvc and smc instructions in asm!() requires -C target-feature=+virtualization,+trustzone. By replacing hvc #0 and smc #0 with their corresponding opcodes (one instance each), we can support aarch32 without requiring these codegen flags.

This workaround, of course, comes at the cost of making those two lines of code more opaque. Up to the maintainers whether they think that's worth improving this crate's ease of use.

My use case is for a bootloader I'm shipping in source form as part of https://github.com/seL4/rust-sel4. For my use case, requiring downstream users to supply that -C argument to rustc via RUSTFLAGS isn't worth the benefits of using this crate in my bootloader's implementation.

For aarch32, using the 'hvc' and 'smc' instructions in 'asm!()' requires
'-C target-feature=+virtualization,+trustzone'. By replacing 'hvc #0'
and 'smc #0' with their corresponding opcodes (one instance each), we
can support aarch32 without requiring these codegen flags.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
@google-cla

google-cla Bot commented May 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@qwandor
qwandor merged commit 1f11dbc into google:main May 28, 2026
3 checks passed
nspin added a commit to nspin/rust-sel4 that referenced this pull request Jul 17, 2026
nspin added a commit to nspin/rust-sel4 that referenced this pull request Jul 17, 2026
nspin added a commit to nspin/rust-sel4 that referenced this pull request Jul 17, 2026
nspin added a commit to nspin/rust-sel4 that referenced this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants