/*static char *SCCSID = "@(#)vmowner.h  6.2 91/11/10"; */

/*
 *      IBM/Microsoft Confidential
 *
 *      Copyright (c) IBM Corporation 1987, 1989
 *      Copyright (c) Microsoft Corporation 1987, 1989
 *
 *      All Rights Reserved
 *
 *      History of Changes:
 *      147968   RJM - Removed FSD and DD owner limits.
 */

/*
 *  Include file for memory object ownership.
 *  System segment owner equates: Warning - these values were specifically
 *  chosen to cause internal errors if ever interpreted as handles.
 *
 *  Instructions for adding new owners:
 *
 *  1)  New owner names must begin with the acronym of the component to
 *      which they belong and end with the word OWNER.  New owners should
 *      usually be added to the beginning of the list.  NOTE: VMMINOWNER
 *      must always be set to the smallest owner value.
 *
 *  2)  You must also update the 2 debugger tables for owner messages
 *      in debug\dosmem.asm, and the arena program's owner tables
 *      to keep them in sync (see mssrc\arena\arenad.c)
 *
 *  3)  Miscellaneous owners should be eventually filtered into
 *      components.
 */


#define VMMINOWNER      0xff2a       /* Lowest possible owner */

#define OS2DUMPOWNER	0xff2a	     /* OS2 dump */
#define HYBEROWNER	0xff2b	     /* Hybernation working areas */
#define DEVKRNLEXITOWNER 0xff2c       /* Dev Help Kernel Exit         78486  */
#define LDRLIELISTOWNER 0xff2d       /* LDR LieLists */
#define DEMVEROWNER     0xff2e       /* DEM fake version entries */
#define VMBMDOWNER      0xff2f       /* VM Arena Bitmap Directory */
#define FSNPIPENPNOWNER 0xff30       /* Named pipe NPN segment */
#define FSNPIPENPOWNER  0xff31       /* Named pipe NP segment */
#define REQPKTTCBOWNER  0xff32       /* DD TCB request packets */
#define REQPKT2OWNER    0xff33       /* DD strat2 request packets */
#define SPLDEVRMPOWNER  0xff34       /* Spool Dev RMP segment */
#define CHARDEVRMPOWNER 0xff35       /* Char Dev RMP segment */
#define SYSSEMRMPOWNER  0xff36       /* System Semaphore RMP segment */
#define OS2ROMDATA      0xff37       /* ROM data */
#define LDRLIBPATHOWNER 0xff38       /* LDR LibPath */
#define FSJFNFLAGSOWNER 0xff39       /* JFN flags */
#define FSJFNTABLEOWNER 0xff3a       /* JFN table */
#define PTOUVIRTOWNER   0xff3b       /* PhysToUVirt */
#define TKR3STACKOWNER  0xff3c       /* Ring 3 stack */
#define TKR2STACKOWNER  0xff3d       /* Ring 2 stack */
#define TKENVOWNER      0xff3e       /* User Environment */
#define TKTIBOWNER      0xff3f       /* Thread Information Block */
#define REQPKT1OWNER    0xff40       /* DD strat1 request packets */
#define ALLOCPHYSOWNER  0xff41       /* Allocated via DevHlp AllocPhys */
#define VMKRHBDONOWNER  0xff42       /* Unusable donated heap page owner */
#define VMKRHRW1MOWNER  0xff43       /* Resident R/W 1Meg mem heap owner */
#define VMKRHRO1MOWNER  0xff44       /* Resident R/W 1Meg mem heap owner */
#define MMPHOWNER       0xff45       /* dekko mapped memory */
#define PAGEIOOWNER     0xff46       /* pageio per-swap-file save block */
#define FSRLROWNER      0xff47       /* record lock record owner */

