grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v6 6/6] Implement __aeabi_uldivmod


From: Vladimir Serbinenko
Subject: [PATCH v6 6/6] Implement __aeabi_uldivmod
Date: Wed, 11 Sep 2024 12:34:21 +0300

Some arm compilers insert 64-bit division into the
code compiled from libgcrypt source and possibly others.
Rether than fighting it, simply provide the function in
question.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/kern/arm/compiler-rt.S | 11 +++++++++++
 include/grub/compiler-rt.h       |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/grub-core/kern/arm/compiler-rt.S b/grub-core/kern/arm/compiler-rt.S
index 645b42f50..26fe1c98d 100644
--- a/grub-core/kern/arm/compiler-rt.S
+++ b/grub-core/kern/arm/compiler-rt.S
@@ -75,6 +75,17 @@ FUNCTION(__aeabi_uidivmod)
 FUNCTION(__aeabi_idivmod)
        division32 grub_divmod32s
 
+        /* Copied from LLVM under MIT license.  */
+FUNCTION(__aeabi_uldivmod)
+        push   {r11, lr}
+        sub    sp, sp, #16
+        add    r12, sp, #8
+        str    r12, [sp]
+        bl     grub_divmod64
+        ldr    r2, [sp, #8]
+        ldr    r3, [sp, #12]
+        add    sp, sp, #16
+        pop    {r11, pc}
 /*
  * Null divide-by-zero handler
  */
diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h
index 17828b322..43fd8f4d7 100644
--- a/include/grub/compiler-rt.h
+++ b/include/grub/compiler-rt.h
@@ -73,6 +73,9 @@ EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t 
b);
 grub_uint32_t
 EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b);
 
+grub_uint64_t
+EXPORT_FUNC (__aeabi_uldivmod) (grub_uint64_t a, grub_uint64_t b);
+
 grub_int32_t
 EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b);
 grub_int32_t
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]