home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / INFOSEG.H < prev    next >
C/C++ Source or Header  |  1995-04-14  |  11KB  |  287 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  4. /*                                                                           */
  5. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  6. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  7. /*    drivers. You may use this code in accordance with the IBM License      */
  8. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  9. /*    Copyright statement may not be removed.                                */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12. /*static char *SCCSID = "h/infoseg.h, h, ddk_subset, b_207f.032 92/06/18";*/
  13. /*static char *SCCSID = "h/infoseg.h, h, ddk_subset, b_207f.032 92/06/18";*/
  14. /*
  15.  *      InfoSeg Data Structures
  16.  */
  17.  
  18. /*
  19.  * The structure below defines the content and organization of the system
  20.  * information segment (InfoSeg).  The actual table is statically defined in
  21.  * SDATA.ASM.  Ring 0, read/write access is obtained by the clock device
  22.  * driver using the DevHlp GetDOSVar function.  (GetDOSVar returns a ring 0,
  23.  * read-only selector to all other requestors.)
  24.  *
  25.  * In order to prevent an errant process from destroying the infoseg, two
  26.  * identical global infosegs are maintained.  One is in the tiled shared
  27.  * arena and is accessible in user mode (and therefore can potentially be
  28.  * overwritten from ring 2), and the other is in the system arena and is
  29.  * accessible only in kernel mode.  All kernel code (except the clock driver)
  30.  * is responsible for updating BOTH copies of the infoseg.  The copy kept
  31.  * in the system arena is addressable as DOSGROUP:SISData, and the copy
  32.  * in the shared arena is addressable via a system arena alias.  16:16 and
  33.  * 0:32 pointers to the alias are stored in _Sis2.
  34.  */
  35.  
  36. struct InfoSegGDT {
  37.  
  38. /* Time (offset 0x00) */
  39.  
  40. unsigned long   SIS_BigTime;    /* Time from 1-1-1970 in seconds */
  41. unsigned long   SIS_MsCount;    /* Freerunning milliseconds counter */
  42. unsigned char   SIS_HrsTime;    /* Hours */
  43. unsigned char   SIS_MinTime;    /* Minutes */
  44. unsigned char   SIS_SecTime;    /* Seconds */
  45. unsigned char   SIS_HunTime;    /* Hundredths of seconds */
  46. unsigned short  SIS_TimeZone;   /* Timezone in min from GMT (Set to EST) */
  47. unsigned short  SIS_ClkIntrvl;  /* Timer interval (units=0.0001 secs) */
  48.  
  49. /* Date (offset 0x10) */
  50.  
  51. unsigned char   SIS_DayDate;    /* Day-of-month (1-31) */
  52. unsigned char   SIS_MonDate;    /* Month (1-12) */
  53. unsigned short  SIS_YrsDate;    /* Year (>= 1980) */
  54. unsigned char   SIS_DOWDate;    /* Day-of-week (1-1-80 = Tues = 3) */
  55.  
  56. /* Version (offset 0x15) */
  57.  
  58. unsigned char   SIS_VerMajor;   /* Major version number */
  59. unsigned char   SIS_VerMinor;   /* Minor version number */
  60. unsigned char   SIS_RevLettr;   /* Revision letter */
  61.  
  62. /* System Status (offset 0x18) */
  63.  
  64. /* XLATOFF */
  65. #ifdef  OLDVER
  66. unsigned char   CurScrnGrp;     /* Fgnd screen group # */
  67. #else
  68. /* XLATON */
  69. unsigned char   SIS_CurScrnGrp; /* Fgnd screen group # */
  70. /* XLATOFF */
  71. #endif
  72. /* XLATON */
  73. unsigned char   SIS_MaxScrnGrp; /* Maximum number of screen groups */
  74. unsigned char   SIS_HugeShfCnt; /* Shift count for huge segments */
  75. unsigned char   SIS_ProtMdOnly; /* Protect-mode-only indicator */
  76. unsigned short  SIS_FgndPID;    /* Foreground process ID */
  77.  
  78. /* Scheduler Parms (offset 0x1E) */
  79.  
  80. unsigned char   SIS_Dynamic;    /* Dynamic variation flag (1=enabled) */
  81. unsigned char   SIS_MaxWait;    /* Maxwait (seconds) */
  82. unsigned short  SIS_MinSlice;   /* Minimum timeslice (milliseconds) */
  83. unsigned short  SIS_MaxSlice;   /* Maximum timeslice (milliseconds) */
  84.  
  85. /* Boot Drive (offset 0x24) */
  86.  
  87. unsigned short  SIS_BootDrv;    /* Drive from which system was booted */
  88.  
  89. /* RAS Major Event Code Table (offset 0x26) */
  90.  
  91. unsigned char   SIS_mec_table[32]; /* Table of RAS Major Event Codes (MECs) */
  92.  
  93. /* Additional Session Data (offset 0x46) */
  94.  
  95. unsigned char   SIS_MaxVioWinSG;  /* Max. no. of VIO windowable SG's */
  96. unsigned char   SIS_MaxPresMgrSG; /* Max. no. of Presentation Manager SG's */
  97.  
  98. /* Error logging Information (offset 0x48) */
  99.  
  100. unsigned short  SIS_SysLog;     /* Error Logging Status */
  101.  
  102. /* Additional RAS Information (offset 0x4A) */
  103.  
  104. unsigned short  SIS_MMIOBase;   /* Memory mapped I/O selector */
  105. unsigned long   SIS_MMIOAddr;   /* Memory mapped I/O address  */
  106.  
  107. /* Additional 2.0 Data (offset 0x50) */
  108.  
  109. unsigned char   SIS_MaxVDMs;      /* Max. no. of Virtual DOS machines */
  110. unsigned char   SIS_Reserved;
  111. };
  112.  
  113. #define SIS_LEN         sizeof(struct InfoSegGDT)
  114.  
  115. /* ASM
  116. SIS_TIMELEN     equ     21      ; size of time and date fields
  117.         .errnz  SIS_BigTime
  118.         .errnz  SIS_VerMajor - SIS_TIMELEN
  119. */
  120.  
  121.  
  122. /* XLATOFF */
  123. /*
  124.  *      The following definitions exist purely for compatibility
  125.  *      with earlier versions of this file.  If new fields are
  126.  *      added to the Global Infoseg, there is no need to add
  127.  *      defines for them to this section.
  128.  */
  129.  
  130. #define BigTime         SIS_BigTime
  131. #define MsCount         SIS_MsCount
  132. #define HrsTime         SIS_HrsTime
  133. #define MinTime         SIS_MinTime
  134. #define SecTime         SIS_SecTime
  135. #define HunTime         SIS_HunTime
  136. #define TimeZone        SIS_TimeZone
  137. #define ClkIntrvl       SIS_ClkIntrvl
  138. #define DayDate         SIS_DayDate
  139. #define MonDate         SIS_MonDate
  140. #define YrsDate         SIS_YrsDate
  141. #define DOWDate         SIS_DOWDate
  142. #define VerMajor        SIS_VerMajor
  143. #define VerMinor        SIS_VerMinor
  144. #define RevLettr        SIS_RevLettr
  145. #define MaxScrnGrp      SIS_MaxScrnGrp
  146. #define HugeShfCnt      SIS_HugeShfCnt
  147. #define ProtMdOnly      SIS_ProtMdOnly
  148. #define FgndPID         SIS_FgndPID
  149. #define Dynamic         SIS_Dynamic
  150. #define MaxWait         SIS_MaxWait
  151. #define MinSlice        SIS_MinSlice
  152. #define MaxSlice        SIS_MaxSlice
  153. #define BootDrv         SIS_BootDrv
  154. #define mec_table       SIS_mec_table
  155. #define MaxVioWinSG     SIS_MaxVioWinSG
  156. #define MaxPresMgrSG    SIS_MaxPresMgrSG
  157. #define SysLog          SIS_SysLog
  158. #ifdef MMIOPH
  159. #define MMIOBase        SIS_MMIOBase
  160. #endif
  161. /* XLATON */
  162.  
  163.  
  164.  
  165. /*
  166.  *      InfoSeg LDT Data Segment Structure
  167.  *
  168.  * The structure below defines the content and organization of the system
  169.  * information in a special per-process segment to be accessible by the
  170.  * process through the LDT (read-only).
  171.  *
  172.  * As in the global infoseg, two copies of the current processes local
  173.  * infoseg exist, one accessible in both user and kernel mode, the other
  174.  * only in kernel mode.  Kernel code is responsible for updating BOTH copies.
  175.  * Pointers to the local infoseg copy are stored in _Lis2.
  176.  *
  177.  * Note that only the currently running process has an extra copy of the
  178.  * local infoseg.  The copy is done at context switch time.
  179.  */
  180.  
  181. struct InfoSegLDT {
  182.  
  183. unsigned short  LIS_CurProcID;  /* Current process ID */
  184. unsigned short  LIS_ParProcID;  /* Process ID of parent */
  185. unsigned short  LIS_CurThrdPri; /* Current thread priority */
  186. unsigned short  LIS_CurThrdID;  /* Current thread ID */
  187. /* XLATOFF */
  188. #ifdef  OLDVER
  189. unsigned short  CurScrnGrp;     /* Screengroup */
  190. #else
  191. /* XLATON */
  192. unsigned short  LIS_CurScrnGrp; /* Screengroup */
  193. /* XLATOFF */
  194. #endif
  195. /* XLATON */
  196. unsigned char   LIS_ProcStatus; /* Process status bits */
  197. unsigned char   LIS_fillbyte1;  /* filler byte */
  198. unsigned short  LIS_Fgnd;       /* Current process is in foreground */
  199. unsigned char   LIS_ProcType;   /* Current process type */
  200. unsigned char   LIS_fillbyte2;  /* filler byte */
  201.  
  202. unsigned short  LIS_AX;         /* @@V1 Environment selector */
  203. unsigned short  LIS_BX;         /* @@V1 Offset of command line start */
  204. unsigned short  LIS_CX;         /* @@V1 Length of Data Segment */
  205. unsigned short  LIS_DX;         /* @@V1 STACKSIZE from the .EXE file */
  206. unsigned short  LIS_SI;         /* @@V1 HEAPSIZE  from the .EXE file */
  207. unsigned short  LIS_DI;         /* @@V1 Module handle of the application */
  208. unsigned short  LIS_DS;         /* @@V1 Data Segment Handle of application */
  209.  
  210. unsigned short  LIS_PackSel;    /* First tiled selector in this EXE */
  211. unsigned short  LIS_PackShrSel; /* First selector above shared arena */
  212. unsigned short  LIS_PackPckSel; /* First selector above packed arena */
  213. };
  214.  
  215. #define LIS_RealMode    LIS_ProcType
  216. #define LIS_LEN         sizeof(struct InfoSegLDT)
  217.  
  218.  
  219. /* XLATOFF */
  220. /*
  221.  *      The following definitions exist purely for compatibility
  222.  *      with earlier versions of this file.  If new fields are
  223.  *      added to the Local Infoseg, there is no need to add
  224.  *      defines for them to this section.
  225.  */
  226.  
  227. #define CurProcID       LIS_CurProcID
  228. #define ParProcID       LIS_ParProcID
  229. #define CurThrdPri      LIS_CurThrdPri
  230. #define CurThrdID       LIS_CurThrdID
  231. #define ProcStatus      LIS_ProcStatus
  232. #define fillbyte1       LIS_fillbyte1
  233. #define Fgnd            LIS_Fgnd
  234. #define ProcType        LIS_ProcType
  235. #define fillbyte2       LIS_fillbyte2
  236. /* XLATON */
  237.  
  238.  
  239.  
  240.  
  241. /*
  242.  *      Process Type codes
  243.  *
  244.  *      These are the definitons for the codes stored
  245.  *      in the LIS_ProcType field in the local infoseg.
  246.  */
  247.  
  248. #define         LIS_PT_FULLSCRN 0       /* Full screen app. */
  249. #define         LIS_PT_REALMODE 1       /* Real mode process */
  250. #define         LIS_PT_VIOWIN   2       /* VIO windowable app. */
  251. #define         LIS_PT_PRESMGR  3       /* Presentation Manager app. */
  252. #define         LIS_PT_DETACHED 4       /* Detached app. */
  253.  
  254.  
  255. /*
  256.  *
  257.  *      Process Status Bit Definitions
  258.  *
  259.  */
  260.  
  261. #define         LIS_PS_EXITLIST 0x01    /* In exitlist handler */
  262.  
  263.  
  264. /*
  265.  *      Flags equates for the Global Info Segment
  266.  *      SIS_SysLog  WORD in Global Info Segment
  267.  *
  268.  *        xxxx xxxx xxxx xxx0         Error Logging Disabled
  269.  *        xxxx xxxx xxxx xxx1         Error Logging Enabled
  270.  *
  271.  *        xxxx xxxx xxxx xx0x         Error Logging not available
  272.  *        xxxx xxxx xxxx xx1x         Error Logging available
  273.  */
  274.  
  275. #define LF_LOGENABLE    0x0001          /* Logging enabled */
  276. #define LF_LOGAVAILABLE 0x0002          /* Logging available */
  277.  
  278.  
  279. /* info on global and local infoseg copies */
  280. struct infoseg_s {
  281.     void           *is_va;              /* address in system arena */
  282.     unsigned short  is_hob;             /* shared arena object handle */
  283.                                         /*  BUGBUG - should be VMHOB is_hob */
  284.     unsigned short  is_sel;             /* system arena selector */
  285.     void           *is_ppf;             /* pointer to frame's pf structure */
  286. };
  287.