/*static char *SCCSID = "@(#)pldxport.h   6.7 92/02/24";*/
/***    pldxport.h - Process Level Dump Local API Definitions
 *
 *      SCCSID = @(#)PLDXPORT.h  6.7 92/08/31
 *
 *      THIS IS AN OS/2 VERSION 2.x SPECIFIC FILE
 *
 *       Copyright (c) IBM Corporation 1992
 *
 *       All Rights Reserved
 *
 *      This file defines the External interfaces for the Process Level Dump.
 *
 *****************************************************************************
 *  Change                                                               Chg *
 *  Activity      Date    BY   Reason                                    Num *
 *  --------      ----    ---  -------                                   --- *
 *  62861       02/28/93  ARJ  Added for Dump Formatter                  001 *
 *  78727       03/08/94  ARJ  Identify SMP kernel                       002 *
 *  92585       08/26/94  ARJ  Added constants and mainheader fields     003 *
 *****************************************************************************
 */

#ifndef PLDXPORT
#define PLDXPORT

/***EK+ PDB_ - DosProcDump Constants
 *
 */

#define PLD_Cmh_EyeCatcher      "PRCD"       /* EyeCatcher              */
#define PLD_Cph_EyeCatcher      "PTDA"       /* EyeCatcher              */
#define PLD_Ctcb_EyeCatcher     " TCB"       /* EyeCatcher              */
#define PLD_Cvmar_EyeCatcher    "VMAR"       /* EyeCatcher              */
#define PLD_Cvmob_EyeCatcher    "VMOB"       /* EyeCatcher              */
#define PLD_Cmte_EyeCatcher     " MTE"       /* EyeCatcher              */
#define PLD_Cldt_EyeCatcher     " LDT"       /* EyeCatcher              */
#define PLD_Mem_Table           "MEMORYTABLE "  /* EyeCatcher      A003 */
#define PLD_Mem_Table_End       "MEM_TAB_END "  /* EyeCatcher      A003 */

#define PLD_C_VerZero        0x00000000      /* dump version zero       */
#define PLD_C_TYPE           0x0000000C      /* DUMP TYPE               */
#define PLD_MAX              0x00000200      /* Constant for array size */

/* Process Level Kernel Types * Retail is the default 00000000     A002 */
#define PLD_Debug_Krnl       0x00010000       /* Debug Kernel     61720 */
#define PLD_SMP_Krnl         0x20000000       /* SMP   Kernel      A002 */

/*end*/

/***EK+ PLD_cri  Process Level Dump Stack Frame IDs
 *
 */

#define PLD_criISF       0x0001  /* Interrupt stack frame descriptor */
#define PLD_criTSF       0x0002  /* Trap stack frame descriptor      */
#define PLD_criVSF       0x0003  /* VDM Stack Frame                  */
#define PLD_criSEF       0x0004  /* System Entry Stack Frame (C32)   */
#define PLD_criPASCALSEF 0x0005  /* System Entry Stack Frame (PASCAL32)*/
#define PLD_criSSF       0x0006  /* SCI Stack Frame (PASCAL16)       */
#define PLD_criDHF       0x0007  /* DevHlp Stack Frame               */
#define PLD_criUNK       0x0111  /* Unknown Stack Frame Not defined  */

/*end*/

/***LT+ DUMPTABLEENTRY - Process level dump table entries
 *
 *       This structure is a single entry for the process level dump table.
 *
 */

typedef struct _dumptableentry {
   UCHAR   *LinearAddress;       /* Linear address of a block of data */
   ULONG    Size;                /* Size of the data */
   ULONG    FileOffset;          /* Data's position in the file */
} DUMPTABLEENTRY;

/*end*/

/***EK+ PLD_mh - Process Level Dump Main Header Definitions
 *
 */
typedef struct _mainhdr {
        unsigned char  PLD_mh_EyeCatcher[4]; /* set to "PRCD"             */
        unsigned long  ProcessTable;       /* offset to Process table     */
        unsigned long  PLD_Memory_Table;   /* offset to Memory  table     */
        unsigned long  pld_mh_ID;          /* identifier for process dump */
        unsigned long  pld_mh_TrapType;    /* trap type                   */
        unsigned long  pld_mh_PDVersion;   /* process dump version        */
        DATETIME       pld_mh_DateTime;    /*                             */
        UCHAR          AlignFiller;        /* double word align           */
        unsigned long  pld_mh_VerSize;     /* length of version string    */
        unsigned char  *VerString;         /* version string in system    */
        unsigned long  pld_mh_VerOff;      /*Offset version string in dump*/
        unsigned long  pld_mh_REQ;         /*AREAs to be DUMPED      A003 */
        unsigned long  pld_mh_MHRC;        /*MAIN HEADER RETURN CODE A003 */
        unsigned long  pld_mh_r[10];       /* reserved for future use     */
} PLD_MH;

