From 10614e04929a6d109a5e90524e446b637aaf0c13 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 3 Jan 2026 02:13:08 +0800 Subject: 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. --- build/src/kernel/trap/handler.o | Bin 71232 -> 72624 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'build/src/kernel/trap/handler.o') diff --git a/build/src/kernel/trap/handler.o b/build/src/kernel/trap/handler.o index 44a2baa..bd42409 100644 Binary files a/build/src/kernel/trap/handler.o and b/build/src/kernel/trap/handler.o differ -- cgit v1.2.3