Skip to content

kmc-solid: Avoid the use of asm_const #90690

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

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions library/std/src/sys/solid/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ mod fs;
pub mod sockets;
pub use self::fs::*;

pub const SOLID_BP_PROGRAM_EXITED: usize = 15;
pub const SOLID_BP_CSABORT: usize = 16;

#[inline(always)]
pub fn breakpoint_program_exited(tid: usize) {
unsafe {
match () {
// SOLID_BP_PROGRAM_EXITED = 15
#[cfg(target_arch = "arm")]
() => asm!("bkpt #{}", const SOLID_BP_PROGRAM_EXITED, in("r0") tid),
() => asm!("bkpt #15", in("r0") tid),
#[cfg(target_arch = "aarch64")]
() => asm!("hlt #{}", const SOLID_BP_PROGRAM_EXITED, in("x0") tid),
() => asm!("hlt #15", in("x0") tid),
}
}
}
Expand All @@ -23,10 +21,11 @@ pub fn breakpoint_program_exited(tid: usize) {
pub fn breakpoint_abort() {
unsafe {
match () {
// SOLID_BP_CSABORT = 16
#[cfg(target_arch = "arm")]
() => asm!("bkpt #{}", const SOLID_BP_CSABORT),
() => asm!("bkpt #16"),
#[cfg(target_arch = "aarch64")]
() => asm!("hlt #{}", const SOLID_BP_CSABORT),
() => asm!("hlt #16"),
}
}
}
Expand Down