fix: able to read multiboot mmap

This commit is contained in:
2024-11-15 13:35:48 +01:00
parent 09ea386b21
commit 20ba985b34
4 changed files with 11 additions and 21 deletions

View File

@ -5,27 +5,20 @@
#include "debug.h"
#include "kprintf.h"
#include "memory.h"
#include "string.h"
#include "utils.h"
void *alloc_frames(size_t size)
{
const uint32_t nb_frames = CEIL(size, PAGE_SIZE);
/* PRINT_PTR(((multiboot_memory_map_t *)mmap_addr)->addr); */
/* PRINT_UINT(((multiboot_memory_map_t *)mmap_addr)->len); */
/* PRINT_UINT(((multiboot_memory_map_t *)mmap_addr)->type); */
for (uint32_t i = 0; i < mmap_length;
i += sizeof(multiboot_memory_map_t)) {
for (uint32_t i = 0; i < mmap_length; i++) {
multiboot_memory_map_t *mmmt =
(multiboot_memory_map_t *)(mmap_addr + i);
(multiboot_memory_map_t *)mmap_addr + i;
if (mmmt->type == MULTIBOOT_MEMORY_AVAILABLE) {
kprintf("type: %d, addr: %p, len: %u, size: %u, \n",
mmmt->type, mmmt->addr, mmmt->len, mmmt->size);
}
PRINT_UINT(mmmt->len);
/* kprintf("[%d] available %p: %u bytes\n", i, mmmt->addr, */
/* mmmt->len); */
/* PRINT_UINT(mmmt->type); */
}
/* for (size_t i = 0; i < mmap_length; i++) { */
/* } */
return NULL;
}