home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2MISC / CSDPMI3S.ZIP / SRC / CWSDPMI / GDT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-15  |  2.1 KB  |  71 lines

  1. /* Copyright (C) 1995,1996 CW Sandmann (sandmann@clio.rice.edu) 1206 Braelinn, Sugarland, TX 77479
  2. ** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  3. **
  4. ** This file is distributed under the terms listed in the document
  5. ** "copying.cws", available from CW Sandmann at the address above.
  6. ** A copy of "copying.cws" should accompany this file; if not, a copy
  7. ** should be available from where this file was obtained.  This file
  8. ** may not be distributed without a verbatim copy of "copying.cws".
  9. **
  10. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  11. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. */
  13. /* Modified for VCPI Implement by Y.Shibata Aug 5th 1991 */
  14.  
  15. typedef struct DESC_S {
  16. word16 lim0;
  17. word16 base0;
  18. word8 base1;
  19. word8 stype;    /* type, DT, DPL, present */
  20. word8 lim1;    /* limit, granularity */
  21. word8 base2;
  22. } DESC_S;
  23.  
  24. #ifndef run_ring
  25. #define run_ring    3    /* set for user app priv level */
  26. #endif
  27.  
  28. #define g_zero        0
  29. #define g_gdt        1
  30. #define g_idt        2
  31. #define g_rcode        3
  32. #define g_rdata        4
  33. #define g_pcode        5    /* Same as rcode but user ring! */
  34. #define g_pdata        6    /* Same as rdata but user ring! */
  35. #define g_core        7
  36. #define g_BIOSdata    8
  37.  
  38. #define g_vcpicode    9    /* for VCPI Call Selector in Protect Mode */
  39. #define g_vcpireserve0  10
  40. #define g_vcpireserve1  11
  41.  
  42. #define g_atss        12    /* set according to tss_ptr in go32() */
  43. #define g_ctss        13
  44. #define g_itss        14
  45. #define g_ldt        15
  46. #define g_iret        16
  47.  
  48. #define g_num        17
  49.  
  50. #define l_free        16
  51.  
  52. #define l_acode     16
  53. #define l_adata     17
  54. #define l_apsp        18
  55. #define l_aenv        19
  56.  
  57. #define l_num        128    /* Should be 8*MAX_AREA in paging.h (balance) */
  58.  
  59. extern DESC_S gdt[g_num];
  60. extern DESC_S ldt[l_num];
  61.  
  62. #define LDT_SEL(x)   (((x)*8) | 4 | run_ring)
  63. #define GDT_SEL(x)   (((x)*8) | run_ring)
  64. #define SEL_PRV      (run_ring << 5)
  65. #define LDT_FREE(i)  (!(ldt[i].stype))
  66. #define LDT_USED(i)  (ldt[i].stype)
  67. #define LDT_MARK_FREE(i) free_desc(i)
  68. #define LDT_CODE(i)  ((ldt[i].stype & 8))
  69. #define LDT_DATA(i)  (!(ldt[i].stype & 8))
  70. #define LDT_VALID(i) ((word16)(i) < l_num)
  71.