//147968 the following FSD and DD owners are now redundant and
//147968 available for alternative use.
#define FSD1OWNER       0xff48          /* FSDs */
#define FSD2OWNER       (FSD1OWNER + 1)
#define FSD3OWNER       (FSD1OWNER + 2)
#define FSD4OWNER       (FSD1OWNER + 3)
#define FSD5OWNER       (FSD1OWNER + 4)
#define FSD6OWNER       (FSD1OWNER + 5)
#define FSD7OWNER       (FSD1OWNER + 6)
#define FSD8OWNER       (FSD1OWNER + 7)
#define MAXFSDOWNER     FSD8OWNER
#define DD1OWNER        0xff50          /* device drivers */
#define DD2OWNER        (DD1OWNER + 1)
#define DD3OWNER        (DD1OWNER + 2)
#define DD4OWNER        (DD1OWNER + 3)
#define DD5OWNER        (DD1OWNER + 4)
#define DD6OWNER        (DD1OWNER + 5)
#define DD7OWNER        (DD1OWNER + 6)
#define DD8OWNER        (DD1OWNER + 7)
#define DD9OWNER        (DD1OWNER + 8)
#define DD10OWNER       (DD1OWNER + 9)
#define DD11OWNER       (DD1OWNER + 10)
#define DD12OWNER       (DD1OWNER + 11)
#define DD13OWNER       (DD1OWNER + 12)
#define DD14OWNER       (DD1OWNER + 13)
#define DD15OWNER       (DD1OWNER + 14)
#define DD16OWNER       (DD1OWNER + 15)
#define MAXDDOWNER      DD16OWNER

/*XLATOFF*/
// d147968
//#define IsFSDOwner(x)  (((x) >= FSD1OWNER) && ((x) <= MAXFSDOWNER))
//#define IsDDOwner(x) (((x) >= DD1OWNER) && ((x) <= MAXDDOWNER))
#define IsDDOwner(x) (((x)<VMMINOWNER) && \
                       (vmHandleMap((x))->ob_fs & OB_PSEUDO) &&  \
                       (vmHandleMap((x))->ob_hobowner==LDRMTEOWNER) && \
                       (((ldrmte_t *)VMPseudoHandleMap((x)))->mte_flags1 & DEVDRVMOD))

#define IsFSDOwner(x) (((x)<VMMINOWNER) && \
                       (vmHandleMap((x))->ob_fs & OB_PSEUDO) &&  \
                       (vmHandleMap((x))->ob_hobowner==LDRMTEOWNER) && \
                       (((ldrmte_t *)VMPseudoHandleMap((x)))->mte_flags1 & FSDMOD))

#define IsFSHOwner(x) ((x) == FSHOWNER)
#define IsDevHlpOwner(x) ((x) == DEVHLPOWNER || (x) == ALLOCPHYSOWNER || \
                          (x) == PTOGDTOWNER)


/*XLATON*/

#define FSCMOWNER       0xff60       /* cluster map owner */

/***EK+ MISCOWNER - Miscellaneous Owners */

