]> git.corax.cc Git - corax/commitdiff
Initialize the heap when starting the net daemon
authorMatthias Kruk <m@m10k.eu>
Fri, 31 Jan 2020 11:31:20 +0000 (20:31 +0900)
committerMatthias Kruk <m@m10k.eu>
Fri, 31 Jan 2020 11:31:20 +0000 (20:31 +0900)
kernel/core/net.c

index 3510057891b46ad4aa0d6a56587d8b9fe7c50426..e39f28241a9ca5b81ea8ae987a2bc2a4e5a84ba4 100644 (file)
@@ -1,14 +1,34 @@
 #include <config.h>
 #include <crxstd.h>
+#include <unistd.h>
 #include <corax/errno.h>
+#include <corax/heap.h>
 
 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);