FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
heap.h File Reference

Header files for heap. More...

#include <stddef.h>
#include <basics.h>
Include dependency graph for heap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void mm_init (uintptr_t kernel_end, int64 heap_size)
 Function to initlialize heap.
void mm_extend (uint64_t additional_size)
 Function to extend available heap.
void mm_constrict (uint64_t removal_size)
 Function to constrict available heap.
void mm_print_out ()
 Prints out heap information.
void * kmalloc (size_t size)
 The main memory alloc function.
void * krealloc (void *ptr, size_t size)
 The main memory realloc function.
void * kmalloc_aligned (size_t size, size_t align)
void kfree (void *ptr)
 The main free function for memory allocation.

Variables

uint64_t heap_begin
uint64_t heap_end
uint64_t last_alloc
uint64_t alloc_count
uint64_t memory_used

Detailed Description

Header files for heap.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2023-11-10

Definition in file heap.h.

Function Documentation

◆ kfree()

void kfree ( void * ptr)
extern

The main free function for memory allocation.

Parameters
ptrLocation in memory.

◆ kmalloc()

void * kmalloc ( size_t size)
extern

The main memory alloc function.

Parameters
sizeAmount of size needed to be allocated.
Returns
void* Location in memory.

◆ kmalloc_aligned()

void * kmalloc_aligned ( size_t size,
size_t align )
Parameters
size
align
Returns
void*

◆ krealloc()

void * krealloc ( void * ptr,
size_t size )
extern

The main memory realloc function.

Parameters
sizeAmount of size needed to be extened.
Returns
void* Location in memory.

◆ mm_constrict()

void mm_constrict ( uint64_t removal_size)
extern

Function to constrict available heap.

Parameters
removal_sizeAmount of size needed to be reduced.

◆ mm_extend()

void mm_extend ( uint64_t additional_size)
extern

Function to extend available heap.

Parameters
additional_sizeAdditional size to be added.

◆ mm_init()

void mm_init ( uintptr_t kernel_end,
int64 heap_size )
extern

Function to initlialize heap.

Parameters
kernel_endThe position in memory where kernel ends.
heap_sizeThe size of heap allocated.