#define CDSRMPOWNER     0xff61       /* Current Directory Structure RMP seg */
#define TOMOWNER        0xff62       /* Timeout Manager */
#define ABIOSOWNER      0xff63       /* Advanced BIOS */
#define CACHEOWNER      0xff64       /* cache */
#define DBGDCBOWNER     0xff65       /* DBG Debug Control Block */
#define DBGKDBTMPOWNER  0xff66       /* DBG Kernel Debug Block */
#define DBGWPCBOWNER    0xff67       /* DBP Watch Point Control Block */
#define DEMFCBSFTOWNER  0xff68       /* DEM SFT array (for FCBs) */
#define DEMFONTOFFOWNER 0xff69       /* DEM font offsets */
#define DEMFONTOWNER    0xff6a       /* DEM font data */
#define DEVHLPOWNER     0xff6b       /* allocated via devhlp AllocPhys */
#define DISCARDOWNER    0xff6c       /* discardable, zero fill object */
#define DOSHLPOWNER     0xff6d       /* DosHelp segment */
#define DYNDTGPTMPOWNER 0xff6e       /* DYN trace point parm block */
#define DYNDTOOWNER     0xff6f       /* dynamic tracepoint */
#define DYNDTOTMPOWNER  0xff70       /* tmp dynamic trace info */
#define DYNMTEDTLOWNER  0xff71       /* DYN MTE dynamic trace link */
#define EM86MALLOCOWNER 0xff72       /* EM86 malloc() */
#define EM86TSSOWNER    0xff73       /* EM86 TSS */
#define IDDOWNER        0xff74       /* installed device driver */
#define INFOSEGOWNER    0xff75       /* infoseg (local or global) */
#define INITMSGOWNER    0xff76       /* INIT saved message */
#define INITOWNER       0xff77       /* generic init-time only */
#define INTDIRQOWNER    0xff78       /* INT IRQ info */
#define INTSTACKOWNER   0xff79       /* interrupt stack */
#define IOPLLISTOWNER   0xff7a       /* !!AVAILABLE!! no longer used  */
#define KDBALIASOWNER   0xff7b       /* Kernel debugger alias */
#define KDBSYMOWNER     0xff7c       /* Kernel debugger symbol */
#define KMHOOKOWNER     0xff7d       /* KM hook info */
#define KSEMOWNER       0xff7e       /* KSEM semaphore */
#define LBDDOWNER       0xff7f       /* loadable base device driver */
#define LIDOWNER        0xff80       /* ABIOS logical identifier */
#define MONITOROWNER    0xff81       /* monitor segment */
#define MSHAREOWNER     0xff82       /* named-shared */
#define MSHARERMPOWNER  0xff83       /* RMP having mshare records */
#define NMIOWNER        0xff84       /* non maskable interrupt */
#define NPXOWNER        0xff85       /* 287/387 save area */
#define ORPHANOWNER     0xff86       /* orphaned segment */
#define PROFOWNER       0xff87       /* profile support */
#define PTOGDTOWNER     0xff88       /* Allocated via dh_allocateGDTSelector */
#define PTOVIRTOWNER    0xff89       /* PhysToVirt */
#define PUSAGEOWNER     0xff8a       /* Page Usage */
#define PUSAGETMPOWNER  0xff8b       /* tmp Page Usage */
#define PVWOWNER        0xff8c       /* Perfview */
#define QSCACHETMPOWNER 0xff8d       /* QuerySysInfo cache */
#define RASOWNER        0xff8e       /* RAS segment */
#define RSRCBMPOWNER    0xff8f       /* Resource BMP segment */
#define SYSSERVOWNER    0xff90       /* system service */
#define TIMEROWNER      0xff91       /* timer services segment */
#define TRAPHEOWNER     0xff92       /* TRAP Hard Error */
/*end*/


/***EK+ FSOWNER - File System Owners */

#define FSBUFOWNER      0xff93       /* file system buffer */
#define FSCDEVTMPOWNER  0xff94       /* Char DEV TMP */
#define FSCOWNER        0xff95       /* FSC segment */
#define FSDPBOWNER      0xff96       /* DPB */
#define FSEATMPOWNER    0xff97       /* fat EA TMP */
#define FSFATSRCHOWNER  0xff98       /* fat search segment */
#define FSFNOTIFYGOWNER 0xff99       /* FindNotify global segment */
#define FSFNOTIFYPOWNER 0xff9a       /* FindNotify private segment */
#define FSHOWNER        0xff9b       /* installable file sys helper */
#define FSIFSOWNER      0xff9c       /* installable file system */
#define FSMFSDOWNER     0xff9d       /* mini file system */
#define FSMFTOWNER      0xff9e       /* master file table */
#define FSNPIPEBUFOWNER 0xff9f       /* Named pipe I/O buffer segment */
#define FSPIPEOWNER     0xffa0       /* pipe */
#define FSSFTOWNER      0xffa1       /* system file table */
#define FSVPBOWNER      0xffa2       /* volume parameter block */
/*end*/


/***EK+ LDROWNER - Loader Owners */

