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 CHECK_USER_ADDRESS(x) \ 13 ((addr)(x) < KERNEL_BASE || (addr)(x) > KERNEL_TOP) 14 15 /** Size of the kernel stack */ 16 #define KSTACK_SIZE (PAGE_SIZE * 2) 17 18 /** Size of the stack given to teams in user space */ 19 #define MAIN_THREAD_STACK_SIZE (16 * PAGE_SIZE) // 64 kB 20 // BeOS: (16 * 1024 * 1024) // 16 MB 21 #define STACK_SIZE (16 * PAGE_SIZE) 22 // BeOS: (256 * 1024) // 256 kB 23 24 /** Size of the environmental variables space for a process */ 25 #define ENV_SIZE (PAGE_SIZE * 8) 26 27 28 #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1)) 29 #define ROUNDOWN(a, b) (((a) / (b)) * (b)) 30 31 32 #define CHECK_BIT(a, b) ((a) & (1 << (b))) 33 #define SET_BIT(a, b) ((a) | (1 << (b))) 34 #define CLEAR_BIT(a, b) ((a) & (~(1 << (b)))) 35 36 37 #endif /* _KERNEL_KERNEL_H */ 38