From 4e4cdacab3a251983ffc1fa3974a75fe7d7e2dc5 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 2 Dec 2016 14:53:01 +0100 Subject: [PATCH] base: trim main-thread size to 4/8 KiB The main thread does no longer execute application code. It is solely responsible for the initialization of the component's entrypoint and for retrieving asynchronous notifications. Since the stack usage is no longer dependent on application-specific code, we can significantly shrink it to reduce the memory footprint of components. In the worst case - should the stack overrun - we would observe a page fault because the stack is placed in the stack area, surrounded by guard pages. --- repos/base/src/lib/startup/init_main_thread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/base/src/lib/startup/init_main_thread.cc b/repos/base/src/lib/startup/init_main_thread.cc index 4d714a52a4..da5104ad2b 100644 --- a/repos/base/src/lib/startup/init_main_thread.cc +++ b/repos/base/src/lib/startup/init_main_thread.cc @@ -32,7 +32,7 @@ namespace Genode { extern Region_map * env_stack_area_region_map; } void prepare_init_main_thread(); -enum { MAIN_THREAD_STACK_SIZE = 16UL * 1024 * sizeof(Genode::addr_t) }; +enum { MAIN_THREAD_STACK_SIZE = 1024*sizeof(Genode::addr_t) }; /** * Satisfy crt0.s in static programs, LDSO overrides this symbol