8c6b1ac71e
Also include some minor fixes for gcc 5.1.1 Signed-off-by: Peter Jones <pjones@redhat.com>
63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
From e5b4ba8c2b2cfbb84e5b8254fb7d0b15b799fe78 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
Date: Thu, 7 May 2015 16:23:39 +0200
|
|
Subject: [PATCH 399/506] linux.c: Ensure that initrd is page-aligned.
|
|
|
|
---
|
|
grub-core/loader/i386/linux.c | 11 +++++------
|
|
1 file changed, 5 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
|
index 291f728..fddcc46 100644
|
|
--- a/grub-core/loader/i386/linux.c
|
|
+++ b/grub-core/loader/i386/linux.c
|
|
@@ -69,7 +69,6 @@ static grub_addr_t prot_mode_target;
|
|
static void *initrd_mem;
|
|
static grub_addr_t initrd_mem_target;
|
|
static grub_size_t prot_init_space;
|
|
-static grub_uint32_t initrd_pages;
|
|
static struct grub_relocator *relocator = NULL;
|
|
static void *efi_mmap_buf;
|
|
static grub_size_t maximal_cmdline_size;
|
|
@@ -1046,7 +1045,7 @@ static grub_err_t
|
|
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
int argc, char *argv[])
|
|
{
|
|
- grub_size_t size = 0;
|
|
+ grub_size_t size = 0, aligned_size = 0;
|
|
grub_addr_t addr_min, addr_max;
|
|
grub_addr_t addr;
|
|
grub_err_t err;
|
|
@@ -1068,8 +1067,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
goto fail;
|
|
|
|
size = grub_get_initrd_size (&initrd_ctx);
|
|
-
|
|
- initrd_pages = (page_align (size) >> 12);
|
|
+ aligned_size = ALIGN_UP (size, 4096);
|
|
|
|
/* Get the highest address available for the initrd. */
|
|
if (grub_le_to_cpu16 (linux_params.version) >= 0x0203)
|
|
@@ -1097,7 +1095,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
addr_min = (grub_addr_t) prot_mode_target + prot_init_space;
|
|
|
|
/* Put the initrd as high as possible, 4KiB aligned. */
|
|
- addr = (addr_max - size) & ~0xFFF;
|
|
+ addr = (addr_max - aligned_size) & ~0xFFF;
|
|
|
|
if (addr < addr_min)
|
|
{
|
|
@@ -1108,7 +1106,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
{
|
|
grub_relocator_chunk_t ch;
|
|
err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
|
- addr_min, addr, size, 0x1000,
|
|
+ addr_min, addr, aligned_size,
|
|
+ 0x1000,
|
|
GRUB_RELOCATOR_PREFERENCE_HIGH,
|
|
1);
|
|
if (err)
|
|
--
|
|
2.4.3
|
|
|