From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../stdarch/crates/core_arch/src/arm/armclang.rs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 library/stdarch/crates/core_arch/src/arm/armclang.rs (limited to 'library/stdarch/crates/core_arch/src/arm/armclang.rs') diff --git a/library/stdarch/crates/core_arch/src/arm/armclang.rs b/library/stdarch/crates/core_arch/src/arm/armclang.rs new file mode 100644 index 000000000..e68c02d02 --- /dev/null +++ b/library/stdarch/crates/core_arch/src/arm/armclang.rs @@ -0,0 +1,35 @@ +//! ARM compiler specific intrinsics +//! +//! # References +//! +//! - [ARM Compiler v 6.10 - armclang Reference Guide][arm_comp_ref] +//! +//! [arm_comp_ref]: https://developer.arm.com/docs/100067/0610 + +#[cfg(test)] +use stdarch_test::assert_instr; + +/// Inserts a breakpoint instruction. +/// +/// `VAL` is a compile-time constant integer in range `[0, 255]`. +/// +/// The breakpoint instruction inserted is `BKPT` on A32/T32. +/// +/// # Note +/// +/// [ARM's documentation][arm_docs] defines that `__breakpoint` accepts the +/// following values for `VAL`: +/// +/// - `0...65535` when compiling as A32, +/// - `0...255` when compiling as T32. +/// +/// The current implementation only accepts values in range `[0, 255]`. +/// +/// [arm_docs]: https://developer.arm.com/docs/100067/latest/compiler-specific-intrinsics/__breakpoint-intrinsic +#[cfg_attr(test, assert_instr(bkpt, VAL = 0))] +#[inline(always)] +#[rustc_legacy_const_generics(0)] +pub unsafe fn __breakpoint() { + static_assert_imm8!(VAL); + crate::arch::asm!("bkpt #{}", const VAL); +} -- cgit v1.2.3