GDT finally works
This commit is contained in:
36
kernel/bitmap/bitmap.h
Normal file
36
kernel/bitmap/bitmap.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef BITMAP_BITMAP_H_
|
||||
#define BITMAP_BITMAP_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t *map;
|
||||
size_t nblocks;
|
||||
size_t nbytes;
|
||||
size_t alloc_blocks;
|
||||
size_t last_deep_frag;
|
||||
uintptr_t mem_start;
|
||||
bool init;
|
||||
} BitMap;
|
||||
|
||||
#define BITMAP_BLOCKS_PER_BYTE 8
|
||||
#define BITMAP_BLOCK_SIZE 0x1000
|
||||
#define BITMAP_INVALID_BLOCK ((size_t)-1)
|
||||
|
||||
void *bitmap_toptr(BitMap *bm, size_t block);
|
||||
size_t bitmap_toblock(BitMap *bm, void *ptr);
|
||||
size_t bitmap_toblock_roundup(BitMap *bm, void *ptr);
|
||||
size_t bitmap_calcsize(size_t total);
|
||||
bool bitmap_get(BitMap *bm, size_t block);
|
||||
void bitmap_set(BitMap *bm, size_t block, bool value);
|
||||
void bitmap_markblocks(BitMap *bm, size_t start, size_t size, bool value);
|
||||
void bitmap_markregion(BitMap *bm, void *baseptr, size_t size, bool is_used);
|
||||
size_t bitmap_freeregion(BitMap *bm, size_t blocks);
|
||||
void *bitmap_alloc(BitMap *bm, size_t blocks);
|
||||
void bitmap_free(BitMap *bm, void *base, size_t blocks);
|
||||
size_t bitmap_allocpageframe(BitMap *bm);
|
||||
void bitmap_freepageframe(BitMap *bm, void *addr);
|
||||
|
||||
#endif // BITMAP_BITMAP_H_
|
Reference in New Issue
Block a user