2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
7 * Boot-time memory management functions.
8 * This is a very simple allocator working on a continuous memory block.
9 * Its purpose is to help to set up initial boot-time data for your kernel,
10 * until it can do more serious thing.
11 * A popular usage is to store away boot information.
14 #include <aros/macros.h>
17 #include "kernel_base.h"
18 #include "kernel_bootmem.h"
19 #include "kernel_debug.h"
21 void *krnAllocBootMem(unsigned long size
)
23 return krnAllocBootMemAligned(size
, sizeof(void *));
26 void *krnAllocBootMemAligned(unsigned long size
, unsigned int align
)
28 void *addr
= (void *)AROS_ROUNDUP2((unsigned long)BootMemPtr
, align
);
29 void *end
= addr
+ size
;
32 /* FIXME: Only x86-64 currently sets BootMemLimit */
33 if (end
> BootMemLimit
)
35 /* Our allocation must succeed. We can't continue without it. */
36 krnPanic(NULL
, "Not enough memory for boot information\n"
37 "Increase reserved space in bootstrap");
42 /* Clear the allocated memory. In many places we expect it. */
43 memset(addr
, 0, size
);