Compare commits

...
Author SHA1 Message Date
3dacb8d3f4 mem: fix up fancy memory map printout
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-07-17 16:14:41 -04:00
08207f0782 Makefile: fix build bug "make run"
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-07-17 16:13:44 -04:00
2 changed files with 17 additions and 6 deletions

View file

@ -79,12 +79,13 @@ default:
all: $(KERNEL)
$(Q)compiledb -n make
.PHONY: __build_all
__build_all:
$(Q)$(MAKE) --no-print-directory -f scripts/Makefile.build _all obj=.
$(KOBJ): __build_all
$(KERNEL): $(KOBJ) linker.ld
$(KERNEL): $(KOBJ) built-in.o linker.ld
$(Q)echo " LD $@"
$(Q)$(LD) $(KOBJ) $(LDFLAGS) -T linker.ld -o $@

View file

@ -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()