2002-07-09 16:24:59 +04:00
|
|
|
/*
|
|
|
|
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
** Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
|
|
|
#ifndef _KERNEL_KERNEL_H
|
|
|
|
#define _KERNEL_KERNEL_H
|
|
|
|
|
2002-10-29 06:31:57 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <arch_kernel.h>
|
|
|
|
|
2002-10-29 06:31:57 +03:00
|
|
|
/* Passed in buffers from user-space shouldn't point into the kernel */
|
|
|
|
#define CHECK_USER_ADDRESS(x) \
|
|
|
|
((addr)(x) < KERNEL_BASE || (addr)(x) > KERNEL_TOP)
|
|
|
|
|
|
|
|
/** Size of the kernel stack */
|
|
|
|
#define KSTACK_SIZE (PAGE_SIZE * 2)
|
|
|
|
|
|
|
|
/** Size of the stack given to teams in user space */
|
2003-01-07 12:12:26 +03:00
|
|
|
#define MAIN_THREAD_STACK_SIZE (16 * PAGE_SIZE) // 64 kB
|
|
|
|
// BeOS: (16 * 1024 * 1024) // 16 MB
|
|
|
|
#define STACK_SIZE (16 * PAGE_SIZE)
|
|
|
|
// BeOS: (256 * 1024) // 256 kB
|
2002-10-29 06:31:57 +03:00
|
|
|
|
|
|
|
/** Size of the environmental variables space for a process */
|
|
|
|
#define ENV_SIZE (PAGE_SIZE * 8)
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
|
|
|
|
#define ROUNDOWN(a, b) (((a) / (b)) * (b))
|
|
|
|
|
2002-07-10 17:17:22 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#define CHECK_BIT(a, b) ((a) & (1 << (b)))
|
|
|
|
#define SET_BIT(a, b) ((a) | (1 << (b)))
|
|
|
|
#define CLEAR_BIT(a, b) ((a) & (~(1 << (b))))
|
|
|
|
|
|
|
|
|
2002-10-29 06:31:57 +03:00
|
|
|
#endif /* _KERNEL_KERNEL_H */
|