Skip to content

Comments

Use naked functions#22

Merged
qwandor merged 2 commits intogoogle:mainfrom
epilys:naked_functions
Aug 19, 2025
Merged

Use naked functions#22
qwandor merged 2 commits intogoogle:mainfrom
epilys:naked_functions

Conversation

@epilys
Copy link
Contributor

@epilys epilys commented Aug 18, 2025

Naked functions were stabilised in 1.88.0 0, use them for entry.S and dummy_enable_mmu.S code.

This will make it easier for extending entry code with compile-time
options in the future such as PR #20

Signed-off-by: Manos Pitsidianakis manos.pitsidianakis@linaro.org

@epilys
Copy link
Contributor Author

epilys commented Aug 18, 2025

@qwandor this change will make it easier to do cfg checks for features in #20, but it has the disadvantage of requiring rust-version = "1.88.0", I don't know if that's acceptable for this package.

Copy link
Collaborator

@qwandor qwandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This looks like it should make things easier to maintain in future.

#[unsafe(link_section = ".init")]
#[unsafe(export_name = "enable_mmu")]
pub extern "C" fn enable_mmu() {
core::arch::naked_asm!("ret")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a use statement for naked_asm at the top of the file rather than using the full path every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it in since I moved the entry code to its own module and this is the only naked_asm usecase in lib.rs. If I added a use for it, it'd have to be guarded with #[cfg(not(feature = "initial-pagetable"))] to prevent an unused import lint

@epilys epilys requested a review from qwandor August 18, 2025 18:04
epilys added 2 commits August 18, 2025 21:29
Naked functions were stabilised in 1.88.0 [0], use them for entry.S
code.

This will make it easier for extending entry code with compile-time
options in the future.

[0]: https://blog.rust-lang.org/2025/07/03/stabilizing-naked-functions/

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
@epilys epilys requested a review from qwandor August 18, 2025 18:32
@qwandor qwandor merged commit 496476e into google:main Aug 19, 2025
3 checks passed
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