Rollup merge of #90690 - solid-rs:fix-kmc-solid-asm-const, r=Mark-Simulacrum

kmc-solid: Avoid the use of `asm_const`

This PR removes the use of [the now-separated-out `asm_const` compiler feature][1] in `std::sys::solid` to fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

[1]: https://github.com/rust-lang/rust/pull/90348
This commit is contained in:
Matthias Krüger 2021-11-10 06:02:54 +01:00 committed by GitHub
commit 5bc09362dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,17 +4,15 @@ mod fs;
pub mod sockets; pub mod sockets;
pub use self::fs::*; pub use self::fs::*;
pub const SOLID_BP_PROGRAM_EXITED: usize = 15;
pub const SOLID_BP_CSABORT: usize = 16;
#[inline(always)] #[inline(always)]
pub fn breakpoint_program_exited(tid: usize) { pub fn breakpoint_program_exited(tid: usize) {
unsafe { unsafe {
match () { match () {
// SOLID_BP_PROGRAM_EXITED = 15
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
() => asm!("bkpt #{}", const SOLID_BP_PROGRAM_EXITED, in("r0") tid), () => asm!("bkpt #15", in("r0") tid),
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
() => asm!("hlt #{}", const SOLID_BP_PROGRAM_EXITED, in("x0") tid), () => asm!("hlt #15", in("x0") tid),
} }
} }
} }
@ -23,10 +21,11 @@ pub fn breakpoint_program_exited(tid: usize) {
pub fn breakpoint_abort() { pub fn breakpoint_abort() {
unsafe { unsafe {
match () { match () {
// SOLID_BP_CSABORT = 16
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
() => asm!("bkpt #{}", const SOLID_BP_CSABORT), () => asm!("bkpt #16"),
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
() => asm!("hlt #{}", const SOLID_BP_CSABORT), () => asm!("hlt #16"),
} }
} }
} }