[PATCH] Fix alignment of early reservation for EBDA

From: Alexander van Heukelum
Date: Sun Feb 24 2008 - 12:46:37 EST


Hi Andi,

My eyes fell on the following table in the boot messages:

early res: 0 [0-fff] BIOS data page
early res: 1 [6000-7fff] SMP_TRAMPOLINE
early res: 2 [200000-374557] TEXT DATA BSS
early res: 3 [9fc00-a0bff] EBDA
early res: 4 [8000-afff] PGTABLE

The memory reserved for the EBDA overflows into the area normally
reserved for the VGA adaptor. It seems that you wanted to force
the allocation to cover whole pages, like:

early res: 3 [9f000-9ffff] EBDA

This is what this patch implements.

Is it really necessary to force the allocation to a page boundary?


Signed-off-by: Alexander van Heukelum <heukelum@xxxxxxxxxxx>

arch/x86/kernel/head64.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index ad24408..2c52543 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -53,7 +53,7 @@ static void __init copy_bootdata(char *real_mode_data)

static __init void reserve_ebda(void)
{
- unsigned ebda_addr, ebda_size;
+ unsigned int ebda_addr, ebda_size, ebda_end;

/*
* there is a real-mode segmented pointer pointing to the
@@ -70,12 +70,14 @@ static __init void reserve_ebda(void)
/* Round EBDA up to pages */
if (ebda_size == 0)
ebda_size = 1;
+ if (ebda_size > 64)
+ ebda_size = 64;
ebda_size <<= 10;
- ebda_size = round_up(ebda_size + (ebda_addr & ~PAGE_MASK), PAGE_SIZE);
- if (ebda_size > 64*1024)
- ebda_size = 64*1024;
+
+ ebda_end = ALIGN(ebda_addr + ebda_size, PAGE_SIZE);
+ ebda_addr = ALIGN(ebda_addr - PAGE_SIZE, PAGE_SIZE);

- reserve_early(ebda_addr, ebda_addr + ebda_size, "EBDA");
+ reserve_early(ebda_addr, ebda_end, "EBDA");
}

void __init x86_64_start_kernel(char * real_mode_data)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/