#define LDRCACHEOWNER   0xffa3       /* Loader Instance Data Cache */
#define LDRDLDOWNER     0xffa4       /* LDR Dynamic LoaD record */
#define LDRMKCACHEOWNER 0xffa5       /* Cache being made */
#define LDRMTEOWNER     0xffa6       /* mte */
#define LDRMTEPATHOWNER 0xffa7       /* LDR MTE path */
#define LDRNONRESOWNER  0xffa8       /* LDR non-resident names */
#define LDRPROT16OWNER  0xffa9       /* Protect 16 list */
/*end*/


/***EK+ OS2OWNER - Boot Loader and Kernel Owners */

#define OS2KRNLOWNER    0xffaa       /* os2krnl load image */
#define OS2LDROWNER     0xffab       /* os2ldr load image */
#define OS2RIPLOWNER    0xffac       /* Remote IPL (remote boot) */
/*end*/


/***EK+ PGOWNER - Page Manager Owners */

#define PGALIASOWNER    0xffad       /* Temporary page manager aliases */
#define PGBUFOWNER      0xffae       /* PG loader and swapper buffer */
#define PGCRPTEOWNER    0xffaf       /* PG Compat. region page table */
#define PGDBGALIASOWNER 0xffb0       /* debugger alias pte */
#define PGDIROWNER      0xffb1       /* PG Page directory */
#define PGKRNLSTAKOWNER 0xffb2       /* kernel stack region */
#define PGVPOWNER       0xffb3       /* VP array */
#define PGPFOWNER       0xffb4       /* PF array */
#define PGPRTOWNER      0xffb5       /* Page Range Table */
#define PGSYSPTEOWNER   0xffb6       /* PG System page tables */
/*end*/


/***EK+ SELOWNER - Selector Manager Owners */

#define SELGDTOWNER     0xffb7       /* SEL GDT */
#define SELKHBOWNER     0xffb8       /* Selector-mapped heap block */
#define SELLDTOWNER     0xffb9       /* SEL LDT */
#define SELLOCKOWNER    0xffba       /* SEL Lock */
#define SELNOPOWNER     0xffbb       /* NO-OP Locks */
#define SELUVIRTOWNER   0xffbc       /* SEL UVIRT mapping */
/*end*/


/***EK+ SEMOWNER - Semaphore Owners */

#define SEMMISCOWNER    0xffbd       /* SEM Miscellaneous */
#define SEMMUXQOWNER    0xffbe       /* SEM Mux Queue */
#define SEMOPENQOWNER   0xffbf       /* SEM Open Queue */
#define SEMSEMRECOWNER  0xffc0       /* SEM SemRecord */
#define SEMSTROWNER     0xffc1       /* SEM string */
#define SEMSTRUCOWNER   0xffc2       /* SEM Main structure */
#define SEMTABLEOWNER   0xffc3       /* SEM Private/Shared table */
/*end*/


/***EK+ SMOWNER - Swapper Owners */

#define SMDFHOWNER      0xffc4       /* SM Disk Frame Heap */
#define SMSFNOWNER      0xffc5       /* SM SFN array */
#define SMSFOWNER       0xffc6       /* SM Swap Frame */
/*end*/


/***EK+ TKOWNER - Tasking Owners */

#define TKEXITLISTOWNER 0xffc7       /* TK Exit List record */
#define TKKMREGOWNER    0xffc8       /* TK dispatch (KM) registers */
#define TKLIBIFREEOWNER 0xffc9       /* TK LibInit Free Notification record */
#define TKLIBIOWNER     0xffca       /* TK LibInit record */
#define TKPTDAOWNER     0xffcb       /* TK PTDA */
#define TKTCBOWNER      0xffcc       /* TK TCB */
#define TKTSDOWNER      0xffcd       /* TK TSD */
/*end*/


/***EK+ VDDOWNER - VDD, VDH, VDM Owners */

