mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] replace 'hlt' by 'ud2' in i386/x32/x86_64 a_crash implementations
@ 2015-04-16 17:58 Alexander Monakov
  2015-04-17  5:55 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Monakov @ 2015-04-16 17:58 UTC (permalink / raw)
  To: musl; +Cc: Alexander Monakov

---
ud2 is also what GCC and Clang use to implement __builtin_trap()

ud2 causes SIGILL rather than SIGSEGV; SIGSEGV is more likely to have a custom
signal handler installed

 arch/i386/atomic.h   | 2 +-
 arch/x32/atomic.h    | 2 +-
 arch/x86_64/atomic.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/i386/atomic.h b/arch/i386/atomic.h
index 4fe7bde..2f78d31 100644
--- a/arch/i386/atomic.h
+++ b/arch/i386/atomic.h
@@ -103,7 +103,7 @@ static inline void a_barrier()
 
 static inline void a_crash()
 {
-	__asm__ __volatile__( "hlt" : : : "memory" );
+	__asm__ __volatile__( "ud2" : : : "memory" );
 }
 
 
diff --git a/arch/x32/atomic.h b/arch/x32/atomic.h
index 333098c..a8e7603 100644
--- a/arch/x32/atomic.h
+++ b/arch/x32/atomic.h
@@ -98,7 +98,7 @@ static inline void a_barrier()
 
 static inline void a_crash()
 {
-	__asm__ __volatile__( "hlt" : : : "memory" );
+	__asm__ __volatile__( "ud2" : : : "memory" );
 }
 
 
diff --git a/arch/x86_64/atomic.h b/arch/x86_64/atomic.h
index 333098c..a8e7603 100644
--- a/arch/x86_64/atomic.h
+++ b/arch/x86_64/atomic.h
@@ -98,7 +98,7 @@ static inline void a_barrier()
 
 static inline void a_crash()
 {
-	__asm__ __volatile__( "hlt" : : : "memory" );
+	__asm__ __volatile__( "ud2" : : : "memory" );
 }
 
 
-- 
2.1.3



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-17 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 17:58 [PATCH] replace 'hlt' by 'ud2' in i386/x32/x86_64 a_crash implementations Alexander Monakov
2015-04-17  5:55 ` Rich Felker
2015-04-17  8:12   ` Alexander Monakov
2015-04-17 16:44     ` Rich Felker
2015-04-17 18:48       ` Alexander Monakov
2015-04-17 20:23         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).