home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c220 / 7.ddi / INCLUDES / PLEXP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-11  |  7.6 KB  |  265 lines

  1. /* Phar Lap .EXP file definitions */
  2. /* $Id: plexp.h 1.10 90/12/11 10:51:01 rwm Exp $ */
  3. /************************************************************************/
  4. /*    Copyright (C) 1986-1988 Phar Lap Software, Inc.            */
  5. /*    Unpublished - rights reserved under the Copyright Laws of the    */
  6. /*    United States.  Use, duplication, or disclosure by the         */
  7. /*    Government is subject to restrictions as set forth in         */
  8. /*    subparagraph (c)(1)(ii) of the Rights in Technical Data and     */
  9. /*    Computer Software clause at 252.227-7013.            */
  10. /*    Phar Lap Software, Inc., 60 Aberdeen Ave., Cambridge, MA 02138    */
  11. /************************************************************************/
  12.  
  13. /* Old .EXP file header */
  14.  
  15. typedef struct
  16. {
  17.     USHORT exe_sign;        /* [00] Signature word (MP) */
  18.     USHORT exe_szrem;        /* [02] Remainder of the image size
  19.                             when divided by the page
  20.                             size (512 bytes) */
  21.     USHORT exe_size;        /* [04] Size of image in pages */
  22.     USHORT exe_relcnt;        /* [06] Number of relocation entries*/
  23.     USHORT exe_hsize;        /* [08] Header size in paragraphs */
  24.     USHORT exe_minpg;        /* [0A] Minimum number of extra 
  25.                             4K pages to be allocated
  26.                             at the end of a program when
  27.                             it is loaded */
  28.     USHORT exe_maxpg;        /* [0C] Maximum number of extra
  29.                             4K pages to be allocated
  30.                             at the end of a program when
  31.                             it is loaded */
  32.     ULONG    exe_esp;        /* [0E] Initial ESP */
  33.     USHORT exe_chksum;        /* [12] Word checksum of file */
  34.     ULONG    exe_eip;        /* [14] Initial EIP */
  35.     USHORT exe_reloff;        /* [18] Offset of first relocation
  36.                             item */
  37.     USHORT exe_ovlno;        /* [1A] Overlay number */
  38.     USHORT exe_unkw;        /* [1C] Unknown word, wants to be 1 */
  39. } OEXP_HDR;
  40.  
  41.  
  42. /* .EXP file header */
  43.  
  44. typedef struct
  45. {
  46.  
  47.     /* Signature and level */
  48.  
  49.     USHORT exp_sign;        /* Signature word (P2 or P3) */
  50.     USHORT exp_level;        /* Level */
  51.     USHORT exp_hsize;        /* Header size */
  52.     ULONG exp_flsize;        /* File size in bytes */
  53.     USHORT exp_chksum;        /* Checksum */
  54.  
  55.     /* Table of contents */
  56.  
  57.     ULONG exp_rtp;            /* File offset of the run-time
  58.                        parameters */
  59.     ULONG exp_rtpsize;        /* Size in bytes of the run-time
  60.                        parameters */    
  61.     ULONG exp_rel;            /* File offset of the relocation
  62.                        table */
  63.     ULONG exp_relsize;        /* Size in bytes of the relocation
  64.                        table */
  65.     ULONG exp_sit;            /* File offset of the segment
  66.                        information table */
  67.     ULONG exp_sitsize;        /* Size in bytes of the segment
  68.                        information table */
  69.     USHORT exp_sitesize;        /* Size in bytes of a segment
  70.                        information table entry */
  71.     ULONG exp_ldimg;        /* File offset of the load image */
  72.     ULONG exp_ldisize;        /* Load image size on disk */
  73.     ULONG exp_sym;            /* File offset of the symbol table */
  74.     ULONG exp_symsize;        /* Size in bytes of the symbol table*/
  75.     ULONG exp_gdt;            /* GDT offset in load image */
  76.     ULONG exp_gdtsize;        /* Size in bytes of the GDT */
  77.     ULONG exp_ldt;            /* LDT offset in load image */
  78.     ULONG exp_ldtsize;        /* Size in bytes of the LDT */
  79.     ULONG exp_idt;            /* IDT offset in load image */
  80.     ULONG exp_idtsize;        /* Size in bytes of the IDT */
  81.     ULONG exp_tss;            /* TSS offset in load image */
  82.     ULONG exp_tsssize;        /* Size in bytes of the TSS */
  83.  
  84.     /* Program load params, level 1 files only */
  85.  
  86.     ULONG exp_minext;        /* Minimum number of extra 
  87.                        bytes to be allocated
  88.                        at the end of a program when
  89.                        it is loaded */
  90.     ULONG exp_maxext;        /* Maximum number of extra
  91.                        bytes to be allocated
  92.                        at the end of a program when
  93.                        it is loaded */
  94.     ULONG exp_boff;            /* Base load offset */
  95.  
  96.     /* Initial register contents */
  97.  
  98.     ULONG exp_iesp;            /* Initial ESP */
  99.     USHORT exp_iss;            /* Initial SS */
  100.     ULONG exp_ieip;            /* Initial EIP */
  101.     USHORT exp_ics;            /* Initial CS */
  102.     USHORT exp_ildt;        /* Initial LDT */
  103.     USHORT exp_itss;        /* Initial TSS */
  104.  
  105.     /* New stuff */
  106.  
  107.     USHORT exp_flags;        /* Flags */
  108.     ULONG exp_mreq;            /* Memory requirements for the load
  109.                        image (packed or unpacked) */
  110.     ULONG exp_xsum32;        /* 32-bit checksum */
  111.     ULONG exp_stksize;        /* size in bytes of stack segment */
  112.  
  113.     /* An .EXP header is 384 bytes long.  The remaining bytes of the
  114.        header are always zero, to allow for future expansion. */
  115.  
  116. } EXP_HDR;
  117.  
  118. /*
  119.  
  120. Flags in exp_flags word.
  121.  
  122. */
  123.  
  124. #define EXP_PACKED 0x0001        /* Load image is packed */
  125. #define EXP_XSUM   0x0002        /* 32-bit checksum is present */
  126. #define EXP_RELOCM 0x001C        /* Type of relocataion table mask */
  127.  
  128.  
  129. /*
  130.  
  131. Segment information table entry
  132.  
  133. */
  134.  
  135. typedef struct
  136. {
  137.     USHORT sit_selector;        /* Selector number */
  138.     USHORT sit_flags;        /* Flags */
  139.     ULONG sit_boff;            /* Base offset of selector */
  140.     ULONG sit_minext;        /* Minimum number of extra bytes
  141.                        to be allocated to the segment */
  142. } SIT_ENT;
  143.  
  144.  
  145. /*
  146.  
  147. 386|DOS-Extender run-time parameters
  148.  
  149. */
  150.  
  151. typedef struct
  152. {
  153.     USHORT rtp_sign;        /* Signature = 'DX' */
  154.     USHORT rtp_minrf;        /* Minimum number of real mode paras
  155.                        to leave free at run-time */
  156.     USHORT rtp_maxrf;        /* Maximum number of real mode paras
  157.                        to leave free at run-time */
  158.     USHORT rtp_minib;        /* Minimum interrupt buffer size in
  159.                        K bytes */
  160.     USHORT rtp_maxib;        /* Maximum interrupt buffer size in
  161.                        K bytes */
  162.     USHORT rtp_nist;        /* Number of interrupt stacks */
  163.     USHORT rtp_istks;        /* Size in K bytes of each interrupt
  164.                        stack */
  165.     ULONG rtp_rbr;            /* Offset where the real mode code/
  166.                        data ends + 1 */
  167.     USHORT rtp_cbsize;        /* Size in K bytes of the call 
  168.                        buffers */
  169.     USHORT rtp_flags;        /* Flags - bit def'ns below */
  170.     USHORT rtp_unpriv;        /* unprivileged flag: F ==> ring 0
  171.                        T ==> ring 1, 2, or 3 */
  172.  
  173.     /* The run-time parameters are 128 bytes long.  The remaining
  174.        bytes of the header are always zero to allow for future
  175.        expansion. */
  176.  
  177. } DOSX_RTP;
  178.  
  179. /*
  180.  * DOS-X flags word bit definitions
  181.  */
  182. #define RTP_VMM    0x0001        /* File is virtual memory manager */
  183. #define RTP_DEBUG 0x0002    /* File is a debugger */
  184.  
  185. /*
  186.  
  187. Values for DOS-X run-time params
  188.  
  189. */
  190.  
  191. #define REAL_MAX    64    /* max. legal value for minrf and maxrf */
  192. #define MINR_DEF    0    /* default for minrf */
  193. #define MAXR_DEF    0    /* default for maxrf */
  194.  
  195. #define IBUF_MIN    1    /* min. legal value for minib and maxib */
  196. #define IBUF_MAX    64    /* max. legal value for minib and maxib */
  197. #define MINIB_DEF    1    /* default for minib */
  198. #define MAXIB_DEF    16    /* default for maxib */
  199.  
  200. #define NIST_MIN    6    /* min. legal value for nist */
  201. #define ISTKS_MIN    1    /* min. legal value for istks */
  202. #define ISTKS_MAX    64    /* max. legal value for nist * istks */
  203. #define NIST_DEF    6    /* default for nist */
  204. #define ISTKS_DEF    1    /* default for istks */
  205.  
  206. #define RBRK_DEF    0    /* default for rbr */
  207.  
  208. #define CBSIZE_MAX    64    /* max. legal value for cbsize */
  209. #define CBSIZE_DEF    0    /* default for cbsize */
  210.  
  211. #define PRIV_DEF    FALSE    /* default for unprivileged flag */
  212.  
  213.  
  214. /*
  215.  
  216. File signatures 
  217.  
  218. */
  219.  
  220. #define EXP_286 0x3250        /* 286 .EXP signature (P2) */
  221.  
  222. #define EXP_386 0x3350        /* 386 .EXP signature (P3) */
  223.  
  224. #define EXP_OLD 0x504D        /* Old .EXP signature (MP) */
  225.  
  226. #define REX_OLD 0x514D        /* Old .REX signature (MQ) */
  227.  
  228. #define RTP_SIGN 0x5844        /* 386|DOS-Extender run-time parameters */
  229.  
  230.  
  231. /*
  232.  
  233. File header and run-time parameter sizes 
  234.  
  235. */
  236.  
  237. #define EXP_SIZE 384        /* Size of an .EXP header */
  238.  
  239. #define RTP_SIZE 128        /* Size of the run-time parameters */
  240.  
  241. #define SIT_ESIZE 12        /* Size of an SIT entry */
  242.  
  243.  
  244. /*
  245.  
  246. Level numbers
  247.  
  248. */
  249.  
  250. #define LVL_FLAT  1        /* Flat model file */
  251. #define LVL_MULTI 2        /* Multisegmented file */
  252.  
  253.  
  254. /*
  255.  
  256. Repeat block header (for packed files)
  257.  
  258. */
  259.  
  260. typedef struct
  261. {
  262.     USHORT rpt_bcnt;        /* Byte count */
  263.     UCHAR rpt_rptl;            /* Repeat string length */
  264. } EXP_RPT;
  265.