Newer
Older
tree-os / src / kernel / lib / memory / alloc.h
#ifndef ALLOC_H
#define ALLOC_H

#include <stdint.h>

typedef enum MemoryState {
    FREE = 0,
    IN_USE = 1
} MemoryState;

typedef struct MemoryBlock {
    struct MemoryBlock* last;
    struct MemoryBlock* next;
    MemoryState state;
    uint32_t size;
} MemoryBlock;

extern void initMemoryAllocation(uint32_t kernelEnd);
extern void* malloc(uint32_t size);
extern void mfree(void* location);
extern void printMemoryStack();

#endif