ArchiSys/TP/TP1/rendu/vmap.h

29 lines
588 B
C
Raw Normal View History

2024-03-31 18:27:05 +02:00
#ifndef DEF_VMAP_H
#define DEF_VMAP_H
#include "mmap.h"
typedef struct VMap {
MMap* mmap;
linkedList* pages;
int index; // index of virt memory
} VMap;
typedef struct PageMapInfo {
int start;
int key; // key for mmap
int cursor; // Last allocation end
int nb_allocs; // Free page if 0
bool swapped;
} PageMapInfo;
/**
* Get page hosting a certain pointer
*/
PageMapInfo* vmap_get_page(VMap* vmap, void* ptr);
void* my_malloc(VMap* vmap, int size);
void my_free(VMap* vmap, void* ptr);
void my_copy(VMap* vmap, void* src, void* dst, int size);
#endif