2019-04-11 22:34:20 +02:00
|
|
|
#pragma once
|
|
|
|
#include "paging.h"
|
|
|
|
#include "stdarg.h"
|
|
|
|
|
2021-01-25 20:05:38 +01:00
|
|
|
/*
|
|
|
|
* Initialize malloc system
|
|
|
|
*/
|
2021-08-09 09:26:10 +02:00
|
|
|
int allocSetup(size_t sizeOfArea, vaddr_t *areaAddr, vaddr_t *descAddr, vaddr_t *entryAddr);
|
2021-01-25 20:05:38 +01:00
|
|
|
|
2021-08-09 09:26:10 +02:00
|
|
|
int allocPopulate();
|
2021-01-25 20:05:38 +01:00
|
|
|
/*
|
|
|
|
* Allow malloc to allocate elements of this precise size.
|
|
|
|
* Otherwise the allocation will be in the closest biggest pool.
|
|
|
|
* */
|
|
|
|
int allocBookSlab(size_t size, size_t sizeSlab, int selfContained);
|
|
|
|
|
|
|
|
void *malloc(size_t size);
|
|
|
|
void free(void *ptr);
|
|
|
|
|
|
|
|
/* Stuct definition shared for test purpose
|
|
|
|
*/
|
2019-04-16 23:12:16 +02:00
|
|
|
struct slabEntry {
|
2020-04-27 00:14:37 +02:00
|
|
|
vaddr_t page;
|
2020-08-28 22:38:05 +02:00
|
|
|
size_t size;
|
2020-04-27 00:14:37 +02:00
|
|
|
void *freeEl;
|
|
|
|
char full;
|
|
|
|
struct slabEntry *next;
|
|
|
|
struct slabEntry *prev;
|
2019-04-16 23:12:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct slabDesc {
|
2020-04-27 00:14:37 +02:00
|
|
|
struct slabEntry slab;
|
|
|
|
size_t size;
|
|
|
|
struct slabDesc *next;
|
|
|
|
struct slabDesc *prev;
|
2019-04-11 22:34:20 +02:00
|
|
|
};
|