xref: /haiku/headers/private/kernel/kernel.h (revision 67bce78b48ed6d01b5a8eef89f5694c372b7e0a1)
1 /*
2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #ifndef _KERNEL_KERNEL_H
6 #define _KERNEL_KERNEL_H
7 
8 
9 #include <arch_kernel.h>
10 
11 /* Passed in buffers from user-space shouldn't point into the kernel */
12 #define IS_USER_ADDRESS(x) \
13 	((addr_t)(x) < KERNEL_BASE || (addr_t)(x) > KERNEL_TOP)
14 
15 #define IS_KERNEL_ADDRESS(x) \
16 	((addr_t)(x) >= KERNEL_BASE && (addr_t)(x) <= KERNEL_TOP)
17 
18 /** Size of the kernel stack */
19 #define KSTACK_SIZE	(PAGE_SIZE * 2)
20 
21 /** Size of the stack given to teams in user space */
22 #define MAIN_THREAD_STACK_SIZE	(16 * PAGE_SIZE)	// 64 kB
23 	// BeOS: (16 * 1024 * 1024)	// 16 MB
24 #define STACK_SIZE				(16 * PAGE_SIZE)
25 	// BeOS: (256 * 1024)		// 256 kB
26 
27 /** Size of the environmental variables space for a process */
28 #define ENV_SIZE	(PAGE_SIZE * 8)
29 
30 
31 #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
32 #define ROUNDOWN(a, b) (((a) / (b)) * (b))
33 
34 
35 #define CHECK_BIT(a, b) ((a) & (1 << (b)))
36 #define SET_BIT(a, b) ((a) | (1 << (b)))
37 #define CLEAR_BIT(a, b) ((a) & (~(1 << (b))))
38 
39 
40 #endif	/* _KERNEL_KERNEL_H */
41