/*end*/

/***EK+ PLD_ph - Process Level Dump Process Header Definitions
 *
 */
typedef struct _processhdr {
        unsigned char  PLD_ph_EyeCatcher[4]; /* set to "PTDA"             */
        unsigned long  ThreadTable;        /* offset to Thread Table TCB  */
        unsigned long  pld_ph_Ret_Code;    /* Return Code for PTDA search */
        unsigned long  pld_PID;            /* PID to dump                 */
        unsigned long  pld_len_PTDA;       /* Length of the PTDA          */
        PPTDA          ppld_PTDA;          /* pointer to PTDA for this PID*/
        unsigned long  pld_ph_r[10];       /* reserved for future use     */
} PLD_PH;

/*end*/

/***EK+ PLD_tcb - Process Level Dump TCB Header Definitions
 *
 */
typedef struct _tcbhdr {
        unsigned char  PLD_tcb_EyeCatcher[4]; /* set to " TCB"             */
        unsigned long  VmarTable;             /* offset to Vmar   Table    */
        unsigned long  ThreadSummary;         /* offset to Thread Summary  */
        unsigned long  PLD_tcb_size;          /* Length of TCB_s    struct */
        unsigned long  PLD_tcb_total;         /* Num. of TCBs in this dump */
        unsigned short PLD_tcb_StrReq;        /* Num. of storage request   */
        unsigned short PLD_tcb_StrFail;       /* Num. of str req that fail */
        unsigned short PLD_tcb_StkRC;         /* Stack request RC 0 or 1   */
        unsigned short PLD_tcb_r0;            /* reserved for future use   */
        unsigned long  pld_tcb_r[10];         /* reserved for future use   */
} PLD_TCBHDR;

/*end*/

/***EK+ PLD_tcbs - Process Level Dump TCB Summary Information
 *
 */
typedef struct _tcbentry {
        unsigned long  t_tid;                 /* Thread ID                 */
        tcb_t          *tcbaddr;              /* TCB  Address              */
        unsigned short tcb_cur;               /* Current TCB               */
        unsigned short critype;               /* CRI  Type                 */
        void           *criaddr;              /* CRI  Address              */
        unsigned long  crisize;               /* CRI  Size                 */
        void           *regaddr;              /* Reg  Address              */
        unsigned long  regsize;               /* Reg  Size                 */
        unsigned short stkaddr_sel16;         /* 16 bit Selector stack addr*/
        unsigned short stkaddr_off16;         /* 16 bit OffSet stack addr  */
        void           *stkaddr;              /* Stack Address             */
        unsigned long  stksize;               /* Stack Size                */
} PLD_TCBENTRY;

/*end*/

/***EK+ PLD_vmar - Process Level Dump VMAR Header Definitions
 *
 */
typedef struct _vmarhdr {
        unsigned char  PLD_vmar_EyeCatcher[4]; /* set to "VMAR"            */
        unsigned long  VmobTable;             /* offset to Vmob   Table    */
        unsigned long  PLD_vmar_size;          /* Length of Arena Record   */
        void           *PLD_pvmar;            /* pointer to FIRST VMAR A001*/
        unsigned long  PLD_vmar_total;        /* Num of VMARs in DUMP      */
        unsigned short PLD_vmar_StrReq;       /* Num. of storage request   */
        unsigned short PLD_vmar_StrFail;      /* Num. of str req that fail */
        unsigned long  pld_vmar_r[10];        /* reserved for future use   */
} PLD_VMARHDR;

/*end*/

/***EK+ PLD_vmob - Process Level Dump VMOB Header Definitions
 *
 */
