Skip to content
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

🐛 fix stack alignment upon first procedure entry #1021

Merged
merged 9 commits into from
Sep 15, 2024

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Sep 15, 2024

The RISC-V ABI / Calling convention says:

The stack grows downwards (towards lower addresses) and the stack pointer shall be aligned to a 128-bit boundary upon procedure entry.

This PR fixes the initial alignment of the stack (make it 128-bit-aligned) in crt0 before entering the very first procedure, which is main.

This is quite experimental and needs further testing.

Fixing #1020.

@stnolting stnolting added bug Something isn't working as expected SW Software-related labels Sep 15, 2024
@stnolting stnolting self-assigned this Sep 15, 2024
@stnolting stnolting added the experimental Experimental feature label Sep 15, 2024
@stnolting stnolting linked an issue Sep 15, 2024 that may be closed by this pull request
@stnolting stnolting marked this pull request as ready for review September 15, 2024 19:57
@stnolting stnolting changed the title 🐛 fix stack alignment upon procedure entry 🐛 fix stack alignment upon first procedure entry Sep 15, 2024
@stnolting stnolting merged commit 6c66bb1 into main Sep 15, 2024
10 checks passed
@stnolting stnolting deleted the stack_alignment_fix branch September 15, 2024 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected experimental Experimental feature SW Software-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Printing floats/doubles with "printf" does not work
1 participant