From 7648b5a7b22ae3b3e3a3fa39fd83bce06554385d Mon Sep 17 00:00:00 2001 From: turret Date: Mon, 18 Dec 2023 18:40:19 -0600 Subject: init: minor optimisations move spin locks to dedicated function so we can minimise repetition of code. now uses more C and less assembly. init.c uses 8192 * 512 as a maximum even if the stack rlimit is larger --- init/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init/init.c') diff --git a/init/init.c b/init/init.c index e2ece8a..806792f 100644 --- a/init/init.c +++ b/init/init.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -71,7 +72,7 @@ int main(void) struct rlimit *stack_rlimit = malloc(sizeof(struct rlimit)); getrlimit(RLIMIT_STACK, stack_rlimit); if(stack_rlimit->rlim_cur != RLIM_INFINITY) { - stack_size = stack_rlimit->rlim_cur; + stack_size = MIN(stack_rlimit->rlim_cur, stack_size); } free(stack_rlimit); -- cgit v1.2.3