aboutsummaryrefslogtreecommitdiff
path: root/src/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mmap.c')
-rw-r--r--src/mmap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mmap.c b/src/mmap.c
index c28ce79..e5d4be6 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -1,4 +1,6 @@
#include "mmap.h"
+#include <multiboot2.h>
+
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -7,17 +9,19 @@ __attribute__((section(".multiboot.text"))) unsigned
multiboot2_mmap(const struct multiboot_mmap_entry entries[], unsigned entry_count, unsigned bitmap[1024 * 32])
{
unsigned i, l;
+ multiboot_uint64_t avail_frames = 0;
+ multiboot_uint64_t n_frames;
+ multiboot_uint64_t table_idx;
/* clear out the bitmap */
for (i = 0; i < 1024 * 32; ++i) bitmap[i] = 0;
- unsigned avail_frames = 0;
/* loop through all the mmap_entry structures where type is MULTIBOOT_MEMORY_AVAILABLE */
for (i = 0; i < entry_count; ++i) {
if (entries[i].type != MULTIBOOT_MEMORY_AVAILABLE) continue;
/* number of frames in this entry */
- unsigned n_frames = entries[i].len / 4096;
+ n_frames = entries[i].len / 4096;
avail_frames += n_frames;
#ifdef DEBUG
@@ -26,7 +30,7 @@ multiboot2_mmap(const struct multiboot_mmap_entry entries[], unsigned entry_coun
#endif
/* the bitmap is an array of blocks, each holding 32 (2^5) values */
- unsigned table_idx = (entries[i].addr >> 17); /* get the upper 15 bits */
+ table_idx = (entries[i].addr >> 17); /* get the upper 15 bits */
while (n_frames != 0) {
if (n_frames >= 32) {