summaryrefslogtreecommitdiff
path: root/v4.0/src/MEMM/EMM/EMMDEF.INC
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/MEMM/EMM/EMMDEF.INC
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/MEMM/EMM/EMMDEF.INC')
-rw-r--r--v4.0/src/MEMM/EMM/EMMDEF.INC331
1 files changed, 331 insertions, 0 deletions
diff --git a/v4.0/src/MEMM/EMM/EMMDEF.INC b/v4.0/src/MEMM/EMM/EMMDEF.INC
new file mode 100644
index 0000000..ffe0630
--- /dev/null
+++ b/v4.0/src/MEMM/EMM/EMMDEF.INC
@@ -0,0 +1,331 @@
1;******************************************************************************
2;
3; (C) Copyright MICROSOFT Corp. 1986
4;
5; Title: CEMM.EXE - COMPAQ Expanded Memory Manager 386 Driver
6; EMMLIB.LIB - Expanded Memory Manager Library
7;
8; Module: EMMDEF.INC - defines for EMM code.
9;
10; Version: 0.04
11;
12; Date: June 21, 1986
13;
14;******************************************************************************
15;
16; Change log:
17;
18; DATE REVISION DESCRIPTION
19; -------- -------- -------------------------------------------------------
20; 06/21/86 Original
21; 06/25/86 0.02 Changed HANDLE_CNT to 255 to match LIM spec (SBP).
22; 06/28/86 0.02 Name change from CEMM386 to CEMM (SBP).
23; 07/06/86 0.04 Changed save area struct (SBP).
24; 05/25/88 Changed to meet LIM 4.0 Spec (PC)
25;******************************************************************************
26ifndef INC_LIST
27.xlist
28endif
29
30;******************************************************************************
31; G E N E R A L D E F I N E S
32;******************************************************************************
33EMM_PAGE_CNT = 2048 ; maximum of 2048 EMM pages (32MB)
34HANDLE_CNT = 255 ; maximum of 255 EMM handles
35FRS_COUNT = 16 ; number of 'Fast Register Sets'
36
37EMM32_PHYS_PAGES = 4 ; page frame contains 4 pages
38;
39; The 0 to 1M contains 64 physical pages. Of these we are not mapping anything
40; between E000 and FFFF, 0000 and 4000. So the Maximum physcial pages we can
41; get for mapping is 40.
42
43TOT_PHYS_PAGES equ 64
44MAX_PHYS_PAGES equ 40 ; Life, the Universe
45 ; and Everything
46PAGE_SIZE = 1000h
47;
48; Of the above mappable pages the regions C000h to Dfffh have to be searched
49; for the mappable pages.
50;
51ABOVE_CONV_STRT_SEG equ 0C000h
52ABOVE_CONV_STRT_PG equ ABOVE_CONV_STRT_SEG SHR 10
53;
54ABOVE_CONV_END_SEG equ 0DC00h
55ABOVE_CONV_END_PG equ ABOVE_CONV_END_SEG SHR 10
56;
57MAX_ABOVE_CONV_PAGES EQU 8
58;
59; Also the system memory mappable region starts at 4000h
60;
61CONV_STRT_SEG equ 4000h
62CONV_STRT_PG equ CONV_STRT_SEG SHR 10
63;
64NUM_CONV_PGS equ (0A000h -4000h) SHR 10
65;
66; During init we keep track of mappable pages with an array of mappable_segs
67;
68
69PAGE_MAPPABLE equ 0FFh ;
70PAGE_NOT_MAPPABLE equ 0h ;
71
72
73NULL_PAGE = 0FFFFh
74NULL_HANDLE = 00FFFh
75
76
77;
78; Flags for memory move/xchg
79;
80Source_GT_Dest_Flag = 80h ; Source > Destination for copy / xchg
81Overlap_Flag = 40h ; Copy overlapping memory
82Backward_Copy_Flag = 20h ; copy is going to be backward
83;
84; Flags for PFlag use in Alter Map and Jump
85;
86PFLAG_VM = 0002h ; VM bit in High word of EFLAG
87PFLAG_VIRTUAL = 0020h ; wheather it's call from virtual or proected mode
88PFLAG_PATCH_CS_IP = 0008h ; Tell Protected mode dispatch to
89 ; patch new CS:IP onto it's return address
90;******************************************************************************
91; S T A T U S D E F I N E S
92;******************************************************************************
93OK = 0
94EMM_SW_MALFUNCTION = 80h
95EMM_HW_MALFUNCTION = 81h
96INVALID_HANDLE = 83h
97INVALID_FUNCTION = 84h
98NO_MORE_HANDLES = 85h
99SAVED_PAGE_DEALLOC = 86h
100NOT_ENOUGH_EXT_MEM = 87h
101NOT_ENOUGH_FREE_MEM = 88h
102ZERO_PAGES = 89h
103LOG_PAGE_RANGE = 8Ah
104PHYS_PAGE_RANGE = 8Bh
105SAVE_AREA_FULL = 8Ch
106MAP_PREV_SAVED = 8Dh
107NO_MAP_SAVED = 8Eh
108INVALID_SUBFUNCTION = 8Fh
109
110; LIM 4.0 extras
111
112VALID_OVERLAP = 92h
113INSUFFICIENT_EMM_PAGES = 93h
114CONVENTIONAL_EMM_OVERLAP= 94h
115INVALID_OFFSET = 95h
116INVALID_REGION_LENGTH = 96h
117OVERLAPPING_EXCHANGE = 97h
118INVALID_MEMORY_TYPE = 98h
119FRSETS_UNSUPPORTED = 99h
120INVALID_FRSET = 9Ah
121NO_MORE_FRSETS = 9Bh
122FRSET_NON_ZERO = 9Ch
123FRSET_UNDEFINED = 9Dh
124FRSET_NO_DMA = 9Eh
125FRSET_INVALID_DMA = 9Fh
126HANDLE_NAME_NOT_FOUND = 0A0h
127DUPLICATE_HANDLE_NAME = 0A1h
128INVALID_WRAPAROUND = 0A2h
129SOURCE_CORRUPTED = 0A3h
130ACCESS_DENIED = 0A4h
131
132
133;******************************************************************************
134; GET/SET PAGE MAP SUBFUNCTION CODES
135;******************************************************************************
136GSPM_GET equ 0
137GSPM_SET equ 1
138GSPM_GETSET equ 2
139GSPM_SIZE equ 3
140
141;
142; OSEnabled Values
143;
144OS_IDLE equ 0
145OS_ENABLED equ 1
146OS_DISABLED equ 2
147
148;******************************************************************************
149; S T R U C T U R E S
150;******************************************************************************
151
152;
153; stack frame after pushad on real/virtual mode entry
154;
155r67_Frame struc
156rDI dd ?
157rSI dd ?
158rBP dd ?
159rSP dd ?
160rBX dd ?
161rDX dd ?
162rCX dd ?
163rAX dd ?
164retaddr dw ?
165rCS dw ?
166PFlag dw ?
167rDS dw ?
168rES dw ?
169rGS dw ?
170rFS dw ?
171r67_Frame ends
172
173
174;
175; for _handle_table
176;
177HandleTable_struc struc
178ht_index dw NULL_PAGE ; index into emm_page for handle's pgs
179ht_count dw 0 ; number of emm_pages for this handle
180HandleTable_struc ends
181
182;
183; for _save_area
184;
185SaveMap_struc struc
186s_handle dw NULL_HANDLE ; owning handle
187s_map dw EMM32_PHYS_PAGES dup (NULL_PAGE) ; EMM page #s
188SaveMap_struc ends
189
190;
191; structure linking segment with physical page number
192;
193Mappable_Page struc
194mappable_seg dw ?
195mappable_pg dw ?
196Mappable_Page ends
197
198;
199; Get Partial Page Map
200;
201gppm_struc struc
202gppm_count dw ?
203gppm_segs dw ?
204gppm_struc ends
205
206;
207; Structures used as arguments to Map Handle Array function
208;
209
210; For subfunction 0:
211mha_array0 struc
212mha0_log_pg dw ?
213mha0_phys_pg dw ?
214mha_array0 ends
215
216; For subfunction 1:
217mha_array1 struc
218mha1_log_pg dw ?
219mha1_seg dw ?
220mha_array1 ends
221
222; Used by Map and Jump and Map and Call -- Identical to mha_array0 and 1
223log_phys_map_struct struc
224log_page_number dw ?
225phys_page_number_seg dw ?
226log_phys_map_struct ends
227
228; Map and Jump structure
229maj_struct struc
230maj_target_address dd ?
231maj_log_phys_map_len db ?
232maj_map_address dd ?
233maj_struct ends
234
235; Map and Call structure
236mac_struct struc
237mac_target_address dd ?
238mac_new_page_map_len db ?
239mac_new_map_address dd ?
240mac_old_page_map_len db ?
241mac_old_map_address dd ?
242mac_reserved dw 4 dup (?)
243mac_struct ends
244
245; Move / Exchange memory structure
246mem_memory_descriptor_struct struc
247mem_memory_type db ?
248mem_handle dw ?
249mem_initial_offset dw ?
250mem_initial_seg_page dw ?
251mem_memory_descriptor_struct ends
252
253
254mem_struct struc
255mem_region_length dd ?
256mem_source db (SIZE mem_memory_descriptor_struct) dup (?)
257mem_dest db (SIZE mem_memory_descriptor_struct) dup (?)
258mem_struct ends
259
260;
261; Fast Register Set Description
262;
263FRS_struc struc
264FRS_Window dw MAX_PHYS_PAGES dup (NULL_PAGE) ; emm page numbers
265FRS_alloc dw 0 ; Is this set allocated
266FRS_struc ends
267
268 page
269;****************************************************************************
270;
271; Dword_Align -- Aligns code to dword boundry by inserting nops
272;
273;****************************************************************************
274
275Dword_Align MACRO Seg_Name
276IF (($ - OFFSET Seg_Name:0) MOD 4)
277 db 90h ;; Nop in code / else byte of 90h in data
278 Dword_Align Seg_Name
279ENDIF
280 ENDM
281
282 page
283;***********************************************
284;
285; Validate_Handle - check the handle in DX
286;
287; ENTRY: Handle as per LIM4.0 spec. in DX
288;
289; EXIT: If the handle is invalid jump To Death_Label, otherwise,
290; EDX points to the _handle_table entry for the handle
291;
292; USES: EDX
293;
294;***********************************************
295Validate_Handle MACRO Death_Label
296
297 cmp dx, [_handle_table_size] ;Q: handle in range ?
298 jae Death_Label ; N: go to error label
299 shl dx, 2 ; Y: convert handle to
300 add dx, offset _handle_table ; pointer
301 xchg bx, dx
302 cmp [bx.ht_index], NULL_PAGE ;Q: is this handle active ?
303 xchg bx, dx
304 je Death_Label ; N: return error
305
306 ENDM
307
308;***********************************************
309;
310; Handle2HandlePtr - convert the handle in DX to
311; points into handle_table
312;
313; ENTRY: Handle as per LIM4.0 spec. in DX
314;
315; EXIT: EDX points to the _handle_table entry for the handle
316;
317; USES: EDX
318;
319;***********************************************
320Handle2HandlePtr MACRO
321
322 shl dx, 2 ; Y: convert handle to
323 add dx, offset _handle_table ; pointer
324
325 ENDM
326
327.list ; end of EMMDEF.INC
328
329
330
331 \ No newline at end of file