PMM and liballoc port

This commit is contained in:
2025-12-17 22:42:48 +01:00
parent 13fee12f59
commit f60d8d6861
32 changed files with 1202 additions and 12 deletions

31
kernel/mm/pmm.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef _KERNEL_MM_PMM_H
#define _KERNEL_MM_PMM_H
#include <libk/std.h>
#include <libk/bm.h>
#include <sync/spin_lock.h>
#include <mm/types.h>
#define PMM_ALLOC_ERR ((physaddr_t)-1)
#define PMM_REGIONS_MAX 32
#define PMM_REGION_ACTIVE (1 << 0)
struct pmm_region {
spin_lock_t lock;
struct bm bm;
physaddr_t membase;
size_t size;
uint32_t flags;
};
struct pmm {
struct pmm_region regions[PMM_REGIONS_MAX];
};
void pmm_init(void);
physaddr_t pmm_alloc(size_t nblks);
void pmm_free(physaddr_t p_addr, size_t nblks);
#endif // _KERNEL_MM_PMM_H