]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Provide div0 handlers for ARM 26608/head
authorJan Janssen <medhefgo@web.de>
Mon, 27 Feb 2023 17:43:07 +0000 (18:43 +0100)
committerJan Janssen <medhefgo@web.de>
Tue, 28 Feb 2023 13:37:05 +0000 (14:37 +0100)
This is a cleaner approach to 59833064742310bfccf028b0278811ba5cff8dcf.

src/boot/efi/log.c
src/boot/efi/util.c

index 4d8ad937168ccaab86394b9d647f8dd7a52761a8..9cbbb3a9337a7aa3db19ec7e77959cd39c67a36a 100644 (file)
@@ -5,12 +5,16 @@
 
 static unsigned log_count = 0;
 
-void efi_assert(const char *expr, const char *file, unsigned line, const char *function) {
-        log_error("systemd-boot assertion '%s' failed at %s:%u@%s. Halting.", expr, file, line, function);
+_noreturn_ static void freeze(void) {
         for (;;)
                 BS->Stall(60 * 1000 * 1000);
 }
 
+void efi_assert(const char *expr, const char *file, unsigned line, const char *function) {
+        log_error("systemd-boot assertion '%s' failed at %s:%u@%s. Halting.", expr, file, line, function);
+        freeze();
+}
+
 EFI_STATUS log_internal(EFI_STATUS status, const char *format, ...) {
         assert(format);
 
@@ -39,3 +43,17 @@ void log_wait(void) {
         BS->Stall(MIN(4u, log_count) * 2500 * 1000);
         log_count = 0;
 }
+
+#if defined(__ARM_EABI__)
+/* These override the (weak) div0 handlers from libgcc as they would otherwise call raise() instead. */
+
+_used_ _noreturn_ int __aeabi_idiv0(int return_value) {
+        log_error("Division by zero.");
+        freeze();
+}
+
+_used_ _noreturn_ long long __aeabi_ldiv0(long long return_value) {
+        log_error("Division by zero.");
+        freeze();
+}
+#endif
index 19c4788b8f00748c5dc4bf29ebb429b2cbb4d621..588d60dd0613d69b05e5a9cfd1f14b4503890a20 100644 (file)
@@ -629,9 +629,3 @@ void *find_configuration_table(const EFI_GUID *guid) {
 
         return NULL;
 }
-
-/* libgcc's __aeabi_ldiv0 intrinsic will call raise() on division by zero, so we
- * need to provide one ourselves for now. */
-_used_ _noreturn_ int raise(int sig) {
-        assert_not_reached();
-}