Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

don't declare _start_rust as a "naked" function #8

Merged
merged 1 commit into from
Aug 10, 2018

Conversation

danc86
Copy link
Contributor

@danc86 danc86 commented Aug 10, 2018

The #[naked] attribute means Rust won't emit instructions to push and
pop a new stack frame. But the assembly routine which calls _start_rust
also doesn't push a new stack frame, so there is no valid stack for this
function.

We probably need a stack frame though, since it's implemented in Rust
and we can't easily ensure that Rust won't try to allocate any local
variables. See #5.

The #[naked] attribute means Rust won't emit instructions to push and
pop a new stack frame. But the assembly routine which calls _start_rust
also doesn't push a new stack frame, so there is no valid stack for this
function.

We probably need a stack frame though, since it's implemented in Rust
and we can't easily ensure that Rust won't try to allocate any local
variables. See rust-embedded#5.
@danc86
Copy link
Contributor Author

danc86 commented Aug 10, 2018

Haven't really tested this yet. When I get home later and have the Hifive to hand, I will check that this fixes the problem for real (namely that we don't trap with an access fault even when _start_rust is calling core::ptr::null like we had before).

@danc86 danc86 requested a review from dvc94ch August 10, 2018 06:31
@dvc94ch dvc94ch merged commit 12fd125 into rust-embedded:master Aug 10, 2018
@dvc94ch
Copy link
Member

dvc94ch commented Aug 10, 2018

Awesome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants