/*static char *SCCSID = "@(#)tkptda.h   6.4 92/02/21";*/
/*      static char *SCCSID = "@(#)tkptda.h     6.4 92/02/21" */

// INT32

//      Includes for tkptda.asm

/* GASM
.xlist
include osconst.inc
include dosseg.inc
include basemaca.inc
include osmaca.inc
include dossymc.inc
include devsym.inc
include except.inc
include sft.inc
include sigdef.inc
include vpb.inc
include protmode.inc
include seldesc.inc
include proc.inc
include pgexport.inc
include vmexport.inc
.list
include tkexport.inc
.xlist
include infoseg.inc
include sem.inc
include screen.inc
include curdir.inc
include dirent.inc
include harderr.inc
include find.inc
.list
*/


/***ET+ PTDA - Per Task Data Area (PTDA) Definitions
 *
 *      This file contains the PTDA structure defined in C.  From it
 *      an assembly language version is produced (file tkptda.asm in
 *      the task directory).  Access to a PTDA is allowed at task-time
 *      only, and three different methods of access are provided.
 *
 *      1.  Existing 80386 assembly code may access the current PTDA relative
 *          to the SS selector.  This selector is a GDT selector that maps
 *          to linear address space that is specially aliased to map to the
 *          current PTDA.  Also, the PTDA variable CurrTCB contains the offset
 *          to the current TCB relative to SS.  The linear address space
 *          at SS: <Contents of CurrTCB> is aliased to the current TCB. This
 *          method of access is provided for compatibility purposes only.
 *          A significant amount of assembly code exists which uses this
 *          method of addressing the current TCB and PTDA.
 *
 *          Two alternate methods exist here; they cannot both be used
 *          simultaneously :
 *
 *              a) ReferTask method :
 *                  Use the ReferTask macro, and access the PTDA fields
 *                  directly.  This method excludes the inclusion of
 *                  tkptda.h, so flat pointers may not be used if
 *                  ReferTask is also used in the same file.  Example:
 *
 *                      ReferTask       ptda_child
 *                      ASSUME  SS:TASKAREA
 *                      mov     ax,ss:[ptda_child]
 *
 *              b) tkptda.inc method :
 *                  Eliminate all ReferTask invocations from the ASM
 *                  file, and include tkptda.inc.  Then, when accessing
 *                  a variable in the TASKAREA group, add TKOPTDA
 *                  to the referenced PTDA address.  TKOPTDA gives the
 *                  starting offset of the ptda structure (ptda_s)
 *                  within TASKAREA.  2 Examples :
 *
 *                  *   include tkptda.inc
 *                      ASSUME  DS:NOTHING, SS:NOTHING
 *                      movzx   eax,ss:[TKOPTDA.ptda_child]
 *
 *                  *   ASSUME  DS:FLAT, SS:NOTHING
 *                      mov     eax,[_pPTDA]
 *                      movzx   eax,[eax].ptda_child
 *
 *                  This technique is designed to facilitate the removal
 *                  of ReferTask from existing MASM files, when it is
 *                  required that tkptda.h be included in the file.
 *
 *      2.  Existing 80386 assembly code may access any PTDA's variables
 *          via their offsets relative to the PTDA's GDT selector.  Access
 *          to TCB's may NOT be made relative to this selector; Method 3
 *          must be used for this purpose.
 *
 *      3.  New 80386 assembly code should, and all C code must access PTDA's
 *          and TCB's via their offset in linear address space relative
 *          to the base linear address of the DGROUP selector (i.e. 0).
 *
 *      NOTE:   In addition to defining the PTDA structure, a PTDA is
 *              included into the link image of the kernel.  This statically
 *              declared PTDA is used by the System Initialization Task.
 *              No flat fixups are allowed to the PTDA.
 *
 *      WARNING!!!!!  The structure of the PTDA, names of its variables
 *                    etc. is currently under development and highly
 *                    volatile.
 *
 *      Modification History:
 *
 *      54400   10/08/92 BJH    Added an INIT value to ptda_NewFiles to
 *                              initialize it to TCBNEWFILES or TCBKNOWEAS
 *                              in tkptda.asm where the first PTDA lives.
 *                              This (along with the change in
 *                              src\dos\memory\pga.asm) will allow the
 *                              kernel to use long file names during init.
 *
 *      101504 03/15/95 Chg.Team Added new member, pPvwDataBlk. Used by
 *                               perfview.
 *      134780 09/29/95 BZ      Added ptda_vme to flag a VME enabled VDM.
 *      72417  12/20/95 MLM     Moved thread oriented variables to TCB
 *                              so we can reduce fscrit serialization
 */

