From 9ebc403c77a6254498fd99ce41e30f17e3312370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 18 Nov 2004 17:49:12 +0000 Subject: [PATCH] Renamed KSTACK_SIZE to KERNEL_STACK_SIZE, STACK_SIZE to USER_STACK_SIZE, MAIN_THREAD_STACK_SIZE to USER_MAIN_THREAD_STACK_SIZE. Added support for stack overflow debugging: in userspace, the lower (on x86) 4 pages will be used to detect stack overflows. It's disabled for kernel stacks by default. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10013 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/kernel.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/headers/private/kernel/kernel.h b/headers/private/kernel/kernel.h index 7c056bd2d9..cd1932ae93 100644 --- a/headers/private/kernel/kernel.h +++ b/headers/private/kernel/kernel.h @@ -1,12 +1,17 @@ -/* -** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ +/* + * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ #ifndef _KERNEL_KERNEL_H #define _KERNEL_KERNEL_H #include +#include + /* Passed in buffers from user-space shouldn't point into the kernel */ #define IS_USER_ADDRESS(x) \ @@ -16,13 +21,17 @@ ((addr_t)(x) >= KERNEL_BASE && (addr_t)(x) <= KERNEL_TOP) /** Size of the kernel stack */ -#define KSTACK_SIZE (B_PAGE_SIZE * 2) +#ifndef DEBUG_KERNEL_STACKS +# define KERNEL_STACK_SIZE (B_PAGE_SIZE * 2) // 8 kB +#else +# define KERNEL_STACK_SIZE (B_PAGE_SIZE * 3) // 8 kB + one guard page +#endif +#define KERNEL_STACK_GUARD_PAGES 1 /** Size of the stack given to teams in user space */ -#define MAIN_THREAD_STACK_SIZE (16 * B_PAGE_SIZE) // 64 kB - // BeOS: (16 * 1024 * 1024) // 16 MB -#define STACK_SIZE (16 * B_PAGE_SIZE) - // BeOS: (256 * 1024) // 256 kB +#define USER_MAIN_THREAD_STACK_SIZE (16 * 1024 * 1024) // 16 MB +#define USER_STACK_SIZE (256 * 1024) // 256 kB +#define USER_STACK_GUARD_PAGES 4 // 16 kB /** Size of the environmental variables space for a process */ #define ENV_SIZE (B_PAGE_SIZE * 8)