segment.h 669 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _ASM_X86_SEGMENT_H_
  2. #define _ASM_X86_SEGMENT_H_
  3. #ifdef CONFIG_X86_32
  4. # include "segment_32.h"
  5. #else
  6. # include "segment_64.h"
  7. #endif
  8. #ifndef CONFIG_PARAVIRT
  9. #define get_kernel_rpl() 0
  10. #endif
  11. /* User mode is privilege level 3 */
  12. #define USER_RPL 0x3
  13. /* LDT segment has TI set, GDT has it cleared */
  14. #define SEGMENT_LDT 0x4
  15. #define SEGMENT_GDT 0x0
  16. /* Bottom two bits of selector give the ring privilege level */
  17. #define SEGMENT_RPL_MASK 0x3
  18. /* Bit 2 is table indicator (LDT/GDT) */
  19. #define SEGMENT_TI_MASK 0x4
  20. #define IDT_ENTRIES 256
  21. #define GDT_SIZE (GDT_ENTRIES * 8)
  22. #define GDT_ENTRY_TLS_ENTRIES 3
  23. #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
  24. #endif