#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn dmb() {
use core::sync::atomic::{compiler_fence, Ordering};
compiler_fence(Ordering::SeqCst);
unsafe {
core::arch::asm!("dmb", options(nostack, preserves_flags));
}
compiler_fence(Ordering::SeqCst);
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn dsb() {
use core::sync::atomic::{compiler_fence, Ordering};
compiler_fence(Ordering::SeqCst);
unsafe {
core::arch::asm!("dsb", options(nostack, preserves_flags));
}
compiler_fence(Ordering::SeqCst);
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn isb() {
use core::sync::atomic::{compiler_fence, Ordering};
compiler_fence(Ordering::SeqCst);
unsafe {
core::arch::asm!("isb", options(nostack, preserves_flags));
}
compiler_fence(Ordering::SeqCst);
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn nop() {
unsafe { core::arch::asm!("nop", options(nomem, nostack, preserves_flags)) }
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn wfi() {
unsafe { core::arch::asm!("wfi", options(nomem, nostack, preserves_flags)) }
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn wfe() {
unsafe { core::arch::asm!("wfe", options(nomem, nostack, preserves_flags)) }
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn sev() {
unsafe {
core::arch::asm!("sev", options(nomem, nostack, preserves_flags));
}
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn irq_disable() {
unsafe {
core::arch::asm!("cpsid i", options(nomem, nostack, preserves_flags));
}
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub unsafe fn irq_enable() {
unsafe {
core::arch::asm!("cpsie i", options(nomem, nostack, preserves_flags));
}
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn fiq_disable() {
unsafe {
core::arch::asm!("cpsid f", options(nomem, nostack, preserves_flags));
}
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn fiq_enable() {
unsafe {
core::arch::asm!("cpsie f", options(nomem, nostack, preserves_flags));
}
}
#[cfg_attr(not(feature = "check-asm"), inline)]
pub fn core_id() -> u32 {
let r: u32;
unsafe {
core::arch::asm!("MRC p15, 0, {}, c0, c0, 5", out(reg) r, options(nomem, nostack, preserves_flags));
}
r & 0x00FF_FFFF
}