From 7f71ee15dfca8cd3e6ba4309ed768015ffbe8644 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 17 Sep 2025 01:44:55 -0400 Subject: kern: Make memmap dump configurable via kconf Use the OSMORA kernel configuration framework to add options for L5Lunos to parse during early startup. Signed-off-by: Ian Moffett --- src/sys/Makefile | 4 ++-- src/sys/arch/amd64/Makefile | 2 +- src/sys/conf/GENERIC | 1 + src/sys/os/Makefile | 2 +- src/sys/vm/vm_seg.c | 13 ++++++++++++- 5 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 src/sys/conf/GENERIC (limited to 'src/sys') diff --git a/src/sys/Makefile b/src/sys/Makefile index 561da50..78c3762 100644 --- a/src/sys/Makefile +++ b/src/sys/Makefile @@ -10,11 +10,11 @@ all: os lib md .PHONY: os os: - cd os; make CC=$(CC) LD=$(LD) AS=$(AS) TARGETDIR=$(TARGETDIR) + cd os; make CC=$(CC) LD=$(LD) AS=$(AS) TARGETDIR=$(TARGETDIR) CONF=$(CONF) .PHONY: md md: - cd $(TARGETDIR); make CC=$(CC) LD=$(LD) AS=$(AS) + cd $(TARGETDIR); make CC=$(CC) LD=$(LD) AS=$(AS) CONF=$(CONF) .PHONY: clean clean: diff --git a/src/sys/arch/amd64/Makefile b/src/sys/arch/amd64/Makefile index f4f4f48..1eae962 100644 --- a/src/sys/arch/amd64/Makefile +++ b/src/sys/arch/amd64/Makefile @@ -4,7 +4,7 @@ override PROMPT := printf "%s\t\t%s\n" TARGET_BIN = ../../l5 TARGET_INC = -I../../target/header/ -CFLAGS = -I../../include/ -I../../include/lib/ $(TARGET_INC) $(MI_CFLAGS) $(MD_CFLAGS) +CFLAGS = -I../../include/ -I../../include/lib/ $(TARGET_INC) $(MI_CFLAGS) $(MD_CFLAGS) $(CONF) CFILES = $(shell find . -name "*.c") ASMFILES = $(shell find . -name "*.S") diff --git a/src/sys/conf/GENERIC b/src/sys/conf/GENERIC new file mode 100644 index 0000000..816ece3 --- /dev/null +++ b/src/sys/conf/GENERIC @@ -0,0 +1 @@ +option DUMP_MEMMAP yes // Dump memory map on boot diff --git a/src/sys/os/Makefile b/src/sys/os/Makefile index 158eab4..693c008 100644 --- a/src/sys/os/Makefile +++ b/src/sys/os/Makefile @@ -4,7 +4,7 @@ include ../conf/sys.mk override PROMPT := printf "%s\t\t%s\n" TARGET_LIB = ../target/libkern.a -CFLAGS = -I../include/ -I../include/lib/ -I../target/header/ $(MI_CFLAGS) -O0 +CFLAGS = -I../include/ -I../include/lib/ -I../target/header/ $(MI_CFLAGS) -O0 $(CONF) CFILES = $(shell find . -name "*.c") CFILES += $(shell find ../vm -name "*.c") CFILES += $(shell find ../lib -name "*.c") diff --git a/src/sys/vm/vm_seg.c b/src/sys/vm/vm_seg.c index d4db468..682a61c 100644 --- a/src/sys/vm/vm_seg.c +++ b/src/sys/vm/vm_seg.c @@ -37,6 +37,13 @@ #include #include +/* From kconf */ +#if defined(__DUMP_MEMMAP) +#define DUMP_MEMMAP __DUMP_MEMMAP +#else +#define DUMP_MEMMAP 0 +#endif + #define BYTES_PER_MIB 8388608 static size_t pages_free = 0; @@ -147,7 +154,11 @@ physmem_init_bitmap(void) start = ent->base; end = ent->base + ent->length; - printf("sysmem: [%p -> %p]: %s\n", start, end, typestr); + + /* Should we dump the memory map? */ + if (DUMP_MEMMAP) { + printf("sysmem: [%p -> %p]: %s\n", start, end, typestr); + } if (ent->type != LIMINE_MEMMAP_USABLE) { continue; -- cgit v1.2.3