summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-17 01:44:55 -0400
committerIan Moffett <ian@osmora.org>2025-09-17 01:44:55 -0400
commit7f71ee15dfca8cd3e6ba4309ed768015ffbe8644 (patch)
treed147dd9ebfe80c606f16fc35e9cdf4d22b1cd33b /src/sys
parentb6983be0368bb39e3a8cbd919235b14504f1d995 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/Makefile4
-rw-r--r--src/sys/arch/amd64/Makefile2
-rw-r--r--src/sys/conf/GENERIC1
-rw-r--r--src/sys/os/Makefile2
-rw-r--r--src/sys/vm/vm_seg.c13
5 files changed, 17 insertions, 5 deletions
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 <limine.h>
#include <string.h>
+/* 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;