-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for asm_const #93332
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Is it possible that this may not actually be blocked on inline_const? AIUI, the concern was that stabilizing asm_const would expose the semantics of inline_const to stable, so any change to the semantics of the yet-unstable inline_const would potentially break stable users of asm_const. But AFAICT there are no more foreseen semantic changes coming to inline_const, and the only remaining question is a syntactic one, specifically with regard to how macros would consume |
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit adds initial paging support for aarch64. This implementation creates identity mapping translation tables for Cloud Hypervisor. The most of paging implementation is based on [1]. It also introduces use of `asm_const` [2] to parameterize FDT base address and stack base address. [1] https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials/tree/master/10_virtual_mem_part1_identity_mapping [2] rust-lang/rust#93332 Signed-off-by: Akira Moroo <retrage01@gmail.com>
Any progress on this issue? We are working in a project were it is necessary, and the stabilization is important for future use in productive code. Any forms we can contribute to the stabilization of asm_const? |
|
#121099 is probably a blocker, a trivial to encounter ICE |
I think this should be unblocked since |
I suggest we can push forward on stabilization, since inline_const has been stabilized a short period of time ago. Feature asm_const is useful on bare-metal development like system, kernel development, bootloader, firmware and embedded Rust etc. |
👍 for pushing forwards with this. Could we get a brief stabilization report on the current state of this and whether there's any other blocker to stabilization? (Please tag this I-lang-nominated when that stabilization report is available.) I'm happy to start an FCP as soon as that happens. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
We discussed this in today's lang meeting and I wanted to document the reasons for allowing
An example: asm!(
"mov {tmp}, {x}",
"shl {tmp}, {one}",
"shl {x}, {two}",
"add {x}, {tmp}",
x = inout(reg) x,
tmp = out(reg) _,
one = const 1,
two = const 1 + 1,
thing = in(reg) 2 * f(), // already valid.
); Allowing arbitrary string substitution (including, e.g., in the middle of a label like @rfcbot reviewed |
blocked on stabilisation of inline_const because it shares a lot of the same issue (e.g. post-mono errors)
So in MIR is this represented the same way, and added to required_consts like inline const?
|
Looks like yes these are normal consts: rust/compiler/rustc_middle/src/mir/visit.rs Lines 595 to 601 in e6b2b76
|
Is there any reason this couldn't eventually be extended to take strings rather than just integers? This would be nice for creating named functions. const FN_NAME: &str = "foo";
const FN_IDX: u32 = 10;
// works
core::arch::global_asm!(
".global lab_{label}"
"lab_{label}:",
"ret",
label = const FN_IDX
);
// does not work
core::arch::global_asm!(
".global lab_{label}"
"lab_{label}:",
"ret",
label = const FN_NAME
); |
Good point. If we want to reserve the ability to do that in the future then we need to tweak type inference a bit to stop constraining const operand to integers, |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@nbdd0121 is that a change that would need to happen now before stabilization, or would it be part of a later update allowing const str support? |
…Amanieu Stabilize `asm_const` tracking issue: rust-lang#93332 reference PR: rust-lang/reference#1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`
Rollup merge of rust-lang#128570 - folkertdev:stabilize-asm-const, r=Amanieu Stabilize `asm_const` tracking issue: rust-lang#93332 reference PR: rust-lang/reference#1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`
@Amanieu Can this be closed now? |
Stabilize `asm_const` tracking issue: rust-lang/rust#93332 reference PR: rust-lang/reference#1556 this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet. r? `@ghost`
The feature gate for the issue is
#![feature(asm_const)]
.Summary
This feature adds a
const <expr>
operand type toasm!
andglobal_asm!
.<expr>
must be an integer constant expression.Status
Blocked on the stabilization of inline consts (#76001).The text was updated successfully, but these errors were encountered: