mem: fix up fancy memory map printout
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
08207f0782
commit
3dacb8d3f4
1 changed files with 15 additions and 5 deletions
20
mem/mem.c
20
mem/mem.c
|
|
@ -29,17 +29,20 @@ static void mem_init_zones()
|
|||
struct mem_zone *last;
|
||||
static const char *grid[] = {"Entry", "Physical base", "Length", "Type"};
|
||||
|
||||
int grid_width = kprintf("| %-5s | %-18s | %-18s | %-22s |\n", grid[0], grid[1], grid[2], grid[3]);
|
||||
kprintf("|");
|
||||
for (int i = 0; i < grid_width - 3; i++) {
|
||||
#ifdef KDEBUG
|
||||
int grid_width = kdebug("| %-5s | %-16s | %-16s | %-22s |\n", grid[0], grid[1], grid[2], grid[3]);
|
||||
kdebug("|");
|
||||
for (int i = 0; i < grid_width - 17; i++) {
|
||||
kprintf("-");
|
||||
}
|
||||
kprintf("|\n");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < map->entry_count; i++) {
|
||||
struct limine_memmap_entry *ent = kern_map_res->entries[i];
|
||||
if (ARRAY_SIZE(zone_type_strings) > ent->type)
|
||||
kprintf("| %-5d | 0x%-16x | 0x%-16x | %-22s |\n", i, ent->base, ent->length, zone_type_strings[ent->type]);
|
||||
if (ARRAY_SIZE(zone_type_strings) > ent->type) {
|
||||
kdebug("| %05d | %016llx | %16llx | %-22s |\n", i, ent->base, ent->length, zone_type_strings[ent->type]);
|
||||
}
|
||||
|
||||
bool usable;
|
||||
switch (ent->type) {
|
||||
|
|
@ -74,6 +77,13 @@ static void mem_init_zones()
|
|||
|
||||
last_usable = usable;
|
||||
}
|
||||
#ifdef KDEBUG
|
||||
kdebug("|");
|
||||
for (int i = 0; i < grid_width - 17; i++) {
|
||||
kprintf("-");
|
||||
}
|
||||
kprintf("|\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void mem_init()
|
||||
|
|
|
|||
Loading…
Reference in a new issue