home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / INCLUDE / PHARLAP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-27  |  60.2 KB  |  1,367 lines

  1. /* PHARLAP.H - Definitions for Phar Lap's 386|DOS-Extender */
  2. /* $Id: pharlap.h 1.59 93/01/27 11:22:02 rwm Exp $ */
  3.  
  4. /************************************************************************/
  5. /*    Copyright (C) 1986-1993 Phar Lap Software, Inc.            */
  6. /*    Unpublished - rights reserved under the Copyright Laws of the    */
  7. /*    United States.  Use, duplication, or disclosure by the         */
  8. /*    Government is subject to restrictions as set forth in         */
  9. /*    subparagraph (c)(1)(ii) of the Rights in Technical Data and     */
  10. /*    Computer Software clause at 252.227-7013.            */
  11. /*    Phar Lap Software, Inc., 60 Aberdeen Ave., Cambridge, MA 02138    */
  12. /************************************************************************/
  13.  
  14. /*    
  15.     FILE DESCRIPTION
  16.  
  17. This include file contains definitions used by application programs 
  18. that run under Phar Lap's 386|DOS-Extender.  The file defines the
  19. application program interface (API) to 386|DOS-Extender.  The following
  20. definitions are present in the file:
  21.  
  22.     * Fixed selector numbers
  23.     * Program segment prefix (PSP)
  24.     * Interrupt numbers
  25.     * System call numbers
  26.     * Error numbers
  27.     * Data structures used by system calls
  28. */
  29.  
  30. #ifndef PLTYPES
  31. #include <pltypes.h>
  32. #endif
  33.  
  34. #ifndef PHARLAP_H
  35. #define PHARLAP_H
  36.  
  37. #pragma pack(1)
  38.  
  39. /*
  40. Fixed GDT Segment selectors used by 386|DOS-Extender
  41.  
  42. The following selectors in the GDT are available to 
  43. applications to directly access the LDT, GDT, and IDT
  44. when running under 386|DOS-Extender.
  45.  
  46. THESE SEGMENTS MUST NOT BE USED IF THE PROGRAM RUNS AT PRIVILEGE LEVEL
  47. 3 AND/OR DPMI COMPATIBILITY IS DESIRED
  48. */
  49. #define    SS_LDT        0x0028        /* LDT system segment */
  50. #define SS_DLDT        0x0030        /* data segment mapping LDT */
  51. #define SS_DGDT        0x0038        /* data segment mapping GDT */
  52. #define SS_DIDT     0x0050        /* data segment mapping IDT */
  53.  
  54. /*
  55. Fixed LDT Segment selectors used by 386|DOS-Extender
  56.  
  57. The following selectors in the LDT are available to be 
  58. used by an applications to access the various pieces of
  59. a program when running under 386|DOS-Extender. 
  60. */
  61. #define SS_APSP       0x0004        /* Alternate PSP */
  62. #define SS_CODE      0x000C        /* User code */
  63. #define SS_DATA      0x0014        /* User data */
  64. #define SS_SCREEN     0x001C        /* Screen memory */
  65. #define SS_PSP       0x0024        /* PSP */
  66. #define SS_ENV        0x002C        /* DOS environment */
  67. #define SS_DOSMEM     0x0034        /* low 1 megabyte of memory (RO) */
  68. #define SS_1167     0x003C        /* Weitek 1167,3167,4167 coprocessor */
  69. #define SS_WEITEK     0x003C        /* Weitek 1167,3167,4167 coprocessor */
  70. #define SS_GRAPHICS    0x0044        /* Screen graphics memory */
  71. #define SS_CYRIX    0x004C        /* Cyrix EMC387 coprocessor, added */
  72.                     /*in version 3.0 of 386|DOS-Extender*/
  73.  
  74. /*
  75. The max. length of a DOS file name string 
  76. */
  77. #define MAX_FNLEN    128
  78.  
  79. /*
  80. Program segment prefix (PSP)
  81. */
  82. typedef struct
  83. {
  84.     USHORT    i20;        /* INT 20h instruction */
  85.     USHORT    end_alloc;    /* para addr of end of allocation block */
  86.     UCHAR    pad1;        /* unused byte */
  87.     UCHAR    fcall;        /* -RESERVED- */
  88.     USHORT    cpmoffs;    /* -RESERVED- */
  89.     USHORT    cpmseg;        /* -RESERVED- */
  90.     USHORT    term_ip;    /* -RESERVED- */
  91.     USHORT    term_cs;    /* -RESERVED- */
  92.     USHORT    cc_ip;        /* -RESERVED- */
  93.     USHORT    cc_cs;        /* -RESERVED- */
  94.     USHORT    ce_ip;        /* -RESERVED- */
  95.     USHORT    ce_cs;        /* -RESERVED- */
  96.     USHORT    parseg;        /* segment address of parent */
  97.     UCHAR    oftab[20];    /* open file table */
  98.     USHORT    env_addr;    /* para addr of environment block */
  99.     USHORT    sp_sav;        /* -RESERVED- */
  100.     USHORT    ss_sav;        /* -RESERVED- */
  101.     USHORT    maxfil;        /* max. number of open files */
  102.     USHORT    oftoffs;    /* offset of open file table */
  103.     USHORT    oftseg;        /* segment addr of open file table */
  104.     USHORT    npspoffs;    /* next PSP offset */
  105.     USHORT    npspseg;    /* next PSP segment */
  106.     UCHAR    pad2[20];    /* unused bytes, always 0 */
  107.     USHORT    i21;        /* INT 21h opcode */
  108.     UCHAR    fret;        /* far return opcode */
  109.     UCHAR    pad3[9];    /* unused bytes, always 0 */
  110.     ULONG    data_size;    /* # data bytes read from .EXE file */
  111.     ULONG    dseg_size;    /* size, in bytes, of data segment */
  112.     ULONG    edat_size;    /* # extra data bytes alloc'd (size-amt) */
  113.     UCHAR    pad4[24];    /* unused bytes, always 0 */
  114.     UCHAR    ct_len;        /* length of command tail string */
  115.     UCHAR    ctail[127];    /* buffer for command tail */
  116. } MS_PSP;
  117.  
  118. /*
  119. DOS interrupt numbers
  120. */
  121. #define INT_TERM    0x20    /* Terminate */
  122. #define INT_DOS        0x21    /* DOS system call */
  123. #define INT_TADDR    0x22    /* Terminate address */
  124. #define INT_CTRLC    0x23    /* Control/C handler */
  125. #define INT_CRERR    0x24    /* Critical error handler */
  126. #define INT_DREAD    0x25    /* Disk read */
  127. #define INT_DWRITE    0x26    /* Disk write */
  128. #define INT_TSR        0x27    /* Terminate-and-stay resident */
  129. #define INT_PSC        0x2F    /* Print spool control */
  130.  
  131. /* 
  132. System call numbers 
  133. */
  134. #define _DOS_CHAR_INE    0x01    /* Character input with echo */
  135. #define _DOS_CHAR_OUT    0x02    /* Character output */
  136. #define _DOS_AUX_IN    0x03    /* Auxiliary input */
  137. #define _DOS_AUX_OUT    0x04    /* Auxiliary output */
  138. #define _DOS_PRT_OUT    0x05    /* Printer output */
  139. #define _DOS_CHAR_IO    0x06    /* Direct console I/O */
  140. #define _DOS_CHAR_INR    0x07    /* Character input (raw) */
  141. #define _DOS_CHAR_INNE    0x08    /* Character input (no echo) */
  142. #define _DOS_STR_OUT    0x09    /* Character string output */
  143. #define _DOS_BUFF_IN    0x0A    /* Buffered input */
  144. #define _DOS_IN_STATS    0x0B    /* Input status */
  145. #define _DOS_RESET_IN    0x0C    /* Reset, then input */
  146. #define _DOS_DISK_RES    0x0D    /* Disk reset */
  147. #define _DOS_DEFD_SET    0x0E    /* Set default disk */
  148. #define _DOS_DEFD_GET    0x19    /* Get default disk */
  149. #define _DOS_DTA_SET    0x1A    /* Set disk transfer address */
  150. #define _DOS_DALLOC_GET    0x1B    /* Get allocation info for default drive */
  151. #define _DOS_SALLOC_GET    0x1C    /* Get allocation info for specific drive */
  152. #define _DOS_DATE_GET    0x2A    /* Get date */
  153. #define _DOS_DATE_SET    0x2B    /* Set date */
  154. #define _DOS_TIME_GET    0x2C    /* Get time */
  155. #define _DOS_TIME_SET    0x2D    /* Set time */
  156. #define _DOS_VERF_SET    0x2E    /* Set verify flag */
  157. #define _DOS_DTA_GET    0x2F    /* Get disk transfer address */
  158. #define _DOS_VERNO_GET    0x30    /* Get DOS and 386|DOS-Extender version #'s */
  159. #define _DOS_TSR    0x31    /* Terminate a stay resident */
  160. #define _DOS_GDBLK    0x32    /* Get disk block */
  161. #define _DOS_BRK_FLAG    0x33    /* Get or set control/break flag */
  162. #define _DOS_FSPACE_GET    0x36    /* Get disk free space */
  163. #define _DOS_CNTRY    0x38    /* Get or set country information */
  164. #define _DOS_MKDIR    0x39    /* Create a subdirectory */
  165. #define _DOS_RMDIR    0x3A    /* Remove a subdirectory */
  166. #define _DOS_CHDIR    0x3B    /* Change current directory */
  167. #define _DOS_CREATE    0x3C    /* Create a file */
  168. #define _DOS_OPEN    0x3D    /* Open a file */
  169. #define _DOS_CLOSE    0x3E    /* Close a file */
  170. #define _DOS_READ    0x3F    /* Read from a file */
  171. #define _DOS_WRITE    0x40    /* Write to a file */
  172. #define _DOS_DELETE    0x41    /* Delete a file */
  173. #define _DOS_SEEK    0x42    /* Seek in a file */
  174. #define _DOS_FATTR    0x43    /* Get or set file attributes */
  175. #define _DOS_IOCTL    0x44    /* Device I/O control */
  176. #define _DOS_DUP    0x45    /* Duplicate a handle */
  177. #define _DOS_DUP2    0x46    /* Duplicate a handle */
  178. #define _DOS_CURDIR    0x47    /* Get current directory name */
  179. #define _DOS_SEG_ALLOC    0x48    /* Allocate a segment */
  180. #define _DOS_SEG_FREE    0x49    /* Free a segment */
  181. #define _DOS_SEG_RESIZE    0x4A    /* Modify segment size */
  182. #define _DOS_EXEC    0x4B    /* Execute a program */
  183. #define _DOS_TERM    0x4C    /* Exit with a return code */
  184. #define _DOS_RC_GET    0x4D    /* Get child return code */
  185. #define _DOS_FIND_FIRST    0x4E    /* Find first */
  186. #define _DOS_FIND_NEXT    0x4F    /* Find next */
  187. #define _DOS_PSP_SET    0x50    /* Set PSP */
  188. #define _DOS_VERF_GET    0x51    /* Get verify flag */
  189. #define _DOS_RENAME    0x56    /* Rename a file */
  190. #define _DOS_FDATE    0x57    /* Get or set file date */
  191. #define _DOS_MEM_STRAT    0x58    /* Get or set conventional memory allocation
  192.                    strategy */
  193. #define _DOS_XERR_GET    0x59    /* Get extended error information */
  194. #define _DOS_TEMPF_CRT    0x5A    /* Create a temporary file */
  195. #define _DOS_CCREATE    0x5B    /* Create file if it does not exist */
  196. #define _DOS_FILE_LOCK    0x5C    /* Lock a file */
  197. #define _DOS_PSP_GET    0x62    /* Get PSP */
  198.  
  199. /*
  200. I/O Control (INT 21h AH = 44h) subfunction numbers
  201. */
  202. #define _IOC_GDINFO    0    /* Get device information */
  203. #define _IOC_SDINFO    1    /* Get device information */
  204. #define _IOC_RCDCC    2    /* Read from char. device control channel */
  205. #define _IOC_WCDCC    3    /* Write from char. device control channel */
  206. #define _IOC_RBDCC    4    /* Read from block device control channel */
  207. #define _IOC_WBDCC    5    /* Write from block device control channel */
  208. #define _IOC_INST    6    /* Get input status */
  209. #define _IOC_OUTST    7    /* Get output status */
  210. #define _IOC_TCHG    8    /* Test if device is changeable */
  211. #define _IOC_TDLOC    9    /* Test location of device */
  212. #define _IOC_THLOC    10    /* Test location of handle */
  213. #define _IOC_SSRC    11    /* Set sharing retry count */
  214.  
  215. /*
  216. 386|DOS-Extender system call numbers
  217. */
  218. #define _DX_RESET_DATA    0x2501    /* Reset DOS-Extender data structures */
  219. #define _DX_PMIV_GET    0x2502    /* Get protected mode interrupt */
  220. #define _DX_RMIV_GET    0x2503    /* Get real mode interrupt */
  221. #define _DX_PMIV_SET    0x2504    /* Set protected mode interrupt */
  222. #define _DX_RMIV_SET    0x2505    /* Set real mode interrupt */
  223. #define _DX_APMIV_SET    0x2506    /* Set both interrupts to get control
  224.                    in protected mode */
  225. #define _DX_RPMIV_SET    0x2507    /* Set both interrupts separately */
  226. #define _DX_TOLINEAR    0x2508    /* Get linear base address */
  227. #define _DX_TOPHYS    0x2509    /* Convert a linear address to physical */
  228. #define _DX_MAP_PHYS    0x250A    /* Map physical memory to the end of a
  229.                    segment */
  230. #define _DX_HWIV_GET    0x250C    /* Get hardware interrupt vector base */
  231. #define _DX_RMLINK_GET    0x250D    /* Get real mode link information */
  232. #define _DX_REAL_CALL    0x250E    /* Call a real mode procedure */
  233. #define _DX_TOREAL    0x250F    /* Convert protected mode address to
  234.                    real mode address */
  235. #define _DX_REAL_REGCALL 0x2510    /* Call a real mode procedure with
  236.                    register arguments */
  237. #define _DX_REAL_INT    0x2511    /* Issue a real mode interrupt with
  238.                    register arguments */
  239. #define _DX_DBG_LOAD    0x2512    /* Load a program for debugging */
  240. #define _DX_SEG_ALIAS    0x2513    /* Alias a segment */
  241. #define _DX_SEGATTR_SET    0x2514    /* Set segment attributes */
  242. #define _DX_SEGATTR_GET    0x2515    /* Get segment attributes */
  243. #define _DX_LDTMEM_FREE    0x2516    /* Free all memory owned by LDT */
  244. #define _DX_DBUFF_GET    0x2517    /* Get info on DOS data buffer */
  245. #define _DX_SEGMOV_HAND    0x2518    /* Specify handler for moved segments */
  246. #define _DX_MEMERR_GET    0x2519    /* Get additional memory error info */
  247. #define _DX_LOCK_PAGE    0x251A    /* Lock pages in memory */
  248. #define _DX_UNLOCK_PAGE    0x251B    /* Unlock pages in memory */
  249. #define _DX_PAGE_FREE    0x251C    /* Free physical memory pages */
  250. #define _DX_PTE_READ    0x251D    /* Read page table entry */
  251. #define _DX_PTE_WRITE    0x251E    /* Write page table entry */
  252. #define _DX_PTE_XCHG    0x251F    /* Exchange page table entries */
  253. #define _DX_VM_STATS    0x2520    /* Get memory statistics */
  254. #define _DX_XMEM_LIMIT    0x2521    /* Limit program's extended memory usage */
  255. #define _DX_PGFLT_HAND    0x2522    /* Specify alternate page fault handler */
  256. #define _DX_OSWSP_HAND    0x2523    /* Specify out-of-swap-space handler */
  257. #define _DX_PGREPL_HAND    0x2524    /* Specify page replacement handlers */
  258. #define _DX_CMEM_LIMIT    0x2525    /* Limit program's conventional memory usage */
  259. #define _DX_CONFIG_INF    0x2526    /* Get Configuration Information */
  260. #define _DX_DBG_FLAGS    0x2527    /* Set debug flags */
  261. #define _DX_CC_RDREGS    0x2528    /* Read registers after Ctrl/C interrupt*/
  262. #define _DX_LOAD_EXP    0x2529    /* Load Flat Model EXP file */
  263. #define _DX_DBG_NEWLD    0x252A    /* New load pgm for debug (more error info */
  264.                 /* than _DX_DBG_LOAD call) */
  265. #define _DX_MEM_MGT    0x252B    /* Memory region page management */
  266. #define _DX_ADD_UNMAP    0x252C    /* Add unmapped pages at end of segment */
  267. #define _DX_CLOSE_VMH    0x252D    /* Close VMM file handle */
  268. #define _DX_VMM_PARAMS    0x252E    /* Get/Set 386|DOS-Extender parameters */
  269. #define _DX_WR_PAGELOG    0x252F    /* Write record to VMM page log file */
  270. #define _DX_SET_DOSBUF    0x2530    /* Set size of data buffer used for DOS calls*/
  271. #define _DX_RW_LDTDESC    0x2531    /* Read/Write LDT descriptor */
  272. #define _DX_PMEXC_GET    0x2532    /* Get prot mode processor exception vector */
  273. #define _DX_PMEXC_SET    0x2533    /* Set prot mode processor exception vector */
  274. #define _DX_IF_GET    0x2534    /* Get interrupt flag */
  275. #define _DX_SR_RW    0x2535    /* Read/Write System Registers */
  276. #define _DX_MEM_USAGE    0x2536    /* Min/Max Ext/Conv Memory Usage */
  277. #define _DX_REAL_ADDB    0x2537    /* Allocate DOS memory above DOS Data Buffer */
  278. #define _DX_SWI_RDREGS 0x2538    /* Read PM regs after a SW interrupt */
  279. #define _DX_GET_HDROFF 0x2539    /* Get Offset of EXP file header */
  280. #define _DX_MSEG_FAILH 0x253A    /* Install Mod. Segment Failure Handler */
  281. #define _DX_TOREAL_JMP 0x253B    /* Jump to real mode code, no context saved */
  282. #define _DX_SHRINK_SWAP    0x253C    /* shrink size of 386|VMM swap file */
  283. #define _DX_RW_IDTDESC    0x253D    /* Read/Write IDT descriptor */
  284. #define _DX_REAL_ALLOC    0x25C0    /* Allocate real mode memory */
  285. #define _DX_REAL_FREE    0x25C1    /* Release real mode memory */
  286. #define _DX_REAL_RESIZE    0x25C2    /* Change size of a real mode memory
  287.                    block */
  288. #define _DX_EXEC_SPEC    0x25C3    /* Special program execute call */
  289.  
  290. /*
  291. DOS error codes 
  292. */
  293. #define _DOSE_NONE    0    /* No error */
  294. #define _DOSE_BAD_FUNC    1    /* Bad function number */
  295. #define _DOSE_FILE_NOTFND 2    /* File not found */
  296. #define _DOSE_PATH_NOTFND 3    /* Path not found */
  297. #define _DOSE_TOOMANY_OPENS 4    /* Too many files open */
  298. #define _DOSE_ACC_DEN    5    /* Access denied */
  299. #define _DOSE_BAD_HAND    6    /* Bad handle */
  300. #define _DOSE_BAD_MCB    7    /* Bad memory control block */
  301. #define _DOSE_NO_MEM    8    /* Out of memory */
  302. #define _DOSE_BAD_MBA    9    /* Bad memory block address */
  303. #define _DOSE_BAD_ENV    10    /* Bad environment */
  304. #define _DOSE_BAD_FMT    11    /* Bad format */
  305. #define _DOSE_BAD_ACC    12    /* Bad access code */
  306. #define _DOSE_BAD_DATA    13    /* Bad data */
  307. #define _DOSE_BAD_DISK    15    /* Bad disk drive */
  308. #define _DOSE_REM_CD    16    /* Attempt to remove current directory */
  309. #define _DOSE_NOT_SAME    17    /* Not same device */
  310. #define _DOSE_NOMORE_FILES 18    /* No more files */
  311. #define _DOSE_WRITE_PROT 19    /* Disk write-protected */
  312. #define _DOSE_BAD_UNITNO 20    /* Bad disk unit number */
  313. #define _DOSE_NOT_READY    21    /* Drive not ready */
  314. #define _DOSE_BAD_CMD    22    /* Unknown command */
  315. #define _DOSE_BAD_CRC    23    /* Bad CRC */
  316. #define _DOSE_BAD_REQLEN 24    /* Bad request structure length */
  317. #define _DOSE_SEEK    25    /* Seek error */
  318. #define _DOSE_BAD_MEDT    26    /* Bad media type */
  319. #define _DOSE_SECT_NOTFND 27    /* Sector not found */
  320. #define _DOSE_NO_PAPER    28    /* No paper in printer */
  321. #define _DOSE_WRITE_FLT    29    /* Write fault */
  322. #define _DOSE_READ_FLT    30    /* Read fault */
  323. #define _DOSE_GEN_FAIL    31    /* General failure */
  324. #define _DOSE_SHARE_VIOL 32    /* Sharing violation */
  325. #define _DOSE_LOCK_VIOL    33    /* Lock violation */
  326. #define _DOSE_BAD_CHG    34    /* Invalid disk change */
  327. #define _DOSE_NO_FCB    35    /* No FCB's available */
  328. #define _DOSE_SHAR_OVF    36    /* Sharing buffer overflow */
  329. #define _DOSE_REQ_NIMP    50    /* Network request not implemented */
  330. #define _DOSE_RMT_NOLIS    51    /* Remote not listening */
  331. #define _DOSE_DUP_NET    52    /* Duplicate name on network */
  332. #define _DOSE_NET_NOTFND 53    /* Network name not found */
  333. #define _DOSE_NET_BUSY  54    /* Network busy */
  334. #define _DOSE_DEV_GONE  55    /* Network device no longer exists */
  335. #define _DOSE_CMD_LIMIT    56    /* Network BIOS command limit exceeded */
  336. #define _DOSE_NET_ERR    57    /* Network hardware error */
  337. #define _DOSE_BAD_RESP    58    /* Bad response from network */
  338. #define _DOSE_UNEXPECT     59    /* Unexpected error */
  339. #define _DOSE_ADPT_INC    60    /* Incompatible remote adapter */
  340. #define _DOSE_PRTQ_FULL    61    /* Print queue full */
  341. #define _DOSE_PRTQ_NOTFND 62    /* Print queue not found */
  342. #define _DOSE_PRTF_DEL    63    /* Print file deleted */
  343. #define _DOSE_NAME_DEL    64    /* Network name deleted */
  344. #define _DOSE_ACC_DEN2    65    /* Access denied */
  345. #define _DOSE_BAD_NTYEP    66    /* Bad network device type */
  346. #define _DOSE_NET_NOTFND2 67    /* Network name not found */
  347. #define _DOSE_NAME_LIMIT 68    /* Network name limit exceeded */
  348. #define _DOSE_SESS_LIMIT 69    /* Network session limit exceeded */
  349. #define _DOSE_TPAUSE    70    /* Temporary pause */
  350. #define _DOSE_REQ_NACC    71    /* Network request not accepted */
  351. #define _DOSE_RED_PAUSE    72    /* Print or disk redirection pause */
  352. #define _DOSE_FILE_EXISTS 80    /* File already exists */
  353. #define _DOSE_NO_DIRENT    82    /* Cannot make directory entry */
  354. #define _DOSE_INT24_ERR    83    /* Error on INT 24 */
  355. #define _DOSE_RED_TOOMANY 84    /* Too many redirections */
  356. #define _DOSE_RED_DUP    85    /* Duplicate redirection */
  357. #define _DOSE_BAD_PSWD    86    /* Bad password */
  358. #define _DOSE_BAD_PARM    87    /* Bad parameter */
  359. #define _DOSE_DEV_FAIL    88    /* Network device failure */
  360.  
  361. /*
  362. 386|DOS-Extender error codes
  363. */
  364. #define _DXE_LDT_SIZE    128    /* LDT buf too small in load for debug call */
  365. #define _DXE_BAD_PARAM    129    /* Bad parameter passed in to system call */
  366. #define _DXE_NOT_DPMI    130    /* Operation not supported under this */
  367.                 /* DPMI implementation */
  368. #define _DXE_DBG_NOSAV    131    /* Register saving for debuggers not enabled */
  369. #define _DXE_DBG_NOREG    132    /* Register buffer for debuggers is empty */
  370. #define _DXE_NO_PAGELOG    133    /* Attempt to write to VMM page log file */
  371.                 /* when no file exists */
  372. #define _DXE_MAX_VMH    134    /* Maximum number of 386|VMM file handles */
  373.                 /* are already allocated */
  374.  
  375. /*
  376.  * Memory error codes, returned by the Get Additional Memory Error Info
  377.  * system call 2519h (_dx_memerr_get()) and some other system calls such as
  378.  * Load .EXP file (2529h, _dx_ld_flat()) and Load Program for Debugging
  379.  * (252Ah, _dx_dbg_ld()).  It gives more detailed information
  380.  * about why the most recent DOS memory error (error 8, _DOSE_NO_MEM) occurred.
  381.  */
  382. #define MERR_NONE    0    /* no additional info available */
  383. #define MERR_NOMEM    1    /* insufficient physical memory available */
  384. #define MERR_NOSWAP    2    /* insuff. VMM swap space available on disk */
  385. #define MERR_NOLDT    3    /* no free LDT entries and unable to grow LDT*/
  386. #define MERR_NOEXT    4    /* unable to change extended memory */
  387.                 /* allocation mark */
  388. #define MERR_NOVIRT    5    /* insuff. virtual memory space (-MAXPGMMEM */
  389.                 /* switch value exceeded) */
  390. #define MERR_NORBRK    6    /* insuff. conventional memory to satisfy */
  391.                 /* -REALBREAK when loading an EXP file */
  392. #define MERR_NOPSP    7    /* insuff. conventional memory to allocate */
  393.                 /* a PSP and environment when loading an EXP */
  394.                 /* file for debugging */
  395.  
  396. /*
  397.  * Loader error codes, returned by Load EXP file (2529h, _dx_ld_flat()) and 
  398.  * Load Program for Debug (252Ah, _dx_dbg_ld()).
  399.  */
  400. #define LERR_OPEN    1    /* DOS error returned opening file */
  401. #define LERR_SEEK    2    /* DOS error returned seeking in file */
  402. #define LERR_READ    3    /* DOS error returned reading from file */
  403. #define LERR_NOTEXE    4    /* Not a supported EXE or EXP file format */
  404. #define LERR_INVFILE    5    /* Invalid file format (file header was */
  405.                 /* recognized, but information in the file */
  406.                 /* was invalid) */
  407. #define LERR_BADOFFS    6    /* Linker -OFFSET switch value is not a */
  408.                 /* multiple of 4K, or -OFFSET not allowed */
  409.                 /* because -NOPAGE used, or because this */
  410.                 /* DPMI version doesn't support -OFFSET */
  411. #define LERR_BADRBRK    7    /* -REALBREAK not allowed because -NOPAGE */
  412.                 /* used, or because this DPMI version */
  413.                 /* doesn't support -REALBREAK */
  414. #define LERR_DOSLOAD    8    /* DOS error returned loading real mode */
  415.                 /* EXE file */
  416. #define LERR_PRIV    9    /* privilege level of program incompatible */
  417.                 /* with current privilege level (only ret'd */
  418.                 /* by Load for Debug, not by Load EXP File) */
  419.  
  420. /*
  421. DOS time structure
  422. */
  423. typedef struct
  424. {
  425.     UCHAR hour;        /* Hour (0-23) */
  426.     UCHAR minute;        /* Minute (0-59) */
  427.     UCHAR second;        /* Second (0-59) */
  428.     UCHAR hsecond;        /* 1/100 second (0-99) */
  429. } DOS_TIME;
  430.  
  431. /*
  432. DOS date structure
  433. */
  434. typedef struct
  435. {
  436.     UCHAR day;        /* Day (1-31) */
  437.     UCHAR month;        /* Month (1-12) */
  438.     USHORT year;        /* Year (1980-...) */
  439.     UCHAR dayofweek;    /* Day of week (0-6) */
  440. } DOS_DATE;
  441.  
  442. /*
  443. Disk block used in undocumented INT 21h function 32H, Get MS-DOS Disk Block
  444. */
  445. typedef struct
  446. {
  447.     UCHAR drive;        /* Number number (A = 0) */
  448.     UCHAR unit_no;        /* Unit number within driver */
  449.     USHORT sec_size;    /* Sector size in bytes */
  450.     UCHAR sec_cls;        /* Number of sectors per cluster - 1*/
  451.     UCHAR cls_shift;    /* Cluster to sector shift */
  452.     USHORT rsrv_cnt;    /* Number of reserved sectors */
  453.     UCHAR fat_cnt;        /* Number of FAT entries */
  454.     USHORT root_cnt;    /* Number of root directory entries */
  455.     USHORT cls2_secno;    /* Sector number of cluster #2 */
  456.     USHORT cls_cnt;        /* Number of clusters + 1 */
  457.     UCHAR fat_scnt;        /* Number of sectors for the FAT */
  458.     USHORT dir_secno;    /* Sector number of the directory */
  459.     REALPTR dev_hdrp;    /* Real mode pointer to device handle */
  460.     UCHAR media_byte;    /* Media descriptor byte */
  461.     UCHAR not_accf;        /* Not accessed flag */
  462.     REALPTR dblk_nextp;    /* Real mode pointer to next block */
  463. } DISK_BLK;
  464.  
  465. /*
  466. File attributes for Create File (INT 21h function 3Ch)
  467. */
  468. #define NORM_FILE    0    /* Normal file */
  469. #define RO_FILE        1    /* Read only file */
  470. #define HIDE_FILE    2    /* Hidden file */
  471. #define SYS_FILE    4    /* System file */
  472.  
  473. /*
  474. Find block
  475. */
  476. typedef struct
  477. {
  478.     UCHAR reserved[21];    /* 21 bytes reserved by DOS */
  479.     UCHAR file_attr;    /* File attribute */
  480.     USHORT file_time;    /* File time */
  481.     USHORT file_date;    /* File data */
  482.     ULONG file_size;    /* Size in bytes of file */
  483.     UCHAR file_name[13];    /* Null terminate file name */
  484. } FIND_BLK;
  485.  
  486. /*
  487. EXEC system call control block for INT 21h function 4Bh
  488. */
  489. typedef struct
  490. {
  491.     UCHAR *ex_eoff;        /* Offset of the environment segment */
  492.     USHORT ex_eseg;        /* Segment of the environment segment */
  493.     UCHAR *ex_coff;        /* Offset of the command tail */
  494.     USHORT ex_cseg;        /* Segment of the command tail */
  495. } EXEC_BLK;
  496.  
  497. /*
  498. Type of disk media returned by INT 21h functions 1Bh and 1Ch
  499. */
  500. #define DM_FIXED    0xF8    /* Fixed disk */
  501. #define DM_DS15        0xF9    /* Double sided, 15 sectors (1.2 Meg) */
  502. #define DM_SS9        0xFC    /* Single sided, 9 sectors */
  503. #define DM_DS9        0xFD    /* Double sided, 9 sectors */
  504. #define DM_SS8        0xFE    /* Single sided, 8 sectors */
  505. #define DM_DS8        0xFF    /* Doubled sided, 8 sectors */
  506.  
  507. /*
  508. Seek directions for Set File Pointer, INT 21h function 42h
  509. */
  510. #define SEEK_ABS    0    /* Absolute seek */
  511. #define SEEK_REL    1    /* Relative to current file ptr. */
  512. #define SEEK_EOF    2    /* Relative to EOF */
  513.  
  514. /*
  515. Country info struct for Get/Set Country Information (INT 21h fucntion 38h)
  516. */
  517. typedef struct
  518. {
  519.     USHORT date_fmt;    /* Date format */
  520.     UCHAR curr_sym;        /* Currency symbol */
  521.     UCHAR fill1;        /* Filler (zero) */
  522.     UCHAR dec_sep;        /* Decimal separator character */
  523.     UCHAR fill2;        /* Filler (zero) */
  524.     UCHAR date_sep;        /* Date separator character */
  525.     UCHAR fill3;         /* Filler (zero) */
  526.     UCHAR time_sep;        /* Time separator character */
  527.     UCHAR fill4;         /* Filler (zero) */
  528.     UCHAR curr_fmt;        /* Currency format */
  529.     UCHAR curr_ddec;    /* Number of digits after decimal */
  530.     UCHAR time_fmt;        /* Time format */
  531.     REALPTR cm_ptr;        /* Case map function pointer (real mode) */
  532.     UCHAR dlist_sep;    /* Data list separator character */
  533.     UCHAR fill5[11];    /* Filler */
  534. } COUNTRY_INFO;
  535.  
  536. #define DATE_USA        /* American date format */
  537. #define DATE_EUROPE        /* European date format */
  538. #define DATE_JAPAN        /* Japanese date format */
  539.  
  540. #define CURR_SPM    0x02    /* Number of spaces between currency symbol
  541.                    and value (0 or 1) */
  542. #define CURR_LOCM    0x01    /* Location mask */
  543. #define CURR_BEFORE    0x00    /* Currency symbol precedes value */
  544. #define CURR_AFTER    0x01    /* Currency symbol follows value */
  545.  
  546. /*
  547. Data structure for calling a protected mode procedure from real mode
  548. (using addr obtained from system call 250Dh, _dx_rmlink_get()).
  549. */
  550. typedef struct
  551. {
  552.     USHORT ds;        /* DS register */
  553.     USHORT es;        /* ES register */
  554.     USHORT fs;        /* FS register */
  555.     USHORT gs;        /* GS register */
  556. } PMC_BLK;
  557.  
  558. /*
  559. Data structure for call real mode procedure (2510h, _dx_call_real())
  560. */
  561. typedef struct
  562. {
  563.     USHORT ds;        /* DS register */
  564.     USHORT es;        /* ES register */
  565.     USHORT fs;        /* FS register */
  566.     USHORT gs;        /* GS register */
  567.     ULONG eax;        /* EAX register */
  568.     ULONG ebx;        /* EBX register */
  569.     ULONG ecx;        /* ECX register */
  570.     ULONG edx;        /* EDX register */
  571. } RMC_BLK;
  572.  
  573. /*
  574. Data structure for issue real mode interrupt (2511h)
  575. This data structure is NOT used by the C call, _dx_real_int();  instead
  576. it uses the SWI_REGS struct, which allows all register values to be specified.
  577. */
  578. typedef struct
  579. {
  580.     USHORT inum;        /* Interrupt number */
  581.     USHORT ds;        /* DS register */
  582.     USHORT es;        /* ES register */
  583.     USHORT fs;        /* FS register */
  584.     USHORT gs;        /* GS register */
  585.     ULONG eax;        /* EAX register */
  586.     ULONG edx;        /* EDX register */
  587. } RMI_BLK;
  588.  
  589. /*
  590. Data structure for load for debug system call (252Ah, _dx_dbg_ld())
  591. */
  592. typedef struct
  593. {
  594.     UCHAR *ex_eoff;        /* Offset of the environment segment */
  595.     USHORT ex_eseg;        /* Segment of the environment segment */
  596.     UCHAR *ex_coff;        /* Offset of the command tail */
  597.     USHORT ex_cseg;        /* Segment of the command tail */
  598.     UCHAR *ex_loff;        /* Offset of the LDT buffer */
  599.     USHORT ex_lseg;        /* Segment of the LDT buffer */
  600.     USHORT real_psp;    /* Real mode PSP address */
  601.     USHORT protf;        /* Protected mode flag */
  602.     ULONG eip;        /* Initial EIP */
  603.     USHORT cs;        /* Initial CS */
  604.     ULONG esp;        /* Initial ESP */
  605.     USHORT ss;        /* Initial SS */
  606.     USHORT ds;        /* Initial DS */
  607.     USHORT es;        /* Initial ES */
  608.     USHORT fs;        /* Initial FS */
  609.     USHORT gs;        /* Initial GS */
  610. } LDDBG_BLK;
  611.  
  612. /*
  613.  * Data structure for load EXP file system call (2529h, _dx_ld_flat())
  614.  */
  615. typedef struct
  616. {
  617.     ULONG    eip;        /* initial EIP */
  618.     USHORT    cs;        /* initial CS */
  619.     ULONG    esp;        /* initial ESP */
  620.     USHORT    ss;        /* initial SS */
  621.     USHORT ds;        /* Initial DS */
  622.     USHORT es;        /* Initial ES */
  623.     USHORT fs;        /* Initial FS */
  624.     USHORT gs;        /* Initial GS */
  625.     ULONG    minsize;    /* minimum size of program segment, in bytes */
  626.                 /* (any -OFFSET value, plus size of pgm in */
  627.                 /* EXP file, plus any -MINDATA value.  Same */
  628.                 /* as info at offset 5Ch in PSP for main pgm)*/
  629.     ULONG    extramem;    /* amount of extra memory, in bytes, beyond */
  630.                 /* the size of the pgm in the EXP file, that */
  631.                 /* was allocated (Same as info at offset 64h */
  632.                 /* in PSP for main pgm) */
  633.     ULONG    flags;        /* flags, defined below */
  634.     ULONG    rsrv[8];    /* reserved, always zeroed */
  635. } LDEXP_BLK;
  636. /* Bit definitions for flags word in LDEXP_BLK struct */
  637. #define LD_UNPRIV 0x00000001    /* if set, child was linked with -UNPRIV */
  638.                 /* switch, if cleared, child linked -PRIV */
  639.  
  640. /*
  641. VM_STATS - Memory statistics data structure returned by 2520h system call,
  642.         _dx_vm_stats().
  643. */
  644. typedef struct
  645. {
  646.     ULONG vm_presf;        /* 386|VMM is present flag */
  647.     ULONG vm_nconvpg;    /* Conventional memory physical page count */
  648.     ULONG vm_rsrv1;        /* reserved, always zero */
  649.     ULONG vm_nextpg;    /* Extended memory physical page count (this is
  650.                    an APPROXIMATE number) */
  651.     ULONG vm_extpglim;    /* Extended memory physical page limit */
  652.     ULONG vm_nallocpg;    /* Number of physical pages allocated to
  653.                    application */
  654.     ULONG vm_nlockpg;    /* Number of locked physical pages */
  655.     ULONG vm_nsyspg;    /* Number of physical pages allocated by
  656.                    386|DOS-Extender for system data */
  657.     ULONG vm_rsrv2;        /* reserved, contents undefined */
  658.     ULONG vm_dmin;        /* Linear address of the beginning of
  659.                    the dynamic linear range */
  660.     ULONG vm_dmax;        /* Linear address of 1 byte past the end of
  661.                    the dynamic linear range */
  662.     ULONG vm_eltime;    /* Elapse time in seconds since last
  663.                    VM status reset */
  664.     ULONG vm_pfltcnt;    /* Number of page faults since last
  665.                    VM status reset */
  666.     ULONG vm_wrtcnt;    /* Number of pages written out to disk
  667.                    since the last VM status reset */
  668.     ULONG vm_reclcnt;    /* Number of reclaimed pages since the
  669.                    last VM status reset */
  670.     ULONG vm_nvirtpg;    /* Number of virtual pages allocated to
  671.                    application */
  672.     ULONG vm_nswappg;    /* Size of swap file, in pages */
  673.     ULONG vm_rsrv3;        /* reserved, contents undefined */
  674.     ULONG vm_minconvpg;    /* Minimum number of conventional memory 
  675.                    pages required */
  676.     ULONG vm_maxswpg;    /* Max. size of swap file, in pages */
  677.     ULONG vm_flags;        /* flag bits */
  678.     ULONG vm_nfree;        /* number of free physical pages GUARANTEED 
  679.                    (total number of physical pages currently
  680.                    used by appl and 386|DOS-Extender system
  681.                    data is vm_nfree + vm_syspg + vm_nallocpg */
  682.     ULONG vm_navail;    /* number of free physical pages currently 
  683.                    available (equal to
  684.                    MIN(vm_nextpg, vm_extpglim) - vm_nlockpg - 
  685.                                    vm_syspg */
  686.     ULONG vm_maxblk;    /* largest available memory block that the
  687.                    application can allocate, in pages.
  688.                    Without 386|VMM, this is vm_navail less
  689.                    any system pages (such as page tables)
  690.                    needed.  With 386|VMM, this number takes
  691.                    disk space into account, so it's typically
  692.                    larger than vm_navail.  Under a DPMI
  693.                    host, it's whatever the DPMI host says
  694.                    is the largest available memory block. */
  695.     ULONG vm_rsrv[1];    /* Reserved, always zero */
  696. } VM_STATS;
  697.  
  698. /*
  699.  * Bit definitions for flags in VM_STATS structure
  700.  */
  701. #define VMFL_PGFLT    0x00000001    /* page fault in progress */
  702.  
  703. /*
  704.  * 386|DOS-Extender parameters block  for Get/Set 386|DOS-Extender Parameters 
  705.  *        System Call, 252Eh (_dx_vmm_pget())
  706.  */
  707. typedef struct
  708. {
  709.     ULONG    vp_flags;    /* flag bits */
  710.     ULONG    vp_vscan;    /* scan period, in milliseconds, for */
  711.                 /* updating page ageing information */
  712.                 /* always 0 if 386|VMM not present */
  713.     ULONG    vp_vslen;    /* max length, in bytes, of linear address */
  714.                 /* space to process on each page table scan */
  715.                 /* always 0 if 386|VMM not present */
  716.     ULONG    vp_rsrvd[13];    /* reserved for future expansion */
  717. } VM_PARAMS;
  718.  
  719. /*
  720.  * Bit definitions for flags in VM_PARAMS struct
  721.  */
  722. #define VMP_PGLOGEN    0x00000001    /* set if page fault logging enabled */
  723. /* the following flags were added in release 5.0 of 386|DOS-Extender */
  724. #define VMP_SWAPEXEC    0x00000002    /* swap 386|DOS-Extender to disk for */
  725.                     /* the duration of an INT 21h 4Bh */
  726.                     /* EXEC system call */
  727. #define VMP_NOZERO    0x00000004    /* disable automatic zeroing of */
  728.                     /* memory after allocation */
  729.  
  730. /*
  731.  * Data structure for Get Configuration Information call 
  732.              (2526h, _dx_config_inf())
  733.  */
  734. typedef struct {
  735.     ULONG    c_flags1;    /* flags dword 1 */
  736.     ULONG    c_flags2;    /* flags dword 2 */
  737.     ULONG    c_flags3;    /* flags dword 3 */
  738.     ULONG    c_major;    /* 386|DOS-Extender major version # */
  739.     ULONG    c_minor;    /* 386|DOS-Extender minor version # */
  740.     ULONG    c_letter;    /* first letter, in ASCII, of text following */
  741.                 /* minor version # in version number string */
  742.                 /* 0 if no letter present */
  743.     ULONG    c_betaf;    /* 0 ==> not a beta version, 1 ==> beta */
  744.                 /* more than one letter following minor */
  745.                 /* version number) */
  746.     ULONG    c_processor;    /* 3 ==> 386, 4 ==> 486 */
  747.     ULONG    c_coproc;    /* 4 ==> none, 6 ==> 287, 7 ==> 387 or 486 */
  748.     ULONG    c_weitekf;    /* 0 ==> not present, 1 ==> present (see */
  749.                 /* also c_1167 below) */
  750.     ULONG    c_machine;    /* 0 ==> IBM compat, 1 ==> NEC 9800 series */
  751.     ULONG    c_mclass;    /* IBM:  0==>ISA, 1==>MCA, 2==>XT, 3==>EISA */
  752.                 /* NEC:  0==>normal mode, 1==>high res mode */
  753.     ULONG    c_dosenv;    /* VCPI flag; 0==>no VCPI, 1==>VCPI present */
  754.     ULONG    c_1167;        /* -WEITEK or -1167 switch setting:  */
  755.                 /* 0 ==> AUTO, 1 ==> ON, 2 ==> OFF */
  756.     ULONG    c_minreal;    /* -MINREAL switch setting */
  757.     ULONG    c_maxreal;    /* -MAXREAL switch setting */
  758.     ULONG    c_minibuf;    /* -MINIBUF switch setting */
  759.     ULONG    c_maxibuf;    /* -MAXIBUF switch setting */
  760.     ULONG    c_ibufsize;    /* size of data buf for DOS calls, in bytes */
  761.     ULONG    c_nistack;    /* -NISTACK switch setting */
  762.     ULONG    c_istksize;    /* -ISTKSIZE switch setting */
  763.     ULONG    c_realbreak;    /* -REALBREAK switch setting */
  764.     ULONG    c_callbufs;    /* -CALLBUFS switch setting */
  765.     ULONG    c_hwivec;    /* -HWIVEC switch setting */
  766.     ULONG    c_privec;    /* -PRIVEC switch setting */
  767.     ULONG    c_intmap;    /* -INTMAP switch setting */
  768.     ULONG    c_primap;    /* -PRIMAP switch setting */
  769.     ULONG    c_irq0;        /* hardware interrupt vector for IRQ0 when */
  770.                 /* running under VCPI */
  771.     ULONG    c_irq8;        /* HW interrupt vector for IRQ8 under VCPI, 0*/
  772.                 /* if running on an XT with only IRQ0-7 */
  773.     ULONG    c_prscreen;    /* interrupt vector for BIOS print screen, */
  774.                 /* 0 if c_machine == NEC */
  775.     ULONG    c_extlow;    /* -EXTLOW switch setting */
  776.     ULONG    c_exthigh;    /* -EXTHIGH switch setting */
  777.     ULONG    c_minext;    /* physical addr of lowest extended memory */
  778.                 /* 386|DOS-Extender will ever allocate */
  779.     ULONG    c_maxext;    /* physical addr of 1 byte past highest */
  780.                 /* ext mem 386|DOS-Extender will allocate */
  781.     ULONG    c_smem_base;    /* physical base addr of "special" memory */
  782.                 /* (either auto detected, or specified with */
  783.                 /* the -SPCLMEM switch, 0 if none) */
  784.     ULONG    c_smem_size;    /*size, in bytes, of "special" mem, 0 if none*/
  785.     ULONG    c_maxvcpimem;    /* -MAXVCPIMEM switch setting */
  786.     ULONG    c_vscan;    /* -VSCAN switch setting */
  787.     ULONG    c_swapchk;    /* -SWAPCHK switch setting:  0 ==> OFF, */
  788.                 /* 1 ==> ON, 2 ==> FORCE, 3 ==> MAX */
  789.     ULONG    c_codesize;    /* -CODESIZE switch setting */
  790.     ULONG    c_minswfsize;    /* -MINSWFSIZE switch setting */
  791.     ULONG    c_maxswfsize;    /* -MAXSWFSIZE switch setting */
  792.     ULONG    c_replpolicy;    /* 0 ==> LFU, 1 ==> NUR */
  793.     ULONG    c_ngdtent;    /* -NGDTENT switch setting */
  794.     ULONG    c_nldtent;    /* -NLDTENT switch setting */
  795.     ULONG    c_priv;        /*privilege level program is running at (0-3)*/
  796. /* the following values were added in release 3.0 of 386|DOS-Extender */
  797.     ULONG    c_lockstack;    /* -LOCKSTACK switch setting */
  798.     ULONG    c_maxextmem;    /* -MAXEXTMEM switch setting */
  799.     ULONG    c_maxxmsmem;    /* -MAXXMSMEM switch setting */
  800.     ULONG    c_maxpgmmem;    /* -MAXPGMMEM switch setting */
  801.     ULONG    c_datathresh;    /* -DATATHRESHOLD switch setting */
  802.     ULONG    c_vmmf;        /* 0 ==> 386|VMM not present, 1 ==> present */
  803.     ULONG    c_cyrixf;    /* 0==>Cyrix EMC387 not present, 1==>present*/
  804.     ULONG    c_cyrix;    /* -CYRIX switch setting, 0 ==> AUTO */
  805.                 /* 1 ==> ON, 2 ==> OFF */
  806.     ULONG    c_dpmif;    /* 0 ==> DPMI not present, 1 ==> present */
  807.     ULONG    c_dpmimaj;    /* DPMI major version number */
  808.     ULONG    c_dpmimin;    /* DPMI minor version number */
  809.     ULONG    c_dpmi_capf;    /* DPMI capabilities flags */
  810.     ULONG    c_vcpimaj;    /* VCPI major version number */
  811.     ULONG    c_vcpimin;    /* VCPI minor version number */
  812.     USHORT    c_vcpiirq0;    /* under VCPI, IRQ0 physical base int vector */
  813.     USHORT    c_vcpiirq8;    /* under VCPI, IRQ8 physical base int vector */
  814.     ULONG    c_xmsf;        /* 0 ==> XMS not present, 1 ==> present */
  815.     ULONG    c_xmsmaj;    /* XMS major version number */
  816.     ULONG    c_xmsmin;    /* XMS minor version number */
  817.     USHORT    c_cs_sel;    /* appl's CS selector */
  818.     USHORT    c_ds_sel;    /* appl's DS selector */
  819.     USHORT    c_psp_sel;    /* appl's PSP selector */
  820.     USHORT    c_env_sel;    /* appl's environment selector */
  821.     USHORT    c_dos_sel;    /* selector for segment mapping DOS 1MB */
  822.                 /* address space */
  823.     USHORT    c_vidtxt_sel;    /* selector for segment mapping video text */
  824.                 /* memory */
  825.     USHORT    c_vidgrph_sel;    /* selector for segment that maps video */
  826.                 /* graphics memory on NEC machines;  maps */
  827.                 /* the same memory as the video text segment */
  828.                 /* on IBM-compatible machines */
  829.     USHORT    c_weitek_sel;    /* selector of segment that maps Weitek */
  830.                 /* address space, 0 if no Weitek chip */
  831.     USHORT    c_cyrix_sel;    /* selector of segment that maps Cyrix EMC387*/
  832.                 /* address space, 0 if no Cyrix chip */
  833.     USHORT    c_unused;    /* reserved, always zero */
  834.     ULONG    c_swprot;    /* real mode FAR addr of 386|DOS-X routine */
  835.                 /* to CALL for a jump to protected mode */
  836.                 /* with no saved context */
  837.     ULONG    c_ldtsize;    /* size of LDT, in bytes */
  838. /* The following values were added in release 5.0 of 386|DOS-Extender */
  839.     ULONG    c_windowsf;    /* 0 ==> Windows not present, 1 ==> present */
  840.     ULONG    c_winmaj;    /* Windows major version number */
  841.     ULONG    c_winmin;    /* Windows minor version number */
  842.     ULONG    c_winenhf;    /* 0 ==> Windows real or standard mode, */
  843.                 /* 1 ==> Windows enhanced mode */
  844.     ULONG    c_os2f;        /* 0 ==> OS/2 not present, 1 ==> present */
  845.     ULONG    c_os2maj;    /* OS/2 major version number */
  846.     ULONG    c_os2min;    /* OS/2 minor version number */
  847.     ULONG    c_rsrv[50];    /* Reserved, always zero */
  848. } CONFIG_INF;
  849. /*
  850.  * Bit definitions for c_flags1.  c_flags2 and c_flags3 are currently unused.
  851.  */
  852. #define    CF1_NOPAGE    0x00000001L    /* -NOPAGE switch used */
  853. #define    CF1_A20        0x00000002L    /* -A20 switch used */
  854. #define    CF1_VDISK    0x00000004L    /* -VDISK switch used */
  855. #define    CF1_XT        0x00000008L    /* -XT switch used */
  856. #define    CF1_AT        0x00000010L    /* -AT switch used */
  857. #define    CF1_MCA        0x00000020L    /* -MCA switch used */
  858. #define    CF1_EISA    0x00000040L    /* -EISA switch used */
  859. #define    CF1_NORMRES    0x00000080L    /* -NORMRES switch (for NEC) used */
  860. #define    CF1_HIGHRES    0x00000100L    /* -HIGHRES switch (for NEC) used */
  861. #define    CF1_SWFGROW    0x00000200L    /* 1 ==> -SWFGROW1ST switch used, */
  862.                     /* 0 ==> -NOSWFGROW1ST */
  863. #define    CF1_NOVM    0x00000400L    /* -NOVM switch used */
  864. #define    CF1_SAVEREGS    0x00000800L    /* -SAVEREGS switch used */
  865. /*    0x00001000L            not used, always zero */
  866. #define    CF1_NOVCPI    0x00002000L    /* -NOVCPI switch used */
  867. #define    CF1_NOMUL    0x00004000L    /* -NOMUL switch used */
  868. #define    CF1_NOBMCHK    0x00008000L    /* -NOBMCHK switch used */
  869. #define    CF1_NOSPCL    0x00010000L    /* -NOSPCLMEM or -NOBIM switch used */
  870. #define    CF1_NOPGEXP    0x00020000L    /* -NOPGEXP switch used */
  871. #define    CF1_SWAPDEFDISK    0x00040000L    /* -SWAPDEFDISK switch used */
  872. /* the following values were added in release 3.0 of 386|DOS-Extender */
  873. #define CF1_SAVEINTS    0x00080000L    /* -SAVEINTS switch used */
  874. #define CF1_NOLOAD    0x00100000L    /* -NOLOAD switch used */
  875. #define CF1_PAGELOG    0x00200000L    /* -PAGELOG switch used */
  876. #define CF1_OPENDENY    0x00400000L    /* -OPENDENY switch used */
  877. #define CF1_ERRATA17    0x00800000L    /* -ERRATA17 switch used */
  878. /* The following values were added in release 4.1 of DOS-X */
  879. #define CF1_NESTDPMI    0x01000000L    /* -NESTDPMI switch used */
  880. #define CF1_NONESTDPMI    0x02000000L    /* -NONESTDPMI switch used */
  881. #define CF1_NODPMI    0x04000000L    /* -NODPMI switch used */
  882. #define CF1_NOPCDWEITEK    0x08000000L    /* -NOPCDWEITEK switch used */
  883. /* the following values were added in release 4.2 of DOS-X */
  884. #define CF1_WININT21    0x10000000L    /* -WININT21 switch used */
  885.  
  886. /*
  887.  * Flags bits for DPMI capabilities flags dword 
  888.  */
  889. #define CD_PAGING    0x00000001L    /* paging support capability present */
  890.                     /* (never present in 0.9 DPMI, always*/
  891.                     /* present if 1.0 or later DPMI) */
  892. #define CD_DEVMAP    0x00000002L    /* Physical Device Mapping capability*/
  893.                     /* present */
  894. #define CD_CONVMEM    0x00000004L    /* Conventional Memory Mapping */
  895.                     /* capability present */
  896. #define CD_EXCRSTRT    0x00000008L    /* Exceptions Restartability */
  897.                     /* capability present */
  898.  
  899. /*
  900.  * Data structure for system calls 2528h (_dx_cc_rdregs()),
  901.  *            2538h (_dx_swi_rdregs()), and 253Bh (_dx_jmp_toreal())
  902.  * Also used by _dx_real_int(), issue real mode interrupt
  903.  */
  904. typedef struct {
  905.     USHORT    u1;        /* unused, never modified */
  906.     ULONG    u2;        /* unused, never modified */
  907.     USHORT    u3;        /* unused, never modified */
  908.     ULONG    eax;        /* register EAX contents */
  909.     ULONG    ebx;        /* register EBX contents */
  910.     ULONG    ecx;        /* register ECX contents */
  911.     ULONG    edx;        /* register EDX contents */
  912.     ULONG    esi;        /* register ESI contents */
  913.     ULONG    edi;        /* register EDI contents */
  914.     ULONG    ebp;        /* register EBP contents */
  915.     ULONG    esp;        /* register ESP contents */
  916.     USHORT    cs;        /* register CS contents */
  917.     USHORT    ds;        /* register DS contents */
  918.     USHORT    ss;        /* register SS contents */
  919.     USHORT    es;        /* register ES contents */
  920.     USHORT    fs;        /* register FS contents */
  921.     USHORT    gs;        /* register GS contents */
  922.     ULONG    eip;        /* register EIP contents */
  923.     ULONG    flags;        /* register EFLAGS contents */
  924. } SWI_REGS;
  925.  
  926. /*
  927.  * Bit definitions for the page type word returned for each page by the
  928.  * Get Page Types call (system call 252Bh, subfunction 4, _dx_gtyp_pgs())
  929.  *
  930.  * The flags bits apply only if the page type is allocated.
  931.  */
  932. #define PT_TYPE        0x000F    /* page type code field */
  933.     #define PTYP_UNMAP    0    /* unmapped page */
  934.     #define PTYP_ALLOC    1    /* allocated page */
  935.     #define PTYP_PHYSDEV    2    /* physical device page */
  936. #define PT_LOCKED    0x0010    /* allocated page is locked */
  937. #define PT_SWAPPED    0x0020    /* allocated page is swapped to disk */
  938. #define PT_ROFILE    0x0040    /* alloc'd page mapped to rd only data file */
  939. #define PT_RWFILE    0x0080    /* alloc'd page mapped to rd/wr data file */
  940.  
  941. /*
  942.  * Data structure pointed to by DS:ESI on Map Data File at Offset call
  943.  * (system call 252Bh, subfunction 11, _dx_mapf_offs())
  944.  */
  945. typedef struct {
  946.     ULONG    start_offs;    /* starting BYTE offset to map in file */
  947.     ULONG    access;        /* file access and sharing mode for file open*/
  948. } MAP_FILE;
  949.  
  950. /*
  951.  * Data structure for Read/Write System Registers system call 2535h 
  952.  *            (_dx_sysregs_get(), _dx_sysregs_set())
  953.  */
  954. typedef struct{
  955.     ULONG    cr0;        /* Control Register 0 */
  956.     ULONG    dr0;        /* Debug Register 0 */
  957.     ULONG    dr1;        /* Debug Register 1 */
  958.     ULONG    dr2;        /* Debug Register 2 */
  959.     ULONG    dr3;        /* Debug Register 3 */
  960.     ULONG    rsrv1[2];    /* reserved, always zeroed */
  961.     ULONG    dr6;        /* Debug Register 6 */
  962.     ULONG    dr7;        /* Debug Register 7 */
  963.     ULONG    rsrv2[3];    /* reserved, always zeroed */
  964. } SYS_REGS;
  965.  
  966. /*
  967.  * Record numbers for page log file created by 386|VMM if the
  968.  * -PAGELOG switch is used
  969.  */
  970. #define PREC_BASE    0    /* segment base changed record */
  971. #define PREC_LIMIT    1    /* segment limit changed record */
  972. #define PREC_PGFLT    2    /* page fault record */
  973. #define PREC_SWAPSIZ    3    /* swap file size increased record */
  974. #define PREC_APPL    4    /* application-defined record */
  975.  
  976. /*
  977.  * Flag bit definitions for the flags byte in a page fault record 
  978.  */
  979. #define PLOG_DSKRD    0x01    /* set if page read from swap file, EXP */
  980.                 /* file, or mapped data file;  cleared if */
  981.                 /* page was just zeroed */
  982. #define PLOG_SWAPRD    0x02    /* set if read from swap file, cleared if */
  983.                 /* read from EXP file or mapped data file */
  984. #define PLOG_THRASH    0x04    /* set if this page has been in memory */
  985.                 /* before, cleared if 1st time in memory */
  986. #define PLOG_REPLCD    0x08    /* set if another virtual page was replaced */
  987.                 /* (kicked out of memory), cleared if a free */
  988.                 /* physical page was available.  If set, */
  989.                 /* the DWORD at offset 6 in the page fault */
  990.                 /* record is present, and specifies the */
  991.                 /* linear addr of the replaced page */
  992. #define PLOG_SWAPWR    0x10    /* set if replaced page written to swap file */
  993.                 /* or to a read/write mapped data file, */
  994.                 /* cleared if replaced page just discarded */
  995.                 /* because it was unmodified */
  996.  
  997. /*
  998.  * Interrupt stack frame for interrupt handlers
  999.  */
  1000. typedef struct {
  1001.     ULONG    int_dosx_eip;    /* EIP in 386|DOS-X umbrella handler */
  1002.     USHORT    int_dosx_cs;    /* CS in 386|DOS-X umbrella handler */
  1003.     USHORT    int_dosx_cshigh; /* unused high word of CS */
  1004.     ULONG    int_dosx_eflags; /* EFLAGS in 386|DOS-X umbrella handler */
  1005.     ULONG    int_eip;    /* EIP at time interrupt occurred */
  1006.     USHORT    int_cs;        /* CS at time interrupt occurred */
  1007.     USHORT    int_cshigh;    /* unused high word of CS */
  1008.     ULONG    int_eflags;    /* EFLAGS at time interrupt occurred */
  1009.     ULONG    int_esp;    /* ESP at time interrupt occurred */
  1010.     USHORT    int_ss;        /* SS at time interrupt occurred */
  1011.     USHORT    int_sshigh;    /* unused high word of SS */
  1012.     USHORT    int_es;        /* ES at time interrupt occurred */
  1013.     USHORT    int_eshigh;    /* unused high word of ES */
  1014.     USHORT    int_ds;        /* DS at time interrupt occurred */
  1015.     USHORT    int_dshigh;    /* unused high word of DS */
  1016.     USHORT    int_fs;        /* FS at time interrupt occurred */
  1017.     USHORT    int_fshigh;    /* unused high word of FS */
  1018.     USHORT    int_gs;        /* GS at time interrupt occurred */
  1019.     USHORT    int_gshigh;    /* unused high word of GS */
  1020.     ULONG    int_dxfl;    /* flags, defined below */
  1021.     ULONG    int_inum;    /* interrupt number */
  1022.     ULONG    int_cr2;    /* CR2 at time interrupt occurred, for
  1023.                    page fault (exception 0Eh) only */
  1024. } INT_STACK_FRAME;
  1025.  
  1026. /*
  1027.  * Flags dword in interrupt stack frame
  1028.  */
  1029. #define IFL_RMODE    0x00000001    /* int occurred in real mode */
  1030. #define IFL_LDSREGS    0x00000002    /* load seg regs on return */
  1031.  
  1032. /*
  1033.  * For prototypes for functions in the Phar Lap libraries, force
  1034.  * stack-based C calling conventions.
  1035.  */
  1036. #ifdef __cplusplus
  1037. extern "C" {
  1038. #endif
  1039.  
  1040. #ifndef NO_FARMEM_PROTOS
  1041. /*
  1042.  * Function prototypes for routines to access real mode memory, and
  1043.  * far memory (memory in another segment).  These routines are in DOSX32.LIB
  1044.  */
  1045. UCHAR __STKCALL PeekRealByte(REALPTR ptr);
  1046. USHORT __STKCALL PeekRealWord(REALPTR ptr);
  1047. ULONG __STKCALL PeekRealDWord(REALPTR ptr);
  1048. void __STKCALL PeekRealDouble(REALPTR ptr, double *dp);
  1049. void __STKCALL PokeRealByte(REALPTR ptr, UCHAR data);
  1050. void __STKCALL PokeRealWord(REALPTR ptr, USHORT data);
  1051. void __STKCALL PokeRealDWord(REALPTR ptr, ULONG data);
  1052. void __STKCALL PokeRealDouble(REALPTR ptr, double data);
  1053. void __STKCALL ReadRealMem(void *bufp, REALPTR realp, UINT count);
  1054. void __STKCALL WriteRealMem(REALPTR realp, void *bufp, UINT count);
  1055. void __STKCALL RealMemCopy(REALPTR dstp, REALPTR srcp, UINT count);
  1056. void __STKCALL FillRealMem(REALPTR realp, UCHAR data, UINT count);
  1057. void __STKCALL ReadRealString(void *strp, REALPTR realp);
  1058. void __STKCALL WriteRealString(REALPTR realp, void *strp);
  1059. void __STKCALL RealStringCopy(REALPTR dstp, REALPTR srcp);
  1060. UINT __STKCALL RealStringLen(REALPTR realp);
  1061.  
  1062. UCHAR __STKCALL PeekFarByte(FARPTR ptr);
  1063. USHORT __STKCALL PeekFarWord(FARPTR ptr);
  1064. ULONG __STKCALL PeekFarDWord(FARPTR ptr);
  1065. void __STKCALL PeekFarDouble(FARPTR ptr, double *dp);
  1066. void __STKCALL PokeFarByte(FARPTR ptr, UCHAR data);
  1067. void __STKCALL PokeFarWord(FARPTR ptr, USHORT data);
  1068. void __STKCALL PokeFarDWord(FARPTR ptr, ULONG data);
  1069. void __STKCALL PokeFarDouble(FARPTR ptr, double data);
  1070. void __STKCALL ReadFarMem(void *bufp, FARPTR farp, UINT count);
  1071. void __STKCALL WriteFarMem(FARPTR farp, void *bufp, UINT count);
  1072. void __STKCALL FarMemCopy(FARPTR dstp, FARPTR srcp, UINT count);
  1073. void __STKCALL FillFarMem(FARPTR farp, UCHAR data, UINT count);
  1074. void __STKCALL ReadFarString(void *strp, FARPTR farp);
  1075. void __STKCALL WriteFarString(FARPTR farp, void *strp);
  1076. void __STKCALL FarStringCopy(FARPTR dstp, FARPTR srcp);
  1077. UINT __STKCALL FarStringLen(FARPTR farp);
  1078.  
  1079. #endif    /* NO_FARMEM_PROTOS */
  1080.  
  1081. /*    
  1082.  * Function prototypes for C-callable routines in DOSX32.LIB, to make
  1083.  * 386|DOS-Extender system calls from C.
  1084.  *
  1085.  * All functions return an _DOSE_ or _DXE_ error code, a zero value 
  1086.  * (_DOSE_NONE) meaning no error.
  1087.  *
  1088.  * (Note function prototypes for C-callable routines in DOS32.LIB are in
  1089.  * the separate header file PLDOS32.H).
  1090.  */
  1091. /* 2501h - Reset 386|DOS-X data structures */
  1092. void __STKCALL _dx_reset_data(void);
  1093. /* 2502h - Get prot mode interrupt vector */
  1094. void __STKCALL _dx_pmiv_get(UINT int_no, FARPTR *int_handpp);
  1095. /* 2503h - Get real mode interrupt vector */
  1096. void __STKCALL _dx_rmiv_get(UINT int_no, REALPTR *int_handpp);
  1097. /* 2504h - Set prot mode interrupt vector */
  1098. void __STKCALL _dx_pmiv_set(UINT int_no, FARPTR int_handp);
  1099. /* 2505h - Set real mode interrupt vector */
  1100. void __STKCALL _dx_rmiv_set(UINT int_no, REALPTR int_handp);
  1101. /* 2506h - Set interrupt to always passup to prot mode handler */
  1102. void __STKCALL _dx_apmiv_set(UINT int_no, FARPTR int_handp);
  1103. /* 2507h - Set both real and prot mode interrupt vectors */
  1104. void __STKCALL _dx_rpmiv_set(UINT int_no, FARPTR pm_int_handp,
  1105.                      REALPTR rm_int_handp);
  1106. /* 2508h - Get segment linear base address */
  1107. int __STKCALL _dx_tolinear(USHORT selector, ULONG *lin_addrp);
  1108. /* 2509h - Convert linear address to physical address */
  1109. int __STKCALL _dx_tophys(ULONG lin_addr, ULONG *phys_addrp);
  1110. /* 250Ah - Map physical memory at end of segment */
  1111. int __STKCALL _dx_map_phys(USHORT selector, ULONG phys_addr, ULONG page_cnt,
  1112.                 ULONG *offsetp);
  1113. /* 250Bh - Does not exist */
  1114. /* 250Ch - Get hardware interrupt vectors */
  1115. void __STKCALL _dx_hwiv_get(UINT *irq0_7p, UINT *irq8_15p, UINT *prt_scrp);
  1116. /* 250Dh - Get real mode link information */
  1117. void __STKCALL _dx_rmlink_get(REALPTR *cback_addrpp, REALPTR *rm_cbuff_addrpp,
  1118.                ULONG *cbuff_sizep, FARPTR *pm_cbuff_addrpp);
  1119. /* 250Eh - Not supported from C, use 2510h instead */
  1120. /* 250Fh - Convert prot mode addr to MS-DOS addr */
  1121. int __STKCALL _dx_torealn(void *pm_addrp, ULONG byte_cnt, REALPTR *rm_addrpp);
  1122. int __STKCALL _dx_toreal(FARPTR pm_addrp, ULONG byte_cnt, REALPTR *rm_addrpp);
  1123. /* 
  1124.  * 2510h - Call real mode procedure
  1125.  *    On input, the registers struct contains the REAL MODE register
  1126.  *        values to be loaded into EAX-EDX,DS,ES,FS,GS before calling
  1127.  *        the real mode procedure.  All other real mode register values
  1128.  *        (including EFLAGS) cannot be specified.
  1129.  *    On output, the struct contains the register values that were in
  1130.  *        EAX-EDX,DS,ES,FS,GS after the real mode procedure returned
  1131.  *        (NOTE this differs from the assembly language call, which
  1132.  *        only returns some register values in the struct, and others in 
  1133.  *        actual registers).
  1134.  *    The parameters to the real mode function are passed following the
  1135.  *        last explicit parameter in the prototype (e.g. to call
  1136.  *        the real mode function rfunc(ULONG val) with val = 25, you 
  1137.  *        would write:  errv = _dx_call_real(funcp, ®s, 2, 25L);
  1138.  *        where of course you have already initialized funcp and
  1139.  *        the regs structure appropriately.
  1140.  *    It's best to always pass ULONG parameters to real mode functions;
  1141.  *        if you want to pass USHORTs you have to pack them yourself,
  1142.  *        because the C compiler always 4-byte aligns parameters
  1143.  *        pushed on the stack, regardless of the size of the data type.
  1144.  *        Don't forget the parameter count is a WORD count, so, e.g.,
  1145.  *        if you pass 2 ULONGs the parameter count is 4.
  1146.  */
  1147. int __STKCALL _dx_call_real(REALPTR proc_addrp, RMC_BLK *rmode_regp, 
  1148.                         ULONG word_cnt, ...);
  1149.  
  1150. /*
  1151.  * 2511h - Issue real mode interrupt
  1152.  *    On input, the registers struct contains the REAL MODE register
  1153.  *        values to be loaded before issuing the real mode interrupt
  1154.  *    On output, the struct contains the register values after the
  1155.  *        real mode interrupt handler returned.
  1156.  *    Structure register values used are:
  1157.  *        EAX,EBX,ECX,EDX,ESI,EDI,EBP
  1158.  *        DS,ES,FS,GS
  1159.  *        EFLAGS status bits (CF,PF,AF,ZF,SF,OF) only - all others masked
  1160.  *    All other members of the SWI_REGS struct are not used or modified.
  1161.  */
  1162. void __STKCALL _dx_real_int(UINT inum, SWI_REGS *rmode_regp);
  1163. /* 2512h - Load program for debugging (252Ah is preferable) */
  1164. int __STKCALL _dx_dbg_load(UCHAR *prog_namep, LDDBG_BLK *parmp, UINT ldt_bytes,
  1165.               UINT *sel_countp);
  1166. /* 2513h - Alias segment descriptor */
  1167. int __STKCALL _dx_seg_alias(USHORT selector, UINT acc_rights, UINT use_types, 
  1168.                      USHORT *alias_selp);
  1169. /* 2514h - Change segment attributes (see also 2531h) */
  1170. int __STKCALL _dx_segattr_set(USHORT selector, UINT acc_rights,UINT use_types);
  1171. /* 2515h - Get segment attributes (see also 2531h) */
  1172. int __STKCALL _dx_segattr_get(USHORT selector, UINT *acc_rightsp, 
  1173.                UINT *use_typesp);
  1174. /* 2516h - Free all LDT segments (use of this call not advised) */
  1175. void __STKCALL _dx_ldtmem_free(void);
  1176. /* 2517h - Get info on DOS data buffer */
  1177. void __STKCALL _dx_dosbuf_get(FARPTR *pm_buffpp, REALPTR *rm_buffpp,
  1178.                  ULONG *buff_sizep);
  1179. /* 2518h - Specify handler for moved segments */
  1180. void __STKCALL _dx_segmove_hand(FARPTR new_handp, FARPTR *old_handpp);
  1181. /* 2519h - Get additional memory error information */
  1182. int __STKCALL _dx_memerr_get(void);
  1183. /* 251Ah - Lock pages (see also 252Bh subfunc 5) */
  1184. int __STKCALL _dx_page_lockn(void *addrp, ULONG npage);
  1185. int __STKCALL _dx_page_lock(FARPTR addrp, ULONG npage);
  1186. int __STKCALL _dx_page_lockl(ULONG linadr, ULONG npage);
  1187. /* 251Bh - Unlock pages (see also 252Bh subfunc 6) */
  1188. int __STKCALL _dx_page_unlockn(void *addrp, ULONG npage);
  1189. int __STKCALL _dx_page_unlock(FARPTR addrp, ULONG npage);
  1190. int __STKCALL _dx_page_unlockl(ULONG linadr, ULONG npage);
  1191. /* 251Ch - Free physical memory pages (see also 252Bh subfunc 7 & 8) */
  1192. int __STKCALL _dx_page_freen(void *addrp, ULONG npage, BOOL discardf);
  1193. int __STKCALL _dx_page_free(FARPTR addrp, ULONG npage, BOOL discardf);
  1194. int __STKCALL _dx_page_freel(ULONG linadr, ULONG npage, BOOL discardf);
  1195. /* 251Dh  - Read Page Table Entry (PTE) */
  1196. /* This function is outdated;  _dx_rd_ptinf (252Bh subfunc 9) should be */
  1197. /* used instead, because _dx_pte_read doesn't read associated page table info*/
  1198. int __STKCALL _dx_pte_readn(void *addrp, ULONG *valp);
  1199. int __STKCALL _dx_pte_read(FARPTR addrp, ULONG *valp);
  1200. int __STKCALL _dx_pte_readl(ULONG linadr, ULONG *valp);
  1201. /* 251Eh - Write Page Table Entry (PTE) */
  1202. /* This function is outdated;  _dx_wr_ptinf (252Bh subfunc 10) should be */
  1203. /* used instead, because _dx_pte_write doesn't write associated PTE info*/
  1204. int __STKCALL _dx_pte_writen(void *addrp, ULONG val);
  1205. int __STKCALL _dx_pte_write(FARPTR addrp, ULONG val);
  1206. int __STKCALL _dx_pte_writel(ULONG linadr, ULONG val);
  1207. /* 251Fh - Exchange two PTEs */
  1208. int __STKCALL _dx_pte_xchgn(void *addr1p, void *addr2p);
  1209. int __STKCALL _dx_pte_xchg(FARPTR addr1p, FARPTR addr2p);
  1210. int __STKCALL _dx_pte_xchgl(ULONG linaddr1, ULONG linadr2);
  1211. /* 2520h - Get memory statistics */
  1212. void __STKCALL _dx_vm_stats(VM_STATS *statp, BOOL resetf);
  1213. /* 2521h - Limit program's physical extended memory usage */
  1214. int __STKCALL _dx_xmem_limit(ULONG npages, ULONG *minp, ULONG *maxp);
  1215. /* 2522h - Install alternate page fault handler */
  1216. void __STKCALL _dx_pgflt_hand(FARPTR new_handp, FARPTR *old_handpp);
  1217. /* 2523h - Install out-of-swap-space handler */
  1218. void __STKCALL _dx_oswsp_hand(FARPTR new_addrp, FARPTR *old_addrpp);
  1219. /* 2524h - Install page replacement handlers */
  1220. void __STKCALL _dx_pgrepl_hand(FARPTR new_raddrp, FARPTR *old_raddrpp,
  1221.                FARPTR new_taddrp, FARPTR *old_taddrpp,
  1222.                FARPTR new_paddrp, FARPTR *old_paddrpp);
  1223. /* 2525h - Limit program's physical conventional memory usage */
  1224. int __STKCALL _dx_cmem_limit(ULONG npages, ULONG *minp, ULONG *maxp);
  1225. /* 2526h - Get configuration information */
  1226. void __STKCALL _dx_config_inf(CONFIG_INF *configp, UCHAR *swf_namep);
  1227. /* 2527h - Enable/disable state saving on interrupts */
  1228. BOOL __STKCALL _dx_dbg_regsav(BOOL savf);
  1229. /* 2528h - Get last prot mode state after DOS CTRL-C interrupt */
  1230. int __STKCALL _dx_cc_rdregs(SWI_REGS *regp);
  1231. /* 2529h - Load flat model .EXP or .REX file */
  1232. int __STKCALL _dx_ld_flat(UCHAR *prog_namep, LDEXP_BLK *parmp, 
  1233.     BOOL dmdloadf, UINT *vmmhp, UINT *errinfop, UINT *doserrp);
  1234. /* 2529h - Load flat model .EXP or .REX file with NO paging from EXP file */
  1235. int __STKCALL _dx_ld_novm(UCHAR *prog_namep, LDEXP_BLK *parmp, 
  1236.                     UINT *errinfop, UINT *doserrp);
  1237. /* 252Ah - Load program for debugging */
  1238. int __STKCALL _dx_dbg_ld(UCHAR *prog_namep, LDDBG_BLK *parmp, UINT ldt_bytes,
  1239.                       BOOL dmdloadf, UINT *vmmhp, UINT *ndescp,
  1240.                UINT *errinfop, UINT *doserrp);
  1241. /* 252Bh, BH=0 - Create unmapped pages */
  1242. int __STKCALL _dx_umap_pgsn(void *addrp, UINT len);
  1243. int __STKCALL _dx_umap_pgs(FARPTR addrp, UINT len);
  1244. int __STKCALL _dx_umap_pgsl(ULONG linadr, UINT len);
  1245. /* 252Bh, BH=1 - Create allocated pages */
  1246. int __STKCALL _dx_alloc_pgsn(void *addrp, UINT len);
  1247. int __STKCALL _dx_alloc_pgs(FARPTR addrp, UINT len);
  1248. int __STKCALL _dx_alloc_pgsl(ULONG linadr, UINT len);
  1249. /* 252Bh, BH=2 - Create physical device pages */
  1250. int __STKCALL _dx_map_pgsn(void *addrp, UINT len, ULONG baseaddr);
  1251. int __STKCALL _dx_map_pgs(FARPTR addrp, UINT len, ULONG baseaddr);
  1252. int __STKCALL _dx_map_pgsl(ULONG linadr, UINT len, ULONG baseaddr);
  1253. /* 252Bh, BH=3 - Map data file (see also 252Bh, BH=12) */
  1254. int __STKCALL _dx_mfile_pgsn(void *addrp, UINT len, UCHAR *fnamep, 
  1255.     USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, UINT *doserr);
  1256. int __STKCALL _dx_mfile_pgs(FARPTR addrp, UINT len, UCHAR *fnamep, 
  1257.     USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, UINT *doserr);
  1258. int __STKCALL _dx_mfile_pgsl(ULONG linadr, UINT len, UCHAR *fnamep, 
  1259.     USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, UINT *doserr);
  1260. /* 252Bh, BH=4 - Get page types */
  1261. int __STKCALL _dx_gtyp_pgsn(void *addrp, UINT len, UCHAR *buffp);
  1262. int __STKCALL _dx_gtyp_pgs(FARPTR addrp, UINT len, UCHAR *buffp);
  1263. int __STKCALL _dx_gtyp_pgsl(ULONG linadr, UINT len, UCHAR *buffp);
  1264. /* 252Bh, BH=5 - Lock pages (see also 251Ah) */
  1265. int __STKCALL _dx_lock_pgsn(void *addrp, UINT len);
  1266. int __STKCALL _dx_lock_pgs(FARPTR addrp, UINT len);
  1267. int __STKCALL _dx_lock_pgsl(ULONG linadr, UINT len);
  1268. /* 252Bh, BH=6 - Unlock pages (see also 251Bh) */
  1269. int __STKCALL _dx_ulock_pgsn(void *addrp, UINT len);
  1270. int __STKCALL _dx_ulock_pgs(FARPTR addrp, UINT len);
  1271. int __STKCALL _dx_ulock_pgsl(ULONG linadr, UINT len);
  1272. /* 252Bh, BH=7 or BH=8 - Free phys pages (see also 251Ch) */
  1273. int __STKCALL _dx_fphys_pgsn(void *addrp, UINT len, BOOL discardf);
  1274. int __STKCALL _dx_fphys_pgs(FARPTR addrp, UINT len, BOOL discardf);
  1275. int __STKCALL _dx_fphys_pgsl(ULONG linadr, UINT len, BOOL discardf);
  1276. /* 252Bh, BH=9 - Read PTE and page table info */
  1277. int __STKCALL _dx_rd_ptinfn(void *addrp, ULONG *ptep, ULONG *ptinfp);
  1278. int __STKCALL _dx_rd_ptinf(FARPTR addrp, ULONG *ptep, ULONG *ptinfp);
  1279. int __STKCALL _dx_rd_ptinfl(ULONG linadr, ULONG *ptep, ULONG *ptinfp);
  1280. /* 252Bh, BH=10 - Write PTE and page table info */
  1281. int __STKCALL _dx_wr_ptinfn(void *addrp, ULONG pte, ULONG ptinf);
  1282. int __STKCALL _dx_wr_ptinf(FARPTR addrp, ULONG pte, ULONG ptinf);
  1283. int __STKCALL _dx_wr_ptinfl(ULONG linadr, ULONG pte, ULONG ptinf);
  1284. /* 252Bh, BH=11 - Map data file at file offset (see also 252Bh, BH = 3) */
  1285. int __STKCALL _dx_mapf_offsn(void *addrp, UINT len, UCHAR *fnamep,
  1286.     ULONG file_offs, USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, 
  1287.     UINT *doserr);
  1288. int __STKCALL _dx_mapf_offs(FARPTR addrp, UINT len, UCHAR *fnamep,
  1289.     ULONG file_offs, USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, 
  1290.     UINT *doserr);
  1291. int __STKCALL _dx_mapf_offsl(ULONG linadr, UINT len,UCHAR *fnamep,
  1292.     ULONG file_offs, USHORT facc, UINT *vmmhp, UINT *flenp, UINT *errinfo, 
  1293.     UINT *doserr);
  1294. /* 252Ch - Add unmapped pages at end of segment */
  1295. int __STKCALL _dx_add_umapg(USHORT selector, ULONG page_cnt, UINT *segoffp);
  1296. /* 252Dh - Close 386|VMM file handle */
  1297. int __STKCALL _dx_vmm_close(UINT vmmhndl);
  1298. /* 252Eh, CL=0 - Get 386|DOS-Extender parameters */
  1299. void __STKCALL _dx_vmm_pget(VM_PARAMS *paramp);
  1300. /* 252Eh, CL=1 - Set 386|DOS-Extender parameters */
  1301. int __STKCALL _dx_vmm_pset(VM_PARAMS *paramp);
  1302. /* 252Fh - Write record to 386|VMM page log file */
  1303. int __STKCALL _dx_vmm_wlog(UCHAR *datap, USHORT datasiz);
  1304. /* 2530h - Set DOS data buffer size */
  1305. int __STKCALL _dx_dosbuf_set(UINT buffsiz);
  1306. /* 2531h, ECX=0 - Read LDT segment descriptor */
  1307. int __STKCALL _dx_ldt_rd(USHORT selector, UCHAR *descp);
  1308. /* 2531h, ECX=1 - Write LDT segment descriptor */
  1309. int __STKCALL _dx_ldt_wr(USHORT selector, UCHAR *descp);
  1310. /* 2532h - Get prot mode processor exception vector */
  1311. int __STKCALL _dx_excep_get(UCHAR num, FARPTR *evecpp);
  1312. /* 2533h - Set prot mode processor exception vector */
  1313. int __STKCALL _dx_excep_set(UCHAR num, FARPTR evecp);
  1314. /* 2534h - Get interrupt flag */
  1315. void __STKCALL _dx_if_get(BOOL *iflg);
  1316. /* 2535h, EBX=0 - Read system registers */
  1317. void __STKCALL _dx_sysregs_get(SYS_REGS *regp);
  1318. /* 2535h, EBX=1 - Write system registers */
  1319. void __STKCALL _dx_sysregs_set(SYS_REGS *regp);
  1320. /* 2536h, EBX & 1 = 1 - Minimize/maximize conventional memory usage */
  1321. int __STKCALL _dx_cmem_usage(ULONG npages, BOOL maximizef, ULONG *minp, 
  1322.                             ULONG *maxp);
  1323. /* 2536h, EBX & 1 = 0 - Minimize/maximize extended memory usage */
  1324. int __STKCALL _dx_ext_usage(ULONG npages, BOOL maximizef, ULONG *minp, 
  1325.                             ULONG *maxp);
  1326. /* 2537h - Allocate conv memory above DOS data buffer */
  1327. int __STKCALL _dx_real_above(UINT para_count, USHORT *para_addrp,
  1328.               USHORT *largestp);
  1329. /* 2538h - Get registers from interrupt state */
  1330. int __STKCALL _dx_swi_rdregs(SWI_REGS *regp, BOOL nextf, ULONG *ihndp,
  1331.                         ULONG *intnump);
  1332. /* 2539h - Get .EXP header offset in bound file */
  1333. int __STKCALL _dx_hdroff_get(ULONG hndl, ULONG *hdroffp, UINT *fep, 
  1334.                             UINT *dosep);
  1335. /* 253Ah - Install resize segment failure handler */
  1336. void __STKCALL _dx_msegfail_hnd(FARPTR new_hndp, FARPTR *old_hndpp);
  1337. /* 253Bh - Jump to real mode */
  1338. void __STKCALL _dx_jmp_toreal(SWI_REGS *regp);
  1339. /* 253Ch - Shrink 386|VMM swap file */
  1340. int __STKCALL _dx_shrink_swap(ULONG *old_nbytep, ULONG *new_nbytep);
  1341. /* 253Dh, ECX=0 - Read IDT descriptor */
  1342. int __STKCALL _dx_idt_rd(UINT int_no, UCHAR *descp);
  1343. /* 253Dh, ECX=1 - Write IDT descriptor */
  1344. int __STKCALL _dx_idt_wr(UINT int_no, UCHAR *descp);
  1345. /* 25C0h - Allocate MS-DOS memory block */
  1346. int __STKCALL _dx_real_alloc(UINT para_count, USHORT *para_addrp, 
  1347.               USHORT *largestp);
  1348. /* 25C1h - Release MS-DOS memory block */
  1349. int __STKCALL _dx_real_free(USHORT para_addr);
  1350. /* 25C2h - Resize MS-DOS memory block */
  1351. int __STKCALL _dx_real_resize(USHORT para_addr, UINT para_count,
  1352.             USHORT *largestp);
  1353. /* 25C3h - Execute program */
  1354. int __STKCALL _dx_exec_spec(UCHAR *pathp, EXEC_BLK *parmp);
  1355.  
  1356. /*
  1357.  * End of function prototypes -- restore calling conventions to whatever
  1358.  * they were originally
  1359.  */
  1360. #ifdef __cplusplus
  1361. }
  1362. #endif
  1363.  
  1364. #pragma pack()
  1365.  
  1366. #endif
  1367.