1 | /* $Id: OS2KVM.h,v 1.6 2000-09-08 21:34:11 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 | /*******************************************************************************
|
---|
17 | * Defined Constants And Macros *
|
---|
18 | *******************************************************************************/
|
---|
19 |
|
---|
20 | /* v8086.h */
|
---|
21 | #define VM_PG_W 0x00000002 /* VPMPG_W - Page Writeable. */
|
---|
22 | #define VM_PG_U 0x00000004 /* VPMPG_U - Page User Mode Accessible.*/
|
---|
23 | #define VM_PG_X 0x00000008 /* VPMPG_X - Page Executable. */
|
---|
24 | #define VM_PG_R 0x00000010 /* VPMPG_R - Page Readable. */
|
---|
25 | #define VM_PG_RESERVED 0x00001000 /* VPMPG_RESERVED- Reservered */
|
---|
26 |
|
---|
27 | /* vpmx2.h */
|
---|
28 | #define VM_PG_SWAPPABLE 0x00000000 /* Swappable */
|
---|
29 |
|
---|
30 |
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * VMAlloc flFlag1 guessings
|
---|
34 | */
|
---|
35 | #define VMA_CONTIG 0x00000001UL /* VMDHA_CONTIG */
|
---|
36 | #define VMA_WRITE VM_PG_W /* PAG_WRITE and OB_WRITE */
|
---|
37 | #define VMA_USER VM_PG_U /* OB_USER */
|
---|
38 | #define VMA_EXECUTE VM_PG_X /* PAG_EXECUTE and OB_READ !! */
|
---|
39 | #define VMA_READ VM_PG_R /* PAG_READ and OB_EXEC !! */
|
---|
40 | #define VMA_LOWMEM 0x00000020UL /* OB_LOWMEM < 1MB physical */
|
---|
41 | #define VMA_GUARD 0x00000040UL /* PAG_GUARD and VMDHA_16M and OB_GUARD */
|
---|
42 | #if 0
|
---|
43 | #define VMA_RESIDENT 0x00000080UL /* OB_RESIDENT */
|
---|
44 | #define VMA_ZEROINIT 0x00000100UL /* OB_ZEROINIT */
|
---|
45 | #define VMA_PHYS 0x00000200UL /* VMDHA_PHYS */
|
---|
46 | #define VMA_FIXED 0x00000400UL /* VMDHA_FIXED and OB_SHARED */
|
---|
47 | #else
|
---|
48 | #define VMA_ZEROFILL 0x00000080UL
|
---|
49 | #define VMA_SWAPONWRITE 0x00000100UL
|
---|
50 | #define VMA_UVIRT 0x00000200UL /* VMDHA_PHYS */
|
---|
51 | #define VMA_RESIDENT 0x00000400UL /* VMDHA_FIXED and OB_SHARED */
|
---|
52 | #endif
|
---|
53 | #define VMA_DISCARDABLE 0x00000800UL /* discarable object */
|
---|
54 | #define VMA_SHARE 0x00001000UL /* OBJSHARE and OBJEXEC (which implies shared) */
|
---|
55 | #define VMA_PROTECTED 0x00004000UL /* PAG_PROTECTED */
|
---|
56 | #define VMA_LOWMEM2 0x00010000UL /* OB_LOWMEM */
|
---|
57 | #define VMA_VDM 0x00040000UL /* (VPMVMAC_VDM) VDM allocation */
|
---|
58 | #define VMA_DECOMMIT 0x00080000UL /* PAG_DECOMMIT */
|
---|
59 | #define VMA_TILE 0x00400000UL /* OBJ_TILE */
|
---|
60 | #define VMA_SELALLOC 0x00400000UL /* Allocates selector */
|
---|
61 | #define VMA_SHRINKABLE 0x00800000UL /* OB_SHRINKABLE */
|
---|
62 | #define VMA_HUGH 0x01000000UL /* OB_HUGH */
|
---|
63 |
|
---|
64 | #define VMA_ARENASHARED 0x04000000UL /* Shared Arena */
|
---|
65 | #define VMA_ARENASYSTEM 0x00000000UL /* System Arena */
|
---|
66 | #define VMA_ARENAPRIVATE 0x02000000UL /* (VPMVMAC_ARENAPRV) Private Arena */
|
---|
67 | #define VMA_ARENAHEAP 0x06000000UL /* Heap Arena */
|
---|
68 | #define VMA_ARENAHIGHA 0x00008000UL /* High shared arena (Warp >= fp13) */
|
---|
69 | #define VMA_ARENAHIGH (options.ulBuild >= MERLINFP13 ? VMA_ARENAHIGHA : 0UL)
|
---|
70 | #define VMA_ARENAMASKW 0x06000000UL /* Warp < fp13 Arena Mask */
|
---|
71 | #define VMA_ARENAMASKA 0x06008000UL /* Aurora Arena Mask */
|
---|
72 | #define VMA_ARENAMASK (options.ulBuild >= MERLINFP13 ? VMA_ARENAMASKA : VMA_ARENAMASKW)
|
---|
73 |
|
---|
74 | #define VMA_ALIGNPAGE 0x18000000UL /* (VPMVMAC_ALIGNPAGE) Page alignment */
|
---|
75 |
|
---|
76 | #define VMA_LOCMASK 0xC0000000UL /* Location mask */
|
---|
77 | #define VMA_LOCSPECIFIC 0x80000000UL /* (VPMVMAC_LOCSPECIFIC) Specific location */
|
---|
78 | #define VMA_LOCABOVE 0x40000000UL /* (VPMVMAC_LOCABOVE) Above or equal to specified location */
|
---|
79 | #define VMA_LOCANY 0x00000000UL /* Anywhere */
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * VMAlloc flFlags2 guessings
|
---|
85 | */
|
---|
86 | #if 0 /*???*/
|
---|
87 | #define VDHAM_FIXED 0x0000UL
|
---|
88 | #define VDHAM_SWAPPABLE 0x0001UL
|
---|
89 | #define VPMVMFM_VDM 0x00000004UL /* Request on behalf of VDM */
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | #define VMAF2_WRITE 0x00000002UL /* PAG_WRITE */
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | /*******************************************************************************
|
---|
97 | * Structures and Typedefs *
|
---|
98 | *******************************************************************************/
|
---|
99 | typedef struct _vmac
|
---|
100 | {
|
---|
101 | ULONG ac_va; /* off=0 cb=4 Virtual Address. */
|
---|
102 | USHORT ac_sel; /* off=4 cb=2 Selector. */
|
---|
103 | USHORT ac_hob; /* off=6 cb=2 Object handle. */
|
---|
104 | } VMAC, *PVMAC;
|
---|
105 |
|
---|
106 |
|
---|
107 | /*******************************************************************************
|
---|
108 | * Exported Functions *
|
---|
109 | *******************************************************************************/
|
---|
110 | HMTE KRNLCALL VMGetOwner(
|
---|
111 | ULONG ulCS,
|
---|
112 | ULONG ulEIP);
|
---|
113 |
|
---|
114 | APIRET KRNLCALL VMAllocMem(
|
---|
115 | ULONG cbSize,
|
---|
116 | ULONG cbCommit,
|
---|
117 | ULONG flFlags1,
|
---|
118 | HPTDA hPTDA,
|
---|
119 | USHORT usVMOwnerId,
|
---|
120 | HMTE hMTE,
|
---|
121 | ULONG flFlags2,
|
---|
122 | ULONG SomeArg2,
|
---|
123 | PVMAC pvmac);
|
---|
124 |
|
---|
125 | APIRET KRNLCALL VMObjHandleInfo(
|
---|
126 | USHORT usHob,
|
---|
127 | PULONG pulAddr,
|
---|
128 | PUSHORT pushPTDA);
|
---|
129 |
|
---|
130 | PMTE KRNLCALL VMPseudoHandleMap(
|
---|
131 | HMTE hMTE);
|
---|
132 | #endif
|
---|