Newer
Older
tree-os / src / kernel / lib / memory / alloc.h
@lukas lukas on 3 Apr 2021 370 bytes improve memory allocator
#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);

#endif