#define TKCSEGTIB       4               // Fudge!  See tklocal.h */
#define TKPTDAEXTSIG    'B'             // external signature value */

struct ptda_s {                         // SEGMENT TASKDATA

/* GASM
        PUBLIC  ptda_start
ptda_start      label   BYTE
*/

//      Flat model Inter-PTDA links

        struct   ptda_s *pPTDAParent;   // PUBLIC
                                        // Parent PTDA
        struct   ptda_s *pPTDASelf;     // PUBLIC
                                        // This PTDA
        struct   ptda_s *pPTDAFirstChild;// PUBLIC
                                        // Head of child chain PTDA
        struct   ptda_s *pPTDAExecChild;// PUBLIC
                                        // New Child PTDA (Child being exec'ed)
/*
 *      pPTDANextZombie and pPTDAPrevZombie double-link the Zombie Queue.
 *      pPTDANextSibling and pPTDAPrevSibling are overloaded to do this.
 */

/* GASM
        PUBLIC  pPTDANextZombie
        pPTDANextZombie label   DWORD
*/
        struct   ptda_s *pPTDANextSibling;// PUBLIC
                                          // Next sibling's PTDA
/* GASM
        PUBLIC  pPTDAPrevZombie
        pPTDAPrevZombie label   DWORD
*/
        struct   ptda_s *pPTDAPrevSibling;// PUBLIC
                                          // Previous sibling's PTDA

/* GASM
        ReferFlat       SysInitProc,BYTE ; Name of sysinit process
*/
        char     *ptda_pszproc;         // PUBLIC INIT <offset FLAT:SysInitProc>
                                        // Pointer to the EXE file this process
                                        // is executing. Used by PerfView
//      TCB links

        struct   tcb_s *ptda_pTCBHole;  // PUBLIC
                                        // some TCB before first Tid 'hole'
/* GASM
        PUBLIC  ptda_pTCB1
        ptda_pTCB1 label DWORD          ;; First TCB has TCBOrdinal = 1
*/
        struct   tcb_s *ptda_pTCBHead;  // PUBLIC
                                        // Head of list of active TCBs
                                        // owned by this process
        ushort_t ptda_cTCB;             // PUBLIC INIT <1>
                                        // Number of TCBs in use

/*      Thread Information Block (TIB) data */

        ushort_t ptda_ctib;             // PUBLIC
                                        // Count of TIBs allocated
        ulong_t  ptda_avatib[TKCSEGTIB];// PUBLIC INIT <-1>
                                        // Pointers to TIB arrays

//      Debug Data

/* GASM
        PUBLIC  ptda_flDbgEnabled
ptda_flDbgEnabled label DWORD           ; ptda_flDbgEnabled identical to ptda_pdcb
*/
        struct   DCB_s *ptda_pdcb;
        ulong_t  ptda_flDbg;            // PUBLIC

        VMAH     ptda_ah;               // Private arena header

        struct   pgdatafake_s ptda_pgdata;// PUBLIC
        ushort_t ptda_environ;          // PUBLIC
                                        // handle to process's envt seg

        char     *ptda_pBeginLIBPATH;   //PUBLIC
        char     *ptda_pEndLIBPATH;     // D75220- support dynamic libpath

