From 6dd3aa1feec9db2eb394decbafcae0a18b8ef907 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Fri, 31 Jan 2020 20:31:20 +0900 Subject: [PATCH] Initialize the heap when starting the net daemon --- kernel/core/net.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kernel/core/net.c b/kernel/core/net.c index 3510057..e39f282 100644 --- a/kernel/core/net.c +++ b/kernel/core/net.c @@ -1,14 +1,34 @@ #include #include +#include #include +#include extern int wait(int*); +extern void heap_init(void*, u32_t); + +static inline void _init_heap(void) +{ + u32_t init_size; + u32_t base, end; + + init_size = 0x1000; + end = (unsigned)sbrk(init_size); + base = end - 0x1000; + + heap_init((void*)base, init_size); + + return; +} void _net(void) { struct cxmsg msg; int len; + /* initialize the heap */ + _init_heap(); + while(1) { len = cxrecv(PID_ANY, &msg); -- 2.47.3