-
Notifications
You must be signed in to change notification settings - Fork 109
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
WIP: Decommission async-support #170
Conversation
I'm all for this! Unfortunately I can't comment about the ARM assembly (I just don't know). It seems strange that a register is deprecated. If the assembly can be written in Rust I see no reason not to do that. For the RISC-V assembly I guess the ecalls could be written in Rust, but as we are already in an assembly block it seems pretty straight forward to just do it all together. I assume the ARM assembly is the same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please elaborate on "the R7 register in ARM has been deprecated". That doesn't make sense to me.
The entry point cannot be written purely in Rust, although it can be external assembly rather than inline assembly. I was planning to (eventually) rework the entry point to look more like the entry point here: https://github.com/tock/design-explorations/blob/master/size_comparison/no_futures/src/entry_point.rs. That entry point has a much shorter assembly section. The one thing I would change from the size_comparison entry point is I would use .rt_header to convey data_flash_start
and data_ram_start
rather than EmptySymbol
.
core/src/syscalls/platform.rs
Outdated
/// Yielding inside a callback conflicts with Rust's safety guarantees. For example, | ||
/// a FnMut closure could be triggered multiple times making a &mut a shared reference. | ||
/// | ||
/// Yielding in the main function should be safe. Nevertheless, yielding manually is not required as this is already achieved by the `async` runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think line 9 is well beyond 80 characters, please wrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can wrap the line but at least for me (I am using an IDE with line wrapping) it produces more harm than benefit. It's not even enforced by rustfmt
, so I don't think it's an official standard or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most Rust code wraps comments at 80 characters, and this repository is no different. rustfmt
doesn't automatically wrap comments because reliably wrapping comments well is very difficult (see the examples at rust-lang/rustfmt#535). It is best to do it in your editor rather than with rustfmt
, so you can catch mistakes.
Please wrap the comment at 80 characters.
Maybe the word deprecated isn't correct in this case. However, I get the message |
Why is that so? In the past, the entry point was in pure Rust except for some stack pointer operations. |
Ah, it looks like r7 is used for the frame pointer on Thumb: https://reviews.llvm.org/D49727. Because _start is a naked function, I don't think the clobbers actually need to be correct, so we can remove "r7" without changing anything else. |
I think the assembly in the entry point at https://github.com/tock/design-explorations/blob/master/size_comparison/no_futures/src/entry_point.rs is pretty minimal. I do the following in that assembly:
Is there anything else you think can be Rust? EDIT: |
3c2268e
to
e1dbe7d
Compare
This helped. Thanks! |
I meant to improve the r7 register fix, not the entire PR.
2398fd7
to
9b7120e
Compare
Looks good to me, modulo waiting for a working toolchain with |
What is still WIP here? |
We need to wait for a nightly containing |
9b7120e
to
2ff19f0
Compare
2ff19f0
to
9c9cb52
Compare
Overview
I am trying to remove the
async-support
crate as it should no longer be required due to the merge of rust-lang/rust/pull/69033 intolibcore
.Besides the
async-support
crate removal the PR contains some commits from my technical debt backlog.Obstacles
The most recent nightlies are not shipped with our static code analysis tooling (
rustfmt
/clippy
). The solution, however, is easy: Wait until they reappear in a newer nightly.Questions / Ideas (Outdated)
Can someone explain why assembly is used at all? I am aware that certain operations like setting the stack pointer aren't possible without it. But the remaining code could be written in pure Rust. In fact, it has been written in pure Rust in the past.
As people care about reliability and certifiability, I propose to reduce the fraction of hard-to-review and possibly-breaking ASM code to a minimal amount possible.