1 /* 2 * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed 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_DESCRIPTORS_H 9 #define _KERNEL_ARCH_x86_DESCRIPTORS_H 10 11 12 #define DPL_KERNEL 0 13 #define DPL_USER 3 14 15 16 #ifndef _ASSEMBLER 17 18 19 #include <SupportDefs.h> 20 21 22 struct kernel_args; 23 24 25 enum descriptor_types { 26 // segment types 27 DT_CODE_EXECUTE_ONLY = 0x8, 28 DT_CODE_ACCESSED = 0x9, 29 DT_CODE_READABLE = 0xa, 30 DT_CODE_CONFORM = 0xc, 31 DT_DATA_READ_ONLY = 0x0, 32 DT_DATA_ACCESSED = 0x1, 33 DT_DATA_WRITEABLE = 0x2, 34 DT_DATA_EXPANSION_DOWN = 0x4, 35 36 DT_TSS = 9, 37 /* non busy, 32 bit */ 38 39 // descriptor types 40 DT_SYSTEM_SEGMENT = 0, 41 DT_CODE_DATA_SEGMENT = 1, 42 }; 43 44 enum gate_types { 45 GATE_INTERRUPT = 14, 46 GATE_TRAP = 15, 47 }; 48 49 50 void x86_descriptors_preboot_init_percpu(kernel_args* args, int cpu); 51 void x86_descriptors_init(kernel_args* args); 52 53 54 #endif // !_ASSEMBLER 55 56 57 #ifdef __x86_64__ 58 # include <arch/x86/64/descriptors.h> 59 #else 60 # include <arch/x86/32/descriptors.h> 61 #endif 62 63 64 #endif /* _KERNEL_ARCH_x86_DESCRIPTORS_H */ 65