idk we're trying out pmm

This commit is contained in:
2025-06-11 17:33:42 -04:00
parent 03aecd514f
commit f216c32f22
6 changed files with 104 additions and 86 deletions

View File

@ -7,6 +7,5 @@ void kwarn(const char*);
void kinfo(const char*);
#endif

View File

@ -3,14 +3,4 @@
#ifndef ARCH_PAGING_H
#define ARCH_PAGING_H
#define PAGE_TABLE_ENTRIES 1024
#define PAGE_DIRECTORY_ENTRIES 1024
void load_page_directory(uint32_t*);
void enable_paging();
void setup_paging(void);
#endif

View File

@ -0,0 +1,20 @@
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#ifndef ARCH_PMM_H
#define ARCH_PMM_H
#define PMM_BLOCKS_PER_BYTE 8 // This is for the Bitmap
#define PMM_BLOCK_SIZE 4096 // 4KiB
#define PMM_BLOCK_ALIGN (PMM_BLOCK_SIZE) // must be aligned at 4KiB
void set_grub_mem_map(uint32_t addr, uint32_t len);
uint32_t pmm_get_block_count(void);
int pmm_first_free(void);
int pmm_first_free_s(size_t pages);
void pmm_init(size_t mem_size, uint32_t* bitmap);
#endif