host_ldt.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __ASM_HOST_LDT_X86_64_H
  2. #define __ASM_HOST_LDT_X86_64_H
  3. #include <asm/ldt.h>
  4. /*
  5. * macros stolen from include/asm-x86_64/desc.h
  6. */
  7. #define LDT_entry_a(info) \
  8. ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
  9. /* Don't allow setting of the lm bit. It is useless anyways because
  10. * 64bit system calls require __USER_CS. */
  11. #define LDT_entry_b(info) \
  12. (((info)->base_addr & 0xff000000) | \
  13. (((info)->base_addr & 0x00ff0000) >> 16) | \
  14. ((info)->limit & 0xf0000) | \
  15. (((info)->read_exec_only ^ 1) << 9) | \
  16. ((info)->contents << 10) | \
  17. (((info)->seg_not_present ^ 1) << 15) | \
  18. ((info)->seg_32bit << 22) | \
  19. ((info)->limit_in_pages << 23) | \
  20. ((info)->useable << 20) | \
  21. /* ((info)->lm << 21) | */ \
  22. 0x7000)
  23. #define LDT_empty(info) (\
  24. (info)->base_addr == 0 && \
  25. (info)->limit == 0 && \
  26. (info)->contents == 0 && \
  27. (info)->read_exec_only == 1 && \
  28. (info)->seg_32bit == 0 && \
  29. (info)->limit_in_pages == 0 && \
  30. (info)->seg_not_present == 1 && \
  31. (info)->useable == 0 && \
  32. (info)->lm == 0)
  33. #endif