Copyright clean-up (part 1):
[AROS.git] / arch / all-unix / kernel / allockernelbase.c
blob409236e9b1513ef2d0e12d9466aee2a0cd4e1cb1
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/execbase.h>
7 #include <exec/memory.h>
8 #include <proto/exec.h>
10 #include LC_LIBDEFS_FILE /* we want FUNCTIONS_COUNT */
12 #include <kernel_debug.h>
13 #include <kernel_globals.h>
14 #include "kernel_intern.h"
15 #include "kernel_unix.h"
17 #define D(x)
19 struct KernelBase *AllocKernelBase(struct ExecBase *SysBase)
21 APTR mem;
22 struct KernelBase *KernelBase;
23 ULONG i = FUNCTIONS_COUNT * LIB_VECTSIZE;
25 /* Align vector table size */
26 i = ((i - 1) / sizeof(IPTR) + 1) * sizeof(IPTR);
28 /* Allocate the memory. Note that we have platform-specific portion in KernelBase. */
29 mem = AllocMem(i + sizeof(struct UnixKernelBase), MEMF_PUBLIC|MEMF_CLEAR);
30 if (!mem)
31 return NULL;
33 /* Skip past the vector table */
34 KernelBase = mem + i;
36 KernelBase->kb_PlatformData = AllocMem(sizeof(struct PlatformData), MEMF_ANY);
37 D(bug("[KRN] PlatformData %p\n", KernelBase->kb_PlatformData));
39 if (!KernelBase->kb_PlatformData)
40 return NULL;
42 /* Set global KernelBase storage and return */
43 setKernelBase(KernelBase);
44 return KernelBase;