Skip to content

Commit

Permalink
Make a_crash emit a message and cli;hlt to make crash loop detection …
Browse files Browse the repository at this point in the history
…easier
  • Loading branch information
alfreb committed Jun 19, 2024
1 parent ffa226e commit e81fb7c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions deps/musl/patches/musl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@ diff --git a/arch/i386/atomic_arch.h b/arch/i386/atomic_arch.h
index 7d2a48a..0d9fc0f 100644
--- a/arch/i386/atomic_arch.h
+++ b/arch/i386/atomic_arch.h
@@ -80,7 +80,7 @@ static inline void a_spin()
#define a_crash a_crash
@@ -80,4 +80,7 @@ static inline void a_spin()
+ extern void kprint(const char*);
+ #define a_crash a_crash
static inline void a_crash()
{
- __asm__ __volatile__( "hlt" : : : "memory" );
+ __asm__ __volatile__( "ud2" : : : "memory" );
+ kprint("\n*** Libc crashed 😵 ***\n");
+ __asm__ __volatile__( "cli;hlt" : : : "memory" );
}

#define a_ctz_64 a_ctz_64
diff --git a/arch/x86_64/atomic_arch.h b/arch/x86_64/atomic_arch.h
index da4e203..08beb81 100644
--- a/arch/x86_64/atomic_arch.h
+++ b/arch/x86_64/atomic_arch.h
@@ -105,7 +105,7 @@ static inline void a_spin()
#define a_crash a_crash
@@ -105,4 +105,7 @@ static inline void a_spin()
+ extern void kprint(const char*);
+#define a_crash a_crash
static inline void a_crash()
{
- __asm__ __volatile__( "hlt" : : : "memory" );
+ __asm__ __volatile__( "ud2" : : : "memory" );
+ kprint("\n*** Libc crashed 😵 ***\n");
+ __asm__ __volatile__( "cli;hlt" : : : "memory" );
}

#define a_ctz_64 a_ctz_64
Expand Down

0 comments on commit e81fb7c

Please sign in to comment.