1/**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12#ifndef _ASM_SEGMENT_H 13#define _ASM_SEGMENT_H 14 15#define GDT_ENTRY_TLS_ENTRIES 3 16#define GDT_ENTRY_TLS_MIN 6 17#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1) 18 19#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) 20 21#define GDT_ENTRY_DEFAULT_USER_CS 14 22#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3) 23 24#define GDT_ENTRY_DEFAULT_USER_DS 15 25#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS * 8 + 3) 26 27#define GDT_ENTRY_KERNEL_BASE 12 28 29#define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0) 30#define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8) 31 32#define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1) 33#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) 34 35#define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) 36#define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) 37 38#define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 6) 39#define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 11) 40 41#define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14) 42#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8) 43 44#define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE + 15) 45#define __KERNEL_PERCPU 0 46 47#define GDT_ENTRY_DOUBLEFAULT_TSS 31 48 49#define GDT_ENTRIES 32 50#define GDT_SIZE (GDT_ENTRIES * 8) 51 52#define GDT_ENTRY_BOOT_CS 2 53#define __BOOT_CS (GDT_ENTRY_BOOT_CS * 8) 54 55#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1) 56#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8) 57 58#define GDT_ENTRY_PNPBIOS_CS32 (GDT_ENTRY_PNPBIOS_BASE + 0) 59#define GDT_ENTRY_PNPBIOS_CS16 (GDT_ENTRY_PNPBIOS_BASE + 1) 60#define GDT_ENTRY_PNPBIOS_DS (GDT_ENTRY_PNPBIOS_BASE + 2) 61#define GDT_ENTRY_PNPBIOS_TS1 (GDT_ENTRY_PNPBIOS_BASE + 3) 62#define GDT_ENTRY_PNPBIOS_TS2 (GDT_ENTRY_PNPBIOS_BASE + 4) 63 64#define PNP_CS32 (GDT_ENTRY_PNPBIOS_CS32 * 8) 65#define PNP_CS16 (GDT_ENTRY_PNPBIOS_CS16 * 8) 66#define PNP_DS (GDT_ENTRY_PNPBIOS_DS * 8) 67#define PNP_TS1 (GDT_ENTRY_PNPBIOS_TS1 * 8) 68#define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) 69 70#define IDT_ENTRIES 256 71 72#define SEGMENT_RPL_MASK 0x3 73 74#define SEGMENT_TI_MASK 0x4 75 76#define USER_RPL 0x3 77 78#define SEGMENT_LDT 0x4 79#define SEGMENT_GDT 0x0 80 81#define get_kernel_rpl() 0 82 83#define SEGMENT_IS_KERNEL_CODE(x) (((x) & 0xfc) == GDT_ENTRY_KERNEL_CS * 8) 84 85#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8) 86 87#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8) 88 89#endif 90