OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
vmalloc.c File Reference
#include <stddef.h>
#include <stdint.h>
#include "kernel/mm/kalloc.h"
#include "kernel/mm/frame.h"
#include "kernel/panic.h"
#include "kernel/mm/vmalloc.h"

Functions

void vmalloc_init ()
 Initializes the virtual memory allocator. This should be called after frame allocator and paging are initialized.
 
void * vmalloc (size_t size)
 Allocates size bytes of virtual memory and returns a pointer to it. The allocation is aligned to VMALLOC_ALIGNMENT. It panics if out of memory.
 
void vfree (void *addr)
 Frees the virtual memory allocated at addr. (TODO: stop using bump allocator)
 

Variables

uint8_t * bump_start
 The starting address of the bump allocator.
 
uint8_t * bump_next
 The next available address in the bump allocator.
 
uint8_t * bump_end
 The ending address of the bump allocator. (exclusive)
 

Function Documentation

◆ vfree()

void vfree ( void *  addr)

Frees the virtual memory allocated at addr. (TODO: stop using bump allocator)

◆ vmalloc()

void * vmalloc ( size_t  size)

Allocates size bytes of virtual memory and returns a pointer to it. The allocation is aligned to VMALLOC_ALIGNMENT. It panics if out of memory.

◆ vmalloc_init()

void vmalloc_init ( void  )

Initializes the virtual memory allocator. This should be called after frame allocator and paging are initialized.

Variable Documentation

◆ bump_end

uint8_t* bump_end

The ending address of the bump allocator. (exclusive)

◆ bump_next

uint8_t* bump_next

The next available address in the bump allocator.

◆ bump_start

uint8_t* bump_start

The starting address of the bump allocator.