kern_end is 64-bit and so we need to add this additional zero.
entry is unused and is explicitly zero in own FreeBSD bootloader

Signed-off-by: Vladimir Serbinenko <phco...@gmail.com>
---
 grub-core/loader/i386/bsd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
index af2b7cb9a..ee6fafd4d 100644
--- a/grub-core/loader/i386/bsd.c
+++ b/grub-core/loader/i386/bsd.c
@@ -900,7 +900,7 @@ grub_freebsd_boot (void)
 
   err = grub_relocator_alloc_chunk_align (relocator, &ch,
                                          0x10000, 0x90000,
-                                         (is_64bit ? 3 : 9) * sizeof 
(grub_uint32_t)
+                                         (is_64bit ? 4 : 9) * sizeof 
(grub_uint32_t)
                                          + sizeof (bi), 4,
                                          GRUB_RELOCATOR_PREFERENCE_NONE,
                                          0);
@@ -960,9 +960,10 @@ grub_freebsd_boot (void)
       state.rsp = stack_target;
       state.rip = (((grub_uint64_t) entry_hi) << 32) | entry;
 
-      stack[0] = entry;
+      stack[0] = 0;
       stack[1] = bi.tags;
       stack[2] = kern_end;
+      stack[3] = 0;
       return grub_relocator64_boot (relocator, state, 0, 0x40000000);
     }
   else
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to