]> git.proxmox.com Git - grub2.git/commitdiff
grub-core/kern/arm/misc.S: fix unaligned grub_uint64_t local variable
authorDavid Kozub <zub.272@gmail.com>
Thu, 20 Nov 2014 20:53:14 +0000 (21:53 +0100)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sun, 7 Dec 2014 17:16:29 +0000 (20:16 +0300)
The unaligned local in __aeabi_uidivmod leads to a store to a 64bit
value at an address that is not divisible by 8 (in grub_divmod64).
The compiler most likely generates a STRD instruction to store it and
this causes an exception.

Fixes Savannah bug #43632.

This includes improvements done by Leif Lindholm.

ChangeLog
grub-core/kern/arm/misc.S

index 6f2924e4130a04648fc52f6fb0a12103f0b08923..4150810a2f14c397d7146087703c680417a79dda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-07  David Kozub  <zub.272@gmail.com>
+
+       * grub-core/kern/arm/misc.S: fix unaligned 64bit local variable
+       in __aeabi_uidivmod
+       Fixes Savannah bug #43632.
+
 2014-12-07  Peter Nelson <peterdn>
 
        * grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse
index 8943cc3026d7f2364ef6bad30c1b245284bc7646..16b6f8e600033b3b613f870968a582926adfa6e2 100644 (file)
@@ -60,17 +60,17 @@ FUNCTION(__aeabi_lmul)
 
        .macro division parent
 
-        stmfd   sp!, {lr}
-        sub     sp, sp, #12
+        sub     sp, sp, #8      @ Allocate naturally aligned 64-bit space
+        stmfd   sp!, {r3,lr}    @ Dummy r3 to maintain stack alignment
+        add     r3, sp, #8      @ Set r3 to address of 64-bit space
+        str     r3, [sp]        @ Stack parameter, pointer to 64-bit space
         mov     r2, r1
-        add     r1, sp, #4
-        str     r1, [sp, #0]
         mov     r1, #0
         mov     r3, #0
         bl      \parent
-       ldr     r1, [sp, #4]
-        add     sp, sp, #12
-        ldmfd   sp!, {lr}
+        ldr     r1, [sp, #8]    @ Extract remainder
+        ldmfd   sp!, {r3,lr}    @ Pop into an unused arg/scratch register
+        add     sp, sp, #8
         bx      lr
        .endm