lkml.org 
[lkml]   [2008]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH x86] [6/16] Add a new arch_early_alloc() interface for x86-64
On Thu,  3 Jan 2008 16:42:20 +0100 (CET)
Andi Kleen <ak@suse.de> wrote:

>
> This allows to allocate memory really early before bootmem is setup.
>
> And a symbol that can be tested by the preprocessor.
>
> pgtable.h is probably not the best include for it, but also not the worst.
>
> Cc: peterz@infradead.org
>
> Signed-off-by: Andi Kleen <ak@suse.de>
>
> ---
> arch/x86/kernel/e820_64.c | 14 ++++++++++++++
> include/asm-x86/pgtable_64.h | 3 +++
> 2 files changed, 17 insertions(+)
>
> Index: linux/arch/x86/kernel/e820_64.c
> ===================================================================
> --- linux.orig/arch/x86/kernel/e820_64.c
> +++ linux/arch/x86/kernel/e820_64.c
> @@ -819,3 +819,17 @@ int __init arch_get_ram_range(int slot,
> max_pfn << PAGE_SHIFT) - *addr;
> return i + 1;
> }
> +
> +#define EARLY_ALLOC_START (32<<20)
> +__init void *arch_early_alloc(unsigned long size)
> +{
> + unsigned long p = find_e820_area(EARLY_ALLOC_START, -1UL, size);
> + if (p == -1ULL) {
> + /* Risk filling the DMA zone */
> + p = find_e820_area(EARLY_ALLOC_START, -1UL, size);

Hum... Are you sure of this EARLY_ALLOC_START here ?

> + if (p == -1ULL)
> + panic("arch_early_alloc %lu failed", size);
> + }
> + reserve_early(p, p + size);
> + return __va(p);
> +}



\
 
 \ /
  Last update: 2008-01-03 17:25    [W:0.280 / U:0.328 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site