summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-01-25 02:40:55 +0000
committerRich Felker <dalias@aerifal.cx>2016-01-25 02:44:56 +0000
commit89e149d275a7699a4a5e4c98bab267648f64cbba (patch)
treef1b30d37f117c9059745bb57b26e2f3b345405c5
parent2c9acc51cdf40871625405a7e4a766cccb77ab6f (diff)
downloadmusl-89e149d275a7699a4a5e4c98bab267648f64cbba.tar.gz
add native a_crash primitive for arm
the .byte directive encodes a guaranteed-undefined instruction, the same one Linux fills the kuser helper page with when it's disabled. the udf mnemonic and and .insn directives are not supported by old binutils versions, and larger-than-byte integer directives would produce the wrong output on big-endian.
-rw-r--r--arch/arm/atomic_arch.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index a52254b2..a74cf3b7 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -62,3 +62,13 @@ static inline void a_barrier()
: : : "memory", "cc", "ip", "lr" );
}
#endif
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__(".byte 0xf1, 0xde"
+#ifndef __thumb__
+ ", 0xfd, 0xe7"
+#endif
+ : : : "memory");
+}