blob: 1234d8a8d2ea0c221a1a3555009d0da1e391c1cb (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include <mm/pmm.h>
#include <kernel.h>
#include <stdio.h>
// Finds biggest memory chunk to place the bitmap
static int find_biggest_chunk(limine_memmap_response* memmap) {
int biggestmem = 0;
int biggestindex = 0;
for (size_t i = 0; i < memmap->entry_count; i++) {
if (memmap->entries[i]->length > biggestmem) {
biggestmem = memmap->entries[i]->length;
biggestindex = i;
}
}
return biggestindex;
}
static MemRegion** setup_meminfo(limine_memmap_response* memmap, int chunk) {
const uint64_t* basemem = (uint64_t*)memmap->entries[chunk]->base;
int use_count = 1; // for placing structures in the right location
for (size_t i = 0; i < memmap->entry_count; i++) {
if (memmap->entries[i]->type == LIMINE_MEMMAP_USABLE) {
}
}
}
void pmm_init(limine_memmap_response* memmap) {
int chunk = find_biggest_chunk(memmap);
setup_meminfo(memmap, chunk);
printf("Initialized PMM\n");
}
void* palloc() {
}
void pfree(void* page) {
}
|