bump copyright date on affected files and version
[AROS.git] / arch / all-native / kernel / kernel_bootmem.c
blob054e4af1b348ed97a76c7eb89edb26d8de061d3b
1 /*
2 * Boot-time memory management functions.
3 * This is a very simple allocator working on a continuous memory block.
4 * Its purpose is to help to set up initial boot-time data for your kernel,
5 * until it can do more serious thing.
6 * A popular usage is to store away boot information.
7 */
9 #include <aros/macros.h>
10 #include <string.h>
12 #include "kernel_base.h"
13 #include "kernel_bootmem.h"
14 #include "kernel_debug.h"
16 void *krnAllocBootMem(unsigned long size)
18 return krnAllocBootMemAligned(size, sizeof(void *));
21 void *krnAllocBootMemAligned(unsigned long size, unsigned int align)
23 void *addr = (void *)AROS_ROUNDUP2((unsigned long)BootMemPtr, align);
24 void *end = addr + size;
26 #ifdef __x86_64__
27 /* FIXME: Only x86-64 currently sets BootMemLimit */
28 if (end > BootMemLimit)
30 /* Our allocation must succeed. We can't continue without it. */
31 krnPanic(NULL, "Not enough memory for boot information\n"
32 "Increase reserved space in bootstrap");
34 #endif
36 BootMemPtr = end;
37 /* Clear the allocated memory. In many places we expect it. */
38 memset(addr, 0, size);
40 return addr;
43 void *BootMemPtr;
44 void *BootMemLimit;