PMM and liballoc port
This commit is contained in:
31
kernel/mm/pmm.h
Normal file
31
kernel/mm/pmm.h
Normal 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
|
||||
Reference in New Issue
Block a user