blob: ddd9c8b612afb86f95e6bad5a831d1b7b5af6883 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#ifndef I386_PMEM_H
#define I386_PMEM_H
#include <kernel/multiboot.h>
#include <stdint.h>
#define PFA_BLOCK_FREE 1
#define PFA_BLOCK_ALLOC 3
#define PFA_ALLOC_ERR 0xFFFFFFFF
struct pfa_page {
struct pfa_page *next;
};
struct pfa_zone {
uintptr_t start;
uintptr_t size;
struct pfa_page *freelist;
};
int pfa_init(struct mboot_info *header);
uintptr_t pfa_alloc(void);
void pfa_free(struct pfa_zone *zone, uintptr_t paddr);
void pfa_free_range(struct pfa_zone *zone, uintptr_t pstart, uintptr_t pend);
#endif
|