ldt.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * ldt.h
  4. *
  5. * Definitions of structures used with the modify_ldt system call.
  6. */
  7. #ifndef _ASM_X86_LDT_H
  8. #define _ASM_X86_LDT_H
  9. /* Maximum number of LDT entries supported. */
  10. #define LDT_ENTRIES 8192
  11. /* The size of each LDT entry. */
  12. #define LDT_ENTRY_SIZE 8
  13. #ifndef __ASSEMBLY__
  14. /*
  15. * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS
  16. * not to the default values if you still want to do syscalls. This
  17. * call is more for 32bit mode therefore.
  18. */
  19. struct user_desc {
  20. unsigned int entry_number;
  21. unsigned int base_addr;
  22. unsigned int limit;
  23. unsigned int seg_32bit:1;
  24. unsigned int contents:2;
  25. unsigned int read_exec_only:1;
  26. unsigned int limit_in_pages:1;
  27. unsigned int seg_not_present:1;
  28. unsigned int useable:1;
  29. #ifdef __x86_64__
  30. /*
  31. * Because this bit is not present in 32-bit user code, user
  32. * programs can pass uninitialized values here. Therefore, in
  33. * any context in which a user_desc comes from a 32-bit program,
  34. * the kernel must act as though lm == 0, regardless of the
  35. * actual value.
  36. */
  37. unsigned int lm:1;
  38. #endif
  39. };
  40. #define MODIFY_LDT_CONTENTS_DATA 0
  41. #define MODIFY_LDT_CONTENTS_STACK 1
  42. #define MODIFY_LDT_CONTENTS_CODE 2
  43. #endif /* !__ASSEMBLY__ */
  44. #endif /* _ASM_X86_LDT_H */