summaryrefslogtreecommitdiff
path: root/src/kernel/mm
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:13:08 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:13:08 +0800
commit10614e04929a6d109a5e90524e446b637aaf0c13 (patch)
treeeb11aeb7b641187f207e3b572c5184cf3526b463 /src/kernel/mm
parent1c8e37f63d413a559825020289178d442537449e (diff)
downloadlume-10614e04929a6d109a5e90524e446b637aaf0c13.tar.gz
lume-10614e04929a6d109a5e90524e446b637aaf0c13.tar.xz
Fix: critical malloc size calculation bug
Summary: - Fixed an integer arithmetic error in malloc() where 'nunits' was initialized to 0, causing incorrect heap sizing. - This bug caused malloc to return pointers pointing to unmapped memory pages, leading to Store Page Fault (scause 15) at process boundaries. - Switched memory allocator logic to use byte-based size calculation instead of K&R style units to prevent off-by-one errors. Improvements: - Shell now starts successfully without segfaults.
Diffstat (limited to 'src/kernel/mm')
-rw-r--r--src/kernel/mm/vm.cc3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/kernel/mm/vm.cc b/src/kernel/mm/vm.cc
index 41d1aa1..1155d2c 100644
--- a/src/kernel/mm/vm.cc
+++ b/src/kernel/mm/vm.cc
@@ -5,9 +5,6 @@
#include "lib/string.h"
#include "drivers/uart.h"
-// COW Flag (PTE bit 8)
-#define PTE_COW (1L << 8)
-
extern "C"
{
extern char kernel_end[];