        struct   pgpcfake_s ptda_pgpc;  // PUBLIC

/*
 *        struct   memstat_s  *ptda_pmemstatcur;// PUBLIC
 *        struct   memstat_s  ptda_memstat;// PUBLIC
 */

/*      Per-process Perfview information -- ptr to Perfview Data Block for
 *      this process (pvdb_prc_s).
 */
        void    *ptda_pPVDBPrc;         // PUBLIC

        struct   vmSGS_s *ptda_pSGSList;// PUBLIC

//      Exit List Data
        struct  ExEntry_s *ptda_pexllist;// PUBLIC
                                        // Flat pointer to exit list data

//      DLL termination data

        ulong_t ptda_cdllterm;
                                        // Count of active terminations

// 72417 moved WFP_Start, Ren_WFP, WFP_Path_End, Curr_Dir_End to TCB

//      CDS_Handle - array of current directory handles

        ushort_t CDS_Handle[26];        // PUBLIC
                                        // *REDIR*

//      Offset to OEM-Added fields

        ushort_t OEMPtr;                // PUBLIC

// 72417 moved VerFlg, LCurDrv, and PCurDrv up

        char     VerFlg;                // PUBLIC
                                        // Initialize with verify off
        char     LCurDrv;               // PUBLIC
                                        // Logical current drive - Default A:
        char     PCurDrv;               // PUBLIC
                                        // physical drive after assign mapping

//      END of section to keep towards top of PTDA

//      Per task data for scheduler
//      WARNING - CritSec MUST NOT be inherited.
//                Fgnd (probably) should be inherited.
//                FgndOnly (probably) should be inherited.


        char     Fgnd;                  // PUBLIC
                                        // foreground flag
        char     FgndOnly;              // PUBLIC
                                        // foreground only flag
        char     ptda_pad1;             // alignment

        struct tcb_s *ptda_pTCBCritSec; // PUBLIC
                                        // TCB that did enter CritSec
        struct tcb_s *ptda_pTCBPriQCritSec;// PUBLIC
                                        // TCBs awaiting CritSec wakeup
        ushort_t ptda_cCritSec;         // PUBLIC
                                        // Critical Section Count
//      Variables related to MVDM

        ushort_t CurrentPDB;            // PUBLIC
                                        // Currently active PDB (V86 segment)

// 72417 moved DTAddr, VolID, NoSetDir, SpaceFlag, Creating, DelAll,
//             FoundDel, Found_dev, fSplice, ClusFac, cMeta, PathNameType,
//             DevPt, DirSec, DirStart, NxtClusNum, EntFree, EntLast, LastEnt
//             to TCB

        ushort_t seltss;                // PUBLIC

        ushort_t ProcFlag;              // PUBLIC
                                        // if == 1 then this is a special
                                        // process (swapper or screen switch);
                                        // NO removable media buffer will be
                                        // allocated to this process.

        ulong_t  ptda_ForcedActions;    // PUBLIC
                                        // pending action bits

        ulong_t  ptda_ulExitCode;       // PUBLIC
                                        // Exit code of last task
        ulong_t  ptda_ulExitType;       // PUBLIC
                                        // Type of exit
        ulong_t  ptda_ulExitTID;        // PUBLIC
                                        // Exit Thread ID (32-bit exceptions)

        ulong_t  ThisCDS;               // PUBLIC Address of current
                                        // CDS *REDIR*  3.10

        ushort_t ptda_pCDS;             // PUBLIC INIT <0>
                                        // SS relative pointer to a curdir struct

        ushort_t CDSsize;               // PUBLIC
                                        // Size of CDS pointed to by ThisCDS
                                        // ONLY used for CDS entries in RMP seg

// 72417 moved Sattrib to TCB

        ushort_t sPCB;                  // PUBLIC INIT <0>
                                        // Selector of Profile Control Block

        char     ptda_pad5[2];          // alignment

        ulong_t  ptda_pPCB;             // PUBLIC INIT <0>
                                        // Pointer to Profile Control Block

        ushort_t JFN_Max;               // PUBLIC
                                        // highest JFN used so far

//      Search variables

