pmm: full rewrite

I've decided to do a rewrite on it due to some plans that would make refcounting physical pages nescessary among other things. now instead of a bitmap it uses a list of pages with each physical page having a page_t associated with it
This commit is contained in:
Matheus
2023-07-29 17:14:41 -03:00
parent 8ca2360991
commit 55fc1b7026
11 changed files with 267 additions and 179 deletions
+31 -3
View File
@@ -9,9 +9,37 @@
#define PMM_SECTION_4GB 1
#define PMM_SECTION_DEFAULT 2
void *pmm_alloc(size_t count, int flags);
void pmm_free(void *addr, size_t count);
void pmm_init();
#define PAGE_FLAGS_FREE 1
typedef struct page_t {
struct vnode_t *backing;
uintmax_t offset;
struct page_t *hashnext;
struct page_t *hashprev;
struct page_t *vnodenext;
struct page_t *vnodeprev;
union {
struct {
struct page_t *freenext;
struct page_t *freeprev;
};
struct {
struct page_t *writenext;
struct page_t *writeprev;
};
};
uintmax_t refcount;
int flags;
} page_t;
void *pmm_allocpage(int section);
page_t *pmm_getpage(void *addr);
void pmm_hold(void *addr);
void pmm_release(void *addr);
void pmm_makefree(void *address, size_t count);
void *pmm_alloc(size_t size, int section);
void pmm_free(void *addr, size_t size);
void pmm_init();
extern uintptr_t hhdmbase;