1 /* 2 * Copyright 2004-2008, Haiku Inc. All rights reserved. 3 * Distributes under the terms of the MIT license. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_ARCH_x86_KERNEL_H 9 #define _KERNEL_ARCH_x86_KERNEL_H 10 11 #ifndef _ASSEMBLER 12 # include <arch/cpu.h> 13 #endif 14 15 // memory layout 16 #define KERNEL_BASE 0x80000000 17 #define KERNEL_SIZE 0x80000000 18 #define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1)) 19 20 /* User space layout is a little special: 21 * The user space does not completely cover the space not covered by the 22 * kernel. There is a gap of 64kb between the user and kernel space. The 64kb 23 * region assures a user space thread cannot pass a buffer into the kernel as 24 * part of a syscall that would cross into kernel space. 25 * Furthermore no areas are placed in the lower 1Mb unless the application 26 * explicitly requests it to find null pointer references. 27 * TODO: introduce the 1Mb lower barrier again - it's only used for vm86 mode, 28 * and this should be moved into the kernel (and address space) completely. 29 */ 30 #define USER_BASE 0x00 31 #define USER_BASE_ANY 0x100000 32 #define USER_SIZE (KERNEL_BASE - 0x10000) 33 #define USER_TOP (USER_BASE + USER_SIZE) 34 35 #define KERNEL_USER_DATA_BASE 0x6fff0000 36 #define USER_STACK_REGION 0x70000000 37 #define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION) 38 39 #endif /* _KERNEL_ARCH_x86_KERNEL_H */ 40