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 STACK_SIZE (PAGE_SIZE * 16) 20 21 /** Size of the environmental variables space for a process */ 22 #define ENV_SIZE (PAGE_SIZE * 8) 23 24 25 #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1)) 26 #define ROUNDOWN(a, b) (((a) / (b)) * (b)) 27 28 29 #define CHECK_BIT(a, b) ((a) & (1 << (b))) 30 #define SET_BIT(a, b) ((a) | (1 << (b))) 31 #define CLEAR_BIT(a, b) ((a) & (~(1 << (b)))) 32 33 34 #endif /* _KERNEL_KERNEL_H */ 35