        ushort_t NextSrchH;             // PUBLIC INIT <1>
                                        // Next value to use for search handle
                                        // First value used will be 2.

        ulong_t  SrchRmp;               // PUBLIC
                                        // Handle & Selector for RMP segment
                                        // we keep search handles in.

        ushort_t FNotifyLocal_First;    // PUBLIC
        ushort_t FNotifyLocal_Count;    // PUBLIC

/*      Signal handling flags
 *      WARNING..  do not alter size or relative location of the following 3
 *      items without first examining SIG/SetSignal.
 */

        ushort_t Sig_ignf;              // PUBLIC
                                        // bit vector of ignored signals
        ushort_t Sig_hndf;              // PUBLIC
                                        // bit vector of handled signals
        ushort_t Sig_errf;              // PUBLIC
                                        // bit vector of error generating
                                        // signals
        ushort_t Sig_attempted;         // PUBLIC
                                        // bit vector of signals we've tried
                                        // to handle with 32-bit exceptions
        ushort_t Sig_arg[NSIG];         // PUBLIC
                                        // byte vector of signal arguments
        ushort_t Sig_termtid;           // 'Terminator' TID for APTERM.
        ushort_t HoldSigCnt;            // PUBLIC
                                        // DOSHOLDSIGNAL counter
        ushort_t SigFocusCnt;           // PUBLIB
                                        // DOS32SETSIGNALEXCEPTIONFOCUS count


/*
 *      File Handle table - default per-process file table
 *
 *      This is the default per-process file handle table.
 *
 *      JFN_Length (see below) is the length of the JFN_Table.
 *
 *      JFN_pTable (see below) initially points to JFN_Table for prot-mode
 *      processes.  For VDM's, it is initialized to point to a 255-entry
 *      JFN_Table.
 *
 *      The flags are accessed by a pointer -- JFN_Flg_Ptr (see below).
 *      This will usually point to default table, JFN_Flags, here in
 *      the pdta.  If the file handle table is made larger than FILPERPROC
 *      then the flags will also be be grown.
 *
 *      NOTE:   JFN_pTable is a PROT-MODE address!
 *
 *      WARNING the labels JFN_Table and JFN_Flags should ONLY be used to
 *              initialize the pointer JFN_pTable and JFN_Ptr_Flgs.
 *
 *      NOTE: JFN_Table and JFN_Flags MUST be CONTIGUOUS
 */

        ushort_t JFN_Table[FILPERPROC]; // PUBLIC INIT <SFN_NULL>
                                        // default handle table
        char     JFN_Flags[FILPERPROC]; // PUBLIC
                                        // default JFN flags table

        ushort_t ptda_rasflag;          // PUBLIC
                                        // RAS trace indicator

/*
 *      System Semaphores PTDA Data
 *
 *      This fixed length table contains the offset into the global
 *      system semaphore table for each opened semaphore by this
 *      process. It is indexed by the system semaphore handle and
 *      is -1 if the handle is invalid, otherwise it is the offset
 *      into the global system semaphore table.
 */

        struct  SysSemPTDAStruc SysSemPTDATbl;  // PUBLIC

/*
 *      Address of a temporary holding information for
 *      a delayed hard error. If it is zero, then there
 *      isn't any delayed hard error. If it is non-zero
 *      then it is the address of a temporary buffer, that
 *      contains the information for a hard error to be
 *      generated after the process has done exitlist
 *      processing and its resources have gone away.
 */


        long     SavedHardErr;          // PUBLIC

//      Thread Info fields

//      PTDA Semaphore to serialize threads

        KSEMMTX  ptda_ptdasem;          // PUBLIC
                                        // PTDA semaphore i.e. inter-thread

//      PTDA Semaphore to serialize threads calling DosLoadModule & DosExecPgm

        KSEMMTX  ptda_DLMsem;           // PUBLIC    b732954 Edd
                                        // PTDA semaphore i.e. inter-thread

        ushort_t ptda_lidt[3];          // current IDT limit/base

        ushort_t Csid;                  // PUBLIC
                                        // Command Subtree ID

