source: trunk/include/FastInfoBlocks.h@ 9969

Last change on this file since 9969 was 9876, checked in by sandervl, 22 years ago

KSO: makefile updates

File size: 7.6 KB
Line 
1/* $Id: FastInfoBlocks.h,v 1.1 2003-02-28 10:28:09 sandervl Exp $
2 *
3 * Fast InfoBlock Access.
4 *
5 * Copyright (c) 2003 knut st. osmundsen <bird@anduin.net>
6 *
7 * Project Odin Software License can be found in LICENSE.TXT.
8 *
9 */
10
11#ifndef __FastInfoBlocks_h__
12#define __FastInfoBlocks_h__
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18
19/*******************************************************************************
20* Defined Constants And Macros *
21*******************************************************************************/
22
23/**
24 * Gets the current Process ID.
25 */
26#if 0
27#define fibGetPid() (_gpfibPIB->pib_ulpid)
28#else
29#define fibGetPid() (_gpfibLIS->pidCurrent)
30#endif
31
32/**
33 * Gets the current Thread ID.
34 */
35#define fibGetTid() (_gpfibLIS->tidCurrent)
36
37/**
38 * Gets the handle of the executable of this process.
39 */
40#if 1
41#define fibGetExeHandle() (_gpfibPIB->pib_hmte)
42#else
43#define fibGetExeHandle() (_gpfibLIS->hmod)
44#endif
45
46/**
47 * Gets the Environment Selector.
48 */
49#define fibGetEnvSel() (_gpfibLIS->selEnv)
50
51/**
52 * Gets the Environment Selector.
53 */
54#define fibGetCmdLineOff() (_gpfibLIS->offCmdLine)
55
56/**
57 * Gets the Environment Pointer (32bit FLAT pointer).
58 */
59#if 1
60#define fibGetEnv() (_gpfibPIB->pib_pchenv)
61#else
62#define fibGetEnv() ( ((fibGetEnvSel() & ~7) << 13) )
63#endif
64
65/**
66 * Gets the Commandline Pointer (32bit FLAT pointer).
67 */
68#if 1
69#define fibGetCmdLine() (_gpfibPIB->pib_pchcmd)
70#else
71#define fibGetCmdLine() ( ((fibGetEnvSel() & ~7) << 13) | fibGetCmdLineOff() )
72#endif
73
74
75/**
76 * Gets the Process Status.
77 */
78#define fibGetProcessStatus() (_gpfibLIS->rfProcStatus)
79/** Is this process in an exit list? */
80#define fibIsInExitList() (fibGetProcessStatus() & 1)
81
82
83/**
84 * Gets the Process Type.
85 */
86#define fibGetProcessType() (_gpfibLIS->typeProcess)
87
88/** Is this a Detached (daemon) process? */
89#define fibIsDetachedProcess() (fibGetProcessType() == 4)
90/** Is this a PM process? */
91#define fibIsPMProcess() (fibGetProcessType() == 3)
92/** Is this a VIO (windowed console) process? */
93#define fibIsVIOProcess() (fibGetProcessType() == 2)
94/** Is this a VDM (Virtual Dos Mode) process? */
95#define fibIsVDMProcess() (fibGetProcessType() == 1)
96/** Is this a full screen process? */
97#define fibIsFullScreeProcess() (fibGetProcessType() == 0)
98
99
100
101
102
103/*******************************************************************************
104* Global Variables *
105*******************************************************************************/
106#pragma pack(1)
107
108/**
109 * Local Info Segment (per process).
110 */
111extern struct fibLIS
112{
113 unsigned short pidCurrent; /* Current process ID */
114 unsigned short pidParent; /* Process ID of parent */
115 unsigned short prtyCurrent; /* Current thread priority */
116 unsigned short tidCurrent; /* Current thread ID */
117 unsigned short sgCurrent; /* Screengroup */
118 unsigned char rfProcStatus; /* Process status bits */
119 unsigned char LIS_fillbyte1; /* filler byte */
120 unsigned short fFoureground; /* Current process is in foreground */
121 unsigned char typeProcess; /* Current process type */
122 unsigned char LIS_fillbyte2; /* filler byte */
123
124 unsigned short selEnv; /* @@V1 Environment selector */
125 unsigned short offCmdLine; /* @@V1 Offset of command line start */
126 unsigned short cbDataSegment;/* @@V1 Length of Data Segment */
127 unsigned short cbStack; /* @@V1 STACKSIZE from the .EXE file */
128 unsigned short cbHeap; /* @@V1 HEAPSIZE from the .EXE file */
129 unsigned short hmod; /* @@V1 Module handle of the application */
130 unsigned short selDS; /* @@V1 Data Segment Handle of application */
131
132 unsigned short LIS_PackSel; /* First tiled selector in this EXE */
133 unsigned short LIS_PackShrSel; /* First selector above shared arena */
134 unsigned short LIS_PackPckSel; /* First selector above packed arena */
135} * _gpfibLIS;
136
137/**
138 * Global Info Segment (system)
139 */
140extern struct fibGIS
141{
142 /* Time (offset 0x00) */
143 unsigned long SIS_BigTime; /* Time from 1-1-1970 in seconds */
144 unsigned long SIS_MsCount; /* Freerunning milliseconds counter */
145 unsigned char SIS_HrsTime; /* Hours */
146 unsigned char SIS_MinTime; /* Minutes */
147 unsigned char SIS_SecTime; /* Seconds */
148 unsigned char SIS_HunTime; /* Hundredths of seconds */
149 unsigned short SIS_TimeZone; /* Timezone in min from GMT (Set to EST) */
150 unsigned short SIS_ClkIntrvl; /* Timer interval (units=0.0001 secs) */
151
152 /* Date (offset 0x10) */
153 unsigned char SIS_DayDate; /* Day-of-month (1-31) */
154 unsigned char SIS_MonDate; /* Month (1-12) */
155 unsigned short SIS_YrsDate; /* Year (>= 1980) */
156 unsigned char SIS_DOWDate; /* Day-of-week (1-1-80 = Tues = 3) */
157
158 /* Version (offset 0x15) */
159 unsigned char SIS_VerMajor; /* Major version number */
160 unsigned char SIS_VerMinor; /* Minor version number */
161 unsigned char SIS_RevLettr; /* Revision letter */
162
163 /* System Status (offset 0x18) */
164 unsigned char SIS_CurScrnGrp; /* Fgnd screen group # */
165 unsigned char SIS_MaxScrnGrp; /* Maximum number of screen groups */
166 unsigned char SIS_HugeShfCnt; /* Shift count for huge segments */
167 unsigned char SIS_ProtMdOnly; /* Protect-mode-only indicator */
168 unsigned short SIS_FgndPID; /* Foreground process ID */
169
170 /* Scheduler Parms (offset 0x1E) */
171 unsigned char SIS_Dynamic; /* Dynamic variation flag (1=enabled) */
172 unsigned char SIS_MaxWait; /* Maxwait (seconds) */
173 unsigned short SIS_MinSlice; /* Minimum timeslice (milliseconds) */
174 unsigned short SIS_MaxSlice; /* Maximum timeslice (milliseconds) */
175
176 /* Boot Drive (offset 0x24) */
177 unsigned short SIS_BootDrv; /* Drive from which system was booted */
178
179 /* RAS Major Event Code Table (offset 0x26) */
180 unsigned char SIS_mec_table[32]; /* Table of RAS Major Event Codes (MECs) */
181
182 /* Additional Session Data (offset 0x46) */
183 unsigned char SIS_MaxVioWinSG; /* Max. no. of VIO windowable SG's */
184 unsigned char SIS_MaxPresMgrSG; /* Max. no. of Presentation Manager SG's */
185
186 /* Error logging Information (offset 0x48) */
187 unsigned short SIS_SysLog; /* Error Logging Status */
188
189 /* Additional RAS Information (offset 0x4A) */
190 unsigned short SIS_MMIOBase; /* Memory mapped I/O selector */
191 unsigned long SIS_MMIOAddr; /* Memory mapped I/O address */
192
193 /* Additional 2.0 Data (offset 0x50) */
194 unsigned char SIS_MaxVDMs; /* Max. no. of Virtual DOS machines */
195 unsigned char SIS_Reserved;
196} * _gpfibGIS;
197
198
199/**
200 * Process Info Block.
201 */
202extern struct ProcessInformationBlock
203{
204 unsigned long pib_ulpid; /* Process I.D. */
205 unsigned long pib_ulppid; /* Parent process I.D. */
206 unsigned long pib_hmte; /* Program (.EXE) module handle */
207 char * pib_pchcmd; /* Command line pointer */
208 char * pib_pchenv; /* Environment pointer */
209 unsigned long pib_flstatus; /* Process' status bits */
210 unsigned long pib_ultype; /* Process' type code */
211} * _gpfibPIB;
212
213#pragma pack()
214
215
216/*******************************************************************************
217* Functions *
218*******************************************************************************/
219int fibInit(void);
220void fibDumpAll(void);
221
222
223#ifdef __cplusplus
224}
225#endif
226#endif
Note: See TracBrowser for help on using the repository browser.