-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkalloc.h
More file actions
34 lines (28 loc) · 740 Bytes
/
kalloc.h
File metadata and controls
34 lines (28 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef KALLOC_H
#define KALLOC_H
#include "types.h"
// Amount of reserved kernel pages
#define KPAGES 256 // ~1MO
/**
* Allocates a few pages for the kernel and initializes the kalloc's heap
*
* Note: you must enable the vmem before calling this
* @return the success of the operation
*/
bool kalloc_setup();
/**
* Allocate memory for the kernel
*
* @param the size of the zone to allocate
* @return a pointer to the start of the zone or 0 if it failed
*/
void* kalloc_alloc(uint32 size);
/**
* Free an allocated part of the memory
*
* @param the pointer to the start of the zone to free
* @param the size of the zone to free
* @return the success of the operation
*/
bool kalloc_free(void* ptr, uint32 size);
#endif