        ushort_t Behav_bit;             // PUBLIC
                                        // program behavior bits

        ushort_t MSW;                   // PUBLIC
                                        // CPU matching status word

        long     ptda_rsrclist;         // PUBLIC
                                        // far pointer to local resource list

        struct ldrdld_s *ptda_pldrdldHead;// PUBLIC
                                        // loader demand load data list

/*
 *      32-bit Semaphore variables in PTDA
 */

        void     **pPrSemTbl;           // PUBLIC   (void * => PSEM)
                                        // pointer to private semaphore table
        ulong_t  ulPrTblSize;           // PUBLIC
                                        // size of pPrSemTbl in dwords
        ulong_t  ulPrTotUsed;           // PUBLIC
                                        // number of entries in pPrSemTbl
        ulong_t  ulPrNextFree;          // PUBLIC
                                        // next free slot in pPrSemTbl
        ulong_t  *hksPrTbl;             // PUBLIC
                                        // kernel semaphore handle for
                                        // private semaphore table

        ulong_t  *pShSemBmp;            // PUBLIC
                                        // pointer to private bitmap for the
                                        // shared semaphore table
        ulong_t   ulShBmpSize;          // PUBLIC
                                        // size of pShSemBmp in bits
        ulong_t   *hksShBmp;            // PUBLIC
                                        // kernel semaphore handle for
                                        // private semaphore table

        ulong_t   ulMtxOwned;           // PUBLIC
                                        // number of mutex owned by this
                                        // process in the two sem tables

// 72417 moved to TCB ShareRetriesLeft, RetryCount, RetryLoop, ptda_pSrchBuf

//      ushort_t ptda_pLdrBuf;          // PUBLIC INIT <0>
                                        // SS relative offset of buffer used
                                        // by the loader to do a TransPath
// 72417 moved to TCB ptda_pOpenBuf

//      Thread local memory
        long     ptda_TLMA;             // in use flag and dword copy count
        uchar_t  ptda_TLMABM[TLMA_MAX_BME];             // thread local memory
        uchar_t  ptda_TLMASizeMap[TLMA_MAX_VARS];       // thread local memory

//      Screen related data

        struct  Cons_Locus Cons_Loc;    // PUBLIC

//      WARNING - The two bytes below are manipulated as a word
        char     SysCallSfcn;           // PUBLIC
                                        // Value of AL on system entry
        char     SysCall;               // PUBLIC
                                        // Last system call processed

        char     KBD_Mode;              // PUBLIC
                                        // Keyboard input mode
        uchar_t  ptda_NewFiles;         // PUBLIC INIT <TCBNEWFILES or TCBKNOWEAS>
                                        // If bit one is set, process supports  // 54400
                                        // new files (long names)

//      Variable used in Hard Error processing
        char     AutoFail;              // PUBLIC
                                        // Non-zero if I 24 FAILed magically

// 72417 moved to TCB Name1, Name2, DESTSTART


/*
 *      Code Page flags
 *      Flags to determine type of code page.  Currently the only
 *      defined flags is fCP_DBCS.  If this flag is *clear* the codepage
 *      associated with this process has double byte characters.
 *      (We use negative logic to speed up testdbcs, and to be consistent
 *       with other dbcs data structures.)
 */

        char     CP_Flgs;               // PUBLIC INIT <fCP_DBCS>
                                        // Default is no codepage in system.

        long     Sig_vec[NSIG];         // PUBLIC
                                        // signal handlers
        long     Exc_vec[EXCUSR];       // PUBLIC OSOLETE
                                        // exception vectors
// XLATOFF
        dostimer_t  *ptda_timerhead;    // Timer list head
// XLATON
// ASM  ptda_timerhead  DD       ?

// 72417 moved to TCB Attrib, ExtFCB

/*
 *      *********************** WARNING ************************
 *      All fields from here to the end of the PTDA are accessed
 *      by components of the system outside the kernel.  When
 *      adding new fields to the PTDA, add them just AFTER the
 *      ptda_extsig field, but BEFORE all other non-pad fields.
 *      Increment the TKPTDAEXTSIG signature defined above if
 *      the offset of any non-pad field in this section changes
 *      (ptda_extsig through ptda_signature, inclusive) OR if
 *      a semantic change is made to any non-pad field.
 *
 *      Remember: the PTDA is at the top of an expand-down segment
 *      for 16-bit users.
 */

