Skip to content

Conversation

@thejpster
Copy link
Contributor

I ported everything to naked functions, only to find two issues:

So this is draft until MSRV catches up.

Includes #108 and #109 and #110

@thejpster thejpster mentioned this pull request Feb 1, 2026
thejpster and others added 13 commits February 1, 2026 14:06
Also relies on all the targets having thumb-interworking enabled.
Thanks, macOS :/
You can't depend on the flags because they vary depending on what the
machine code does.
They were created before I rebased on main, which had changes to the
example programs.
I went with:

* .section
* .arm or .thumb
* .global
* .type
* label
* code

This fixes the smp_test built for thumb mode, which was missing a .arm
directive (and the start-up code doesn't work in thumb mode).
Targets added in rust-lang/rust#150138. Tested with local build of rustc.

Will fail with the versions of nightly rust specified in the CI config. Need to wait for 2025-01-26 to come out.
thumbv6-none-eabi isn't tested because it requires a new compiler-builtins that isn't upstream yet.
This involves stacking the registers in the opposite order, so that
r0-r3 are stacked at the lowest addresses (and that any stack alignment
padding is stored above them).

I also took the opportunity to move the integer register push/pop
code into the asm routines. This meant we could avoid stacking a couple
of registers and speed up the routines. It also meant it was a bit
easier to ensure the frame was stacked after the AAPCS stack padding
and hence in a known location.

This commit also add svc1!, svc2!, svc3! and svc4! macros for passing
arguments to syscall. They have to be macros because the syscall numbe
goes into the instruction as a literal and cannot come from a function
call.
The QEMU test run with nightly which has thumb-interworking set for all the targets. Stable (and MSRV) do not, so this cannot be merged until our MSRV is updated. Until then we just cannot use naked functions.
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