From d7e292a9f84dbbc95bbc443ad6f4573a61e8d6cf Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 4 Apr 2026 23:30:10 +0300 Subject: [PATCH] Kernel: Drop 32 bit userspace stack to 4 MiB 32 bit userspace only has 256 MiB reserved for stacks, so with 32 MiB stacks it only allowed total of 7 threads. Now we can have up to 62 threads --- kernel/include/kernel/Thread.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/include/kernel/Thread.h b/kernel/include/kernel/Thread.h index 2fd2a90d..9c3c9e4f 100644 --- a/kernel/include/kernel/Thread.h +++ b/kernel/include/kernel/Thread.h @@ -38,8 +38,12 @@ namespace Kernel // stack overflows on some machines with 8 page stack static constexpr size_t kernel_stack_size { PAGE_SIZE * 16 }; - // TODO: userspace stack is hard limited to 32 MiB, maybe make this dynamic? + // TODO: userspace stack size is hard limited, maybe make this dynamic? +#if ARCH(x86_64) static constexpr size_t userspace_stack_size { 32 << 20 }; +#elif ARCH(i686) + static constexpr size_t userspace_stack_size { 4 << 20 }; +#endif public: static BAN::ErrorOr create_kernel(entry_t, void*);