-
Notifications
You must be signed in to change notification settings - Fork 17
Draft: Try and switch to Naked Functions #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thejpster
wants to merge
13
commits into
rust-embedded:main
Choose a base branch
from
thejpster:naked-functions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
1704d59 to
5dee966
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ported everything to naked functions, only to find two issues:
#[instruction_set(arm::xxx)](while you can use.armand.thumbin aglobal_asm!block)So this is draft until MSRV catches up.
Includes #108 and #109 and #110