POK(kernelpart)
Main Page
Data Structures
Files
File List
Globals
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
36
extern
uint32_t
pok_multiboot_magic
;
37
extern
uint32_t
pok_multiboot_info
;
38
39
uint32_t
pok_x86_pm_heap_start
;
40
uint32_t
pok_x86_pm_brk
;
41
uint32_t
pok_x86_pm_heap_end
;
42
43
44
int
pok_pm_init
()
45
{
46
pok_multiboot_info_t
* mbi;
47
uint32_t
free_mem;
48
49
mbi = (
pok_multiboot_info_t
*)
pok_multiboot_info
;
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
57
pok_x86_pm_heap_start
=
pok_x86_pm_brk
= free_mem;
58
59
pok_x86_pm_heap_end
= (
uint32_t
)(mbi->
mem_upper
* 1024);
60
61
return
(
POK_ERRNO_OK
);
62
}
63
68
uint32_t
pok_pm_sbrk
(
uint32_t
increment)
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
kernel
arch
x86
x86-qemu
pm.c
Generated on Fri Jun 1 2012 19:07:12 for POK(kernelpart) by
1.8.1