+#if !CONFIG_KERN_HEAP
+/*
+ * NOTE: threads are never destroyed, consequently these stacks are never
+ * deallocated. So, the stack allocator can be implemented as a simple index
+ * that is atomically incremented at each allocation.
+ */
+static cpu_stack_t thread_stack[MAX_THREAD_CNT]
+ [DEFAULT_THREAD_STACKSIZE / sizeof(cpu_stack_t)]
+ ALIGNED(sizeof(cpu_stack_t));
+static int last_stack;
+#endif
+
+sys_thread_t sys_thread_new(const char *name, void (* thread)(void *arg),