A poorly written OS for the x86 arch. (WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eOS/kernel/memory.h

26 lines
826 B

3 years ago
#include "../lib/types.h"
#define BLOCK_SIZE 1024 // 1 KiB
3 years ago
#define MAX_BLOCK_COUNT 32 // placeholder
3 years ago
#define MEMSIZE_TO_BLOCKS(n) ((n*1024)/BLOCK_SIZE)
3 years ago
#define BM_FREE 0
#define PM_MEM_START 0x000000 // start of memory
#define PM_MEM_END 0xb7000 // end of memory TODO: fix me/change or something
3 years ago
// void init_pmm(uint map_addr, uint bsize); // Initialize physical memory manager
3 years ago
3 years ago
void mod_bitmap(uint bit, uint flag);
3 years ago
pointer block_alloc(uint blockidx); // allocate a block
3 years ago
void block_free(uint blockidx); // free a block
3 years ago
uint find_free(uint block_count);
bool check_block_range(uint start, uint end);
void pm_alloc_range(ulong start, ulong end, bool force); // allocate a range of memory
3 years ago
3 years ago
pointer pm_malloc(uint block_count); // allocate some blocks
3 years ago
void pm_free(int* p); // free a var (if allocated with pm_malloc)