From e134202611a50b358c147c92bfb8a7f443030b8b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 8 Jul 2024 17:43:59 +0300 Subject: fix LLVM + Anything extern is right out as LLVM doesn't produce correct code for them. Maybe if I added some extra attributes but I'm skeptical. Replaced with static variables and getters/setters. + Inline ASM is apparently a bit buggy, so use an assembly stub when jumping to init. + Minimize work done in main() to minimize chance of LLVM doing something silly. Still not 100% certain that I shouldn't just write the main() as an assembly stub in arch/riscv64 to be absolutely sure everything works as intended. + Make .kernel.start section SHF_ALLOC, otherwise lld complains about pc-relative addressing Probably some other stuff as well that I'm forgetting right now. But at least with LLVM14 LTO seems to work, which is pretty cool? --- src/uapi/conf.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/uapi/conf.c') diff --git a/src/uapi/conf.c b/src/uapi/conf.c index be9abfc..3a45d30 100644 --- a/src/uapi/conf.c +++ b/src/uapi/conf.c @@ -16,11 +16,24 @@ #include -/** \todo stack size should really be set on a per-thread basis, and are the - * conf*-syscalls even necessary? */ -size_t __thread_stack_size = SZ_2M; -size_t __rpc_stack_size = SZ_512K; +/** \todo stack size should probably be set on a per-thread basis */ +/** Current global thread stack size. */ +static size_t __thread_stack_size = SZ_2M; + +/** Current global RPC stack entry size. */ +static size_t __rpc_stack_size = SZ_512K; + + +size_t thread_stack_size() +{ + return __thread_stack_size; +} + +size_t rpc_stack_size() +{ + return __rpc_stack_size; +} /** * Configuration parameter read syscall handler. -- cgit v1.3