WKern
Loading...
Searching...
No Matches
alloc.c File Reference
#include <global.h>
#include <types/nums.h>

Go to the source code of this file.

Data Structures

struct  BlocK

Macros

#define HEAP_START   ((char *)0x100000)
#define HEAP_SIZE   (512 * 1024)

Typedefs

typedef struct BlocK blocK_t

Functions

void KheapInit ()
 Initialize Memory Heap.
void * Kmalloc (size_t size, size_t align)
 Allocate memory.
void Kfree (void *ptr)
 Free allocated memory.

Macro Definition Documentation

◆ HEAP_SIZE

#define HEAP_SIZE   (512 * 1024)

Definition at line 27 of file alloc.c.

◆ HEAP_START

#define HEAP_START   ((char *)0x100000)

Definition at line 26 of file alloc.c.

Typedef Documentation

◆ blocK_t

typedef struct BlocK blocK_t

Function Documentation

◆ Kfree()

void Kfree ( void * ptr)

Free allocated memory.

Parameters
voifd*- Pointer to allocated memory (from Kmalloc)

Definition at line 75 of file alloc.c.

◆ KheapInit()

void KheapInit ( )

Initialize Memory Heap.

Definition at line 35 of file alloc.c.

◆ Kmalloc()

void * Kmalloc ( size_t size,
size_t align )

Allocate memory.

Parameters
Size- Size of memory to allocate
Align- Which to align memory to
Returns
Pointer to allocated memory

Definition at line 48 of file alloc.c.