        char      ptda_extsig;          // PUBLIC INIT <TKPTDAEXTSIG>
        char      ptda_pad6[3];         // alignment
        ulong_t    pPvwDataBlk;         // Used by perfview.- 101504
        ulong_t   ptda_lanman_sec;      // PUBLIC
                                        // Used by LANMAN & HPFS for security.

        ushort_t SigFTerm;              // PUBLIC                        //@SEC

        ushort_t ptda_ppgdata;          // PUBLIC INIT <offset ptda_pgdata>
        ushort_t ptda_child;            // PUBLIC
                                        // New child PTDA handle
                                        // (Child being Exec'ed)
        ushort_t ptda_childalias;       // PUBLIC
        ushort_t ptda_handle;           // PUBLIC
                                        // handle to this segment
        ushort_t ptda_module;           // PUBLIC
                                        // program module handle for process
//      Per-Task LDT data

        ushort_t ptda_ldthandle;        // PUBLIC
        ushort_t ptda_ldtpgmap;         // PUBLIC Bitmap of valid LDT pages
        ulong_t ptda_ldtaddr;           // PUBLIC

/*      CP_CaseMapTbl
 *      Pointer to case map table for the current code page (codepage_tag).
 *      Segment is set to zero if no case map table.  We keep this value
 *      here to save the effort of scanning through the CDIB everytime
 *      we need to case map a character.
 */

        long     CP_CaseMapTbl;         // PUBLIC
        ushort_t codepage_tag;          // PUBLIC
                                        // the current code page
        ushort_t JFN_Length;            // PUBLIC INIT <FILPERPROC>
                                        // Size of JFN table in bytes
        long     JFN_pTable;            // PUBLIC
                                        // PM pointer to JFN table
        long     JFN_Flg_Ptr;           // PUBLIC
                                        // pointer to JFN flags

// 72417 moved to TCB Joins

        char     ptda_pad[1];

//      WARNING - The following extended error fields must be in this
//                order and packed together (no padding).

        char     ExtErr_Locus;          // PUBLIC
                                        // Extended Error Locus *REDIR* 3.10
        ushort_t ExtErr;                // PUBLIC
                                        // Extended Error code *REDIR* 3.10
        char     ExtErr_Action;         // PUBLIC
                                        // Extended Error Action *REDIR* 3.10
        char     ExtErr_Class;          // PUBLIC
                                        // Extended Error Class *REDIR* 3.10
//      END WARNING

//      User Information Area for this task (= old "Local Infoseg")
//      This structure is pointed at by the first private LDT selector.


// XLATOFF
        struct  InfoSegLDT ptda_infoseg;
// XLATON
// !GASM ptda_infoseg   DB      SIZE InfoSegLDT DUP (0)
/* GASM
        PUBLIC  Pid
        PUBLIC  Ppid
        PUBLIC  ProcType
        PUBLIC  ProcStatus
        PUBLIC  ptda_infoseg
ptda_infoseg    label   BYTE
                .errnz  ($ - ptda_infoseg) - LIS_CurProcID
Pid             DW      ?       ; process id
                .errnz  ($ - ptda_infoseg) - LIS_ParProcID
Ppid            DW      ?       ; parent pid
                DW      ?       ; CurThrdPri
                DW      ?       ; CurThrdID
                DW      ?       ; CurScrnGrp
ProcStatus      DB      ?       ; ProcStatus
                DB      ?       ; PAD Byte
                DW      ?       ; Fgnd
                .errnz  ($ - ptda_infoseg) - LIS_ProcType
ProcType        DB      ?       ; Process type
                DB      SIZE InfoSegLDT - ($ - ptda_infoseg) DUP (?)
*/
//134780        ushort_t ptda_pad3;             // alignment
        char      ptda_vme;             // PUBLIC INIT <0>          //134780
                                        // VME Flag                 //134780
        char      ptda_pad3;            // alignment                //134780