typedef struct _vmobhdr {
        unsigned char  PLD_vmob_EyeCatcher[4]; /* set to "VMOB"            */
        unsigned long  MteTable;              /* offset to Mte    Table    */
        unsigned long  PLD_vmob_size;         /* Length of Object Record   */
        void           *PLD_pvmob;            /* pointer to FIRST VMOB A001*/
        unsigned long  PLD_vmob_total;        /* Num of VMOBs in dump      */
        unsigned short PLD_vmob_StrReq;       /* Num. of storage request   */
        unsigned short PLD_vmob_StrFail;      /* Num. of str req that fail */
        unsigned long  pld_vmob_r[10];        /* reserved for future use   */
} PLD_VMOBHDR;

/*end*/

/***EK+ PLD_mte - Process Level Dump MTE Header Definitions
 *
 */
typedef struct _mtehdr {
        unsigned char  PLD_mte_EyeCatcher[4];  /* set to " MTE"            */
        unsigned long  LdtTable;              /* offset to Ldt    Table    */
        unsigned long  PLD_mte_size;          /* Length of MTE             */
        void           *PLD_pmte;             /* pointer to FIRST MTE  A001*/
        unsigned long  PLD_smte_size;         /* Length of SMTE            */
        void           *PLD_psmte;            /* pointer to FIRST SMTE A001*/
        unsigned long  PLD_mte_total;         /* Num of MTEs in Dump       */
        unsigned short PLD_mte_StrReq;        /* Num. of storage request   */
        unsigned short PLD_mte_StrFail;       /* Num. of str req that fail */
        unsigned long  pld_mte_r[10];         /* reserved for future use   */
} PLD_MTEHDR;

/*end*/

/***EK+ PLD_ldt - Process Level Dump LDT Header Definitions
 *
 */
typedef struct _ldthdr {
        unsigned char  PLD_ldt_EyeCatcher[4];  /* set to " LDT"            */
        unsigned long  NOT_USED_TABLE;         /* reserved for next table  */
        unsigned long  PLD_ldt_size;           /* size of all LDTENTRYs    */
        void           *PLD_pldt;              /* pointer to FIRST LDT A001*/
        unsigned long  PLD_ldt_total;          /* Num of LDTs in dump      */
        unsigned short PLD_ldt_RC;            /* Array to Small   0 or 1   */
        unsigned long  pld_ldt_r[10];         /* reserved for future use   */
} PLD_LDTHDR;

/*end*/

/***EK+ PLD_RET_CODE - Process Level Dump Return Codes                     
 *                                                                        
 */
typedef struct _pldrc  {
        unsigned long  DMP_OPEN_HDR_RC; /*                                 */
        unsigned long  DMP_WRT_CNT_RC;  /*                                 */
        unsigned long  DMP_WRT_HDR_RC;  /*                                 */
        unsigned long  DMP_WRT_MEM_TBL_RC; /*                              */
        unsigned long  DMP_RC_r1[5];    /* reserved for future use         */
        unsigned long  DMP_AREA;        /*                                 */
        unsigned long  DMP_VMAR_RC;     /*                                 */
        unsigned long  DMP_VMOB_RC;     /*                                 */
        unsigned long  DMP_MTE_RC;      /*                                 */
        unsigned long  DMP_THREAD_RC;   /*                                 */
        unsigned long  DMP_LDT_RC;      /*                                 */
        unsigned long  DMP_RC_r3[10];   /* reserved for future use         */
        unsigned long  DMP_PTDA_DATA_RC;  /*                               */
        unsigned long  DMP_VMAR_DATA_RC;  /*                               */
        unsigned long  DMP_VMOB_DATA_RC;  /*                               */
        unsigned long  DMP_MTE_DATA_RC;   /*                               */
        unsigned long  DMP_SMTE_DATA_RC;  /*                               */
        unsigned long  DMP_SMTEO_DATA_RC; /*                               */
        unsigned long  DMP_SMTEP_DATA_RC; /*                               */
        unsigned long  DMP_TCB_DATA_RC;   /*                               */
        unsigned long  DMP_CRI_DATA_RC;   /*                               */
        unsigned long  DMP_REG_DATA_RC;   /*                               */
        unsigned long  DMP_STK_DATA_RC;   /*                               */
        unsigned long  DMP_TIB_DATA_RC;   /*                               */
        unsigned long  DMP_XCP_DATA_RC;   /*                               */
        unsigned long  DMP_TIB2_DATA_RC;  /*                               */
} PLD_RET_CODE;

/*end*/

#endif
