POK(kernelpart)
pm.c
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
24 #include <errno.h>
25 #include <arch/x86/multiboot.h>
26 #include <types.h>
27 
28 #include "pm.h"
29 
30 #define ALIGN_UP(boundary, val) \
31  (val + (boundary - 1)) & (~(boundary - 1))
32 
33 extern void *__pok_begin;
34 extern void *__pok_end;
35 
38 
42 
43 
45 {
47  uint32_t free_mem;
48 
50 
51 #ifdef POK_NEEDS_DMA
52  free_mem = MEM_16MB;
53 #else
54  free_mem = ALIGN_UP (4096, (uint32_t)(&__pok_end));
55 #endif
56 
58 
59  pok_x86_pm_heap_end = (uint32_t)(mbi->mem_upper * 1024);
60 
61  return (POK_ERRNO_OK);
62 }
63 
69 {
70  uint32_t addr;
71 
72  addr = pok_x86_pm_brk;
73 
74  pok_x86_pm_brk += increment;
75 
76  return (addr);
77 }
78