Newer
Older
tree-os / src / include / alloc.h
@lukas lukas on 15 May 2022 632 bytes adjust alloc for paging
#ifndef ALLOC_H
#define ALLOC_H

#include <stdint.h>

#define ALLOCATION_MAGIC 0x44BB33DD

typedef struct AllocationBlock {
    uint8_t data[3948];
    uint32_t allocatedFine[32];
    uint32_t allocatedCoarse;
    uint32_t blockSize;
    struct AllocationBlock *next;
    struct AllocationBlock *previous;
    uint32_t magic;
} AllocationBlock;

typedef AllocationBlock *AllocationData[12];

extern void *malloc(uintptr_t size);
extern void *mallocAligned(uintptr_t size, uint8_t alignment);
extern void *mallocTask(uintptr_t size, void *task);
extern void free(void *location);
extern void freeTaskAllocations(void *task);

#endif