desc.h 769 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _ASM_DESC_H_
  2. #define _ASM_DESC_H_
  3. #ifndef __ASSEMBLY__
  4. #include <asm/desc_defs.h>
  5. #include <asm/ldt.h>
  6. static inline void fill_ldt(struct desc_struct *desc, struct user_desc *info)
  7. {
  8. desc->limit0 = info->limit & 0x0ffff;
  9. desc->base0 = info->base_addr & 0x0000ffff;
  10. desc->base1 = (info->base_addr & 0x00ff0000) >> 16;
  11. desc->type = (info->read_exec_only ^ 1) << 1;
  12. desc->type |= info->contents << 2;
  13. desc->s = 1;
  14. desc->dpl = 0x3;
  15. desc->p = info->seg_not_present ^ 1;
  16. desc->limit = (info->limit & 0xf0000) >> 16;
  17. desc->avl = info->useable;
  18. desc->d = info->seg_32bit;
  19. desc->g = info->limit_in_pages;
  20. desc->base2 = (info->base_addr & 0xff000000) >> 24;
  21. }
  22. #endif
  23. #ifdef CONFIG_X86_32
  24. # include "desc_32.h"
  25. #else
  26. # include "desc_64.h"
  27. #endif
  28. #endif