| 1 | /* $Id: OS2KVM.h,v 1.3 2000-02-18 19:27:29 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * OS/2 kernel VM functions. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no) | 
|---|
| 6 | * | 
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef _OS2KVM_h_ | 
|---|
| 13 | #define _OS2KVM_h_ | 
|---|
| 14 |  | 
|---|
| 15 | /******************************************************************************* | 
|---|
| 16 | *   Defined Constants And Macros                                               * | 
|---|
| 17 | *******************************************************************************/ | 
|---|
| 18 | /* | 
|---|
| 19 | * VMAlloc flFlag1 guessings | 
|---|
| 20 | */ | 
|---|
| 21 | #define VMA_CONTIG          0x00000001  /* VMDHA_CONTIG */ | 
|---|
| 22 | #define VMA_WRITE           0x00000002  /* PAG_WRITE and OB_WRITE */ | 
|---|
| 23 | #define VMA_USER            0x00000004  /* OB_USER */ | 
|---|
| 24 | #define VMA_EXECUTE         0x00000008  /* PAG_EXECUTE and OB_READ !! */ | 
|---|
| 25 | #define VMA_READ            0x00000010  /* PAG_READ and OB_EXEC !! */ | 
|---|
| 26 | #define VMA_LOWMEM          0x00000020  /* OB_LOWMEM < 1MB physical */ | 
|---|
| 27 | #define VMA_GUARD           0x00000040  /* PAG_GUARD and VMDHA_16M and OB_GUARD */ | 
|---|
| 28 | #if 0 | 
|---|
| 29 | #define VMA_RESIDENT        0x00000080  /* OB_RESIDENT */ | 
|---|
| 30 | #define VMA_ZEROINIT        0x00000100  /* OB_ZEROINIT */ | 
|---|
| 31 | #define VMA_PHYS            0x00000200  /* VMDHA_PHYS */ | 
|---|
| 32 | #define VMA_FIXED           0x00000400  /* VMDHA_FIXED and OB_SHARED */ | 
|---|
| 33 | #else | 
|---|
| 34 | #define VMA_ZEROFILL        0x00000080 | 
|---|
| 35 | #define VMA_SWAPONWRITE     0x00000100 | 
|---|
| 36 | #define VMA_UVIRT           0x00000200  /* VMDHA_PHYS */ | 
|---|
| 37 | #define VMA_RESIDENT        0x00000400  /* VMDHA_FIXED and OB_SHARED */ | 
|---|
| 38 | #endif | 
|---|
| 39 | #define VMA_DISCARDABLE     0x00000800  /* discarable object */ | 
|---|
| 40 | #define VMA_SHARE           0x00001000  /* OBJSHARE and OBJEXEC (which implies shared) */ | 
|---|
| 41 | #define VMA_PROTECTED       0x00004000  /* PAG_PROTECTED */ | 
|---|
| 42 | #define VMA_LOWMEM2         0x00010000  /* OB_LOWMEM */ | 
|---|
| 43 | #define VMA_VDM             0x00040000  /* VDM */ | 
|---|
| 44 | #define VMA_DECOMMIT        0x00080000  /* PAG_DECOMMIT */ | 
|---|
| 45 | #define VMA_TILE            0x00400000  /* OBJ_TILE */ | 
|---|
| 46 | #define VMA_SELALLOC        0x00400000  /* Allocates selector */ | 
|---|
| 47 | #define VMA_SHRINKABLE      0x00800000  /* OB_SHRINKABLE */ | 
|---|
| 48 | #define VMA_HUGH            0x01000000  /* OB_HUGH */ | 
|---|
| 49 |  | 
|---|
| 50 | #define VMA_ARENASHARED     0x04000000  /* Shared Arena */ | 
|---|
| 51 | #define VMA_ARENASYSTEM     0x00000000  /* System Arena */ | 
|---|
| 52 | #define VMA_ARENAPRIVATE    0x02000000  /* Private Arena */ | 
|---|
| 53 | #define VMA_ARENAHEAP       0x06000000  /* Heap Arena */ | 
|---|
| 54 | #define VMA_ARENAHIGHA      0x00008000  /* High shared arena (Warp >= fp13) */ | 
|---|
| 55 | #define VMA_ARENAHIGH   (options.ulBuild >= MERLINFP13 ? VMA_ARENAHIGHA : 0UL) | 
|---|
| 56 | #define VMA_ARENAMASKW      0x06000000  /* Warp < fp13 Arena Mask */ | 
|---|
| 57 | #define VMA_ARENAMASKA      0x06008000  /* Aurora Arena Mask */ | 
|---|
| 58 | #define VMA_ARENAMASK   (options.ulBuild >= MERLINFP13 ? VMA_ARENAMASKA : VMA_ARENAMASKW) | 
|---|
| 59 |  | 
|---|
| 60 | #define VMA_LOCMASK         0xC0000000  /* Location mask */ | 
|---|
| 61 | #define VMA_LOCSPECIFIC     0x80000000  /* Specific location */ | 
|---|
| 62 | #define VMA_LOCABOVE        0x40000000  /* Above or equal to specified location */ | 
|---|
| 63 | #define VMA_LOCANY          0x00000000  /* Anywhere */ | 
|---|
| 64 |  | 
|---|
| 65 |  | 
|---|
| 66 |  | 
|---|
| 67 | /* | 
|---|
| 68 | * VMAlloc flFlags2 guessings | 
|---|
| 69 | */ | 
|---|
| 70 | #define VMAF2_WRITE         0x00000002 /* PAG_WRITE */ | 
|---|
| 71 |  | 
|---|
| 72 |  | 
|---|
| 73 | /******************************************************************************* | 
|---|
| 74 | *   Structures and Typedefs                                                    * | 
|---|
| 75 | *******************************************************************************/ | 
|---|
| 76 | typedef struct _vmac | 
|---|
| 77 | { | 
|---|
| 78 | ULONG       ac_va;                  /* off=0 cb=4 Virtual Address. */ | 
|---|
| 79 | USHORT      ac_sel;                 /* off=4 cb=2 Selector. */ | 
|---|
| 80 | USHORT      ac_hob;                 /* off=6 cb=2 Object handle. */ | 
|---|
| 81 | } VMAC, *PVMAC; | 
|---|
| 82 |  | 
|---|
| 83 |  | 
|---|
| 84 | typedef USHORT HMTE, *PHMTE; | 
|---|
| 85 | typedef USHORT HPTDA, *PHPTDA; | 
|---|
| 86 |  | 
|---|
| 87 | /******************************************************************************* | 
|---|
| 88 | *   Exported Functions                                                         * | 
|---|
| 89 | *******************************************************************************/ | 
|---|
| 90 | HMTE KRNLCALL VMGetOwner( | 
|---|
| 91 | ULONG ulCS, | 
|---|
| 92 | ULONG ulEIP); | 
|---|
| 93 |  | 
|---|
| 94 | APIRET KRNLCALL VMAllocMem( | 
|---|
| 95 | ULONG   cbSize, | 
|---|
| 96 | ULONG   cbCommit, | 
|---|
| 97 | ULONG   flFlags1, | 
|---|
| 98 | HPTDA   hPTDA, | 
|---|
| 99 | USHORT  usVMOwnerId, | 
|---|
| 100 | HMTE    hMTE, | 
|---|
| 101 | ULONG   flFlags2, | 
|---|
| 102 | ULONG   SomeArg2, | 
|---|
| 103 | PVMAC   pvmac); | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|
| 106 |  | 
|---|
| 107 | #endif | 
|---|