        ushort_t CurrTCB;               // PUBLIC
                                        // pointer to current TCB
        ushort_t CurrTSD;               // PUBLIC
                                        // pointer to current TSD
        ushort_t ThisPTDA;              // PUBLIC
                                        // Selector for this ptda
        SEL      ptda_NPX_em_cs;        // PUBLIC                       b726833
                                        // NPX emulator CS              b726833
        long     ptda_NPX_em_eip;       // PUBLIC                       b726833
                                        // NPX emulator EIP             b726833
        ushort_t ptda_pad4;             // alignment                    b726833
        char     ptda_signature[2];     // PUBLIC AINIT <"TD">
                                        // must contain "TD"

// GASM ptda_size equ   ($ - ptda_start)

};

/*
 *      Verify the size and alignment of the PTDA.
 *
 *      CBPTDA = (sizeof(struct ptda_s))
 *      (hint - nmake tkptda.lst in the task directory to see the size)
 *      TKOPTDA is the offset of the PTDA structure in TASKAREA.
 *      TKOTCB1 is the offset of the Sysinit TCB in TASKAREA.
 *      TKOTSD is the offset of the SysInit TSD in TASKAREA.
 */

// ASM ifdef ptda_s
#define CBPTDA          sizeof(struct ptda_s)
#define TKOPTDA         (64*1024 - CBPTDA)
#define TKOTCB1         (TKOPTDA - sizeof(struct tcb_s))
// ASM ifdef PAGEMASK
#define TKOTSD          ((TKOTCB1 - sizeof(struct tsd_s)) & ~PAGEMASK)
/* ASM
   endif
   else
        CBPTDA  equ     ptda_size
   endif
   .errnz (CBPTDA and 3)
   .errnz (CBPTDA GT 2000h) ; ptda must be two pages or less

*/

/* XLATOFF */
#define ptda_Pid        ptda_infoseg.LIS_CurProcID
#define ptda_Ppid       ptda_infoseg.LIS_ParProcID
#define ptda_ProcType   ptda_infoseg.LIS_ProcType
#define ptda_ProcStatus ptda_infoseg.LIS_ProcStatus
#define ptda_CurScrnGrp ptda_infoseg.LIS_CurScrnGrp
/* XLATON */
#define TCBcount        ptda_cTCB
/* ASM
ptda_ppib       equ     (dword ptr ptda_avatib)
ptda_Pid        equ     (word ptr ptda_infoseg.LIS_CurProcID)
ptda_Ppid       equ     (word ptr ptda_infoseg.LIS_ParProcID)
ptda_ProcType   equ     (byte ptr ptda_infoseg.LIS_ProcType)
ptda_ProcStatus equ     (byte ptr ptda_infoseg.LIS_ProcStatus)
ptda_CurScrnGrp equ     (word ptr ptda_infoseg.LIS_CurScrnGrp)
*/

// !GASM ptda_flDbgEnabled EQU ptda_pdcb

// XLATOFF
#define ptda_DbgEnabled ptda_pdcb
#define pPTDAPrevZombie pPTDAPrevSibling
#define pPTDANextZombie pPTDANextSibling
#define PrevZombiePTDA  PrevSiblingPTDA
#define NextZombiePTDA  NextSiblingPTDA
#define ptda_pTCB1      ptda_pTCBHead
typedef struct ptda_s ptda_t;
typedef struct ptda_s PTDA;             // Hungarian typedefs
typedef PTDA *PPTDA;
// XLATON

/*end*/


/*
 *  Now define dummy segment to push PTDA to top of group.
 */

/* GASM
TASKDUMMY SEGMENT

        db      (64*1024 - ((ptda_size + 3) AND 0FFFCh)) dup(?)

TASKDUMMY ENDS
*/

// GASM END
