OurOS
0.1
Operating System built by McGill Students
Loading...
Searching...
No Matches
vmalloc.h
Go to the documentation of this file.
1
#ifndef _KERNEL_MM_VMALLOC_H
2
#define _KERNEL_MM_VMALLOC_H
3
4
#include <
stddef.h
>
5
6
/**
7
* @brief Maximum size of the virtual memory region for vmalloc.
8
*/
9
#define VMALLOC_SIZE (PAGE_SIZE * 512)
10
11
/**
12
* @brief Alignment for each vmalloc allocation.
13
*/
14
#define VMALLOC_ALIGNMENT 16
15
16
/**
17
* @brief Initializes the virtual memory allocator.
18
* This should be called after frame allocator and paging are initialized.
19
*/
20
void
vmalloc_init
(
void
);
21
22
/**
23
* @brief Allocates `size` bytes of virtual memory and returns a pointer to it.
24
* The allocation is aligned to `VMALLOC_ALIGNMENT`. It panics if out of memory.
25
*/
26
void
*
vmalloc
(
size_t
size);
27
void
*
vmalloc
(
size_t
size);
28
29
/**
30
* @brief Frees the virtual memory allocated at `addr`.
31
* (TODO: stop using bump allocator)
32
*/
33
void
vfree
(
void
*addr);
34
35
#endif
// _KERNEL_MM_VMALLOC_H
stddef.h
vfree
void vfree(void *addr)
Frees the virtual memory allocated at addr. (TODO: stop using bump allocator)
Definition
vmalloc.c:69
vmalloc
void * vmalloc(size_t size)
Allocates size bytes of virtual memory and returns a pointer to it. The allocation is aligned to VMAL...
Definition
vmalloc.c:55
vmalloc_init
void vmalloc_init(void)
Initializes the virtual memory allocator. This should be called after frame allocator and paging are ...
Definition
vmalloc.c:23
include
kernel
mm
vmalloc.h
Generated by
1.9.8