#define VDDBLOCKHOWNER  0xffce       /* VDD block header */
#define VDDBLOCKOWNER   0xffcf       /* VDD memory block */
#define VDDCFGSTROWNER  0xffd0       /* VDD config.sys string */
#define VDDCREATMPOWNER 0xffd1       /* VDD creation tmp allocation */
#define VDDEPOWNER      0xffd2       /* VDD Entry Point */
#define VDDHEAPHOWNER   0xffd3       /* VDD heap header */
#define VDDHEAPOWNER    0xffd4       /* heap objects to load VDDs */
#define VDDHOOKOWNER    0xffd5       /* VDD hook */
#define VDDLAOWNER      0xffd6       /* VDD Linear Arena header */
#define VDDLROWNER      0xffd7       /* VDD Linear arena Record */
#define VDDMODOWNER     0xffd8       /* VDD module record */
#define VDDOPENOWNER    0xffd9       /* open VDD record */
#define VDDPDDEPOWNER   0xffda       /* VDD PDD Entry Point */
#define VDDPROCOWNER    0xffdb       /* VDD procedure record */
#define VDDSTROWNER     0xffdc       /* VDD string */
#define VDHFHOOKOWNER   0xffdd       /* VDH fault hook */
#define VDHOWNER        0xffde       /* VDH services resident memory */
#define VDHSWAPOWNER    0xffdf       /* VDH services swappable memory */
#define VDMALIASOWNER   0xffe0       /* VDM Alias */


/***EK+ VMOWNER - Virtual Memory Manager Owners */

#define VMAHOWNER       0xffe1       /* VM arena header */
#define VMALOWNER       0xffe2       /* VM Alias Record */
#define VMAROWNER       0xffe3       /* VM Arena Record */
#define VMBMOWNER       0xffe4       /* VM Location Bitmap */
#define VMCOOWNER       0xffe5       /* VM Context Record */
#define VMDEADOWNER     0xffe6       /* VM Dead Object */
#define VMHSHOWNER      0xffe7       /* VM Location Hash Table */
#define VMKRHBOWNER     0xffe8       /* VM *UNKNOWN* busy KRHB */
#define VMKRHFOWNER     0xffe9       /* VM free KRHB */
#define VMKRHLOWNER     0xffea       /* VM end KRHB */
#define VMKRHROOWNER    0xffeb       /* VM Public Kernel Resident R/O Heap */
#define VMKRHRWOWNER    0xffec       /* VM Public Kernel Resident R/W Heap */
#define VMKSHDOWNER     0xffed       /* VM Swappable Heap Descriptor */
#define VMKSHROOWNER    0xffee       /* VM Public Kernel Swappable R/O Heap */
#define VMKSHRWOWNER    0xffef       /* VM Public Kernel Swappable R/W Heap */
#define VMLLOCKOWNER    0xfff0       /* VM long term lock manager */
#define VMOBOWNER       0xfff1       /* VM Object Record */
#define VMSGSOWNER      0xfff2       /* VM Screen Group Switch record */
#define VMTMPBUFOWNER   0xfff3       /* VM Temp buf (BMP16) */
/*end*/


/*
 * WARNING: Following four equates are related.  They must be defined
 * in the order given.  SHRINDRSVD must have the low two bits clear.
 */

#define SHRINDRSVD      0xfff4       /* reserved for shared indicator */
#define GIVESEGOWNER    0xfff5       /* giveable segment */
#define GETSEGOWNER     0xfff6       /* gettable segment */
#define SHRDOWNER       0xfff7       /* givable and gettable segment */
/* ASM
.errnz ((GETSEGOWNER - SHRINDRSVD) AND (GIVESEGOWNER - SHRINDRSVD))
.errnz ((GIVESEGOWNER OR GETSEGOWNER) - SHRDOWNER)
*/



#define LDRPRLOBJECT    0xfff8       /* Loader's preload object */
#define VMMAXOWNER      LDRPRLOBJECT /* Highest possible owner */

/*
 * Values 0xfff9 thru 0xffff are reserved.  They are never used
 * for constant owners, special handle values or as regular handles.
 */
