]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MEMM/EMM/EMMDISP.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MEMM / EMM / EMMDISP.ASM
1 page 58,132
2 ;******************************************************************************
3 title EMMDISP - EMM dispatcher
4 ;******************************************************************************
5 ;
6 ; (C) Copyright MICROSOFT Corp. 1986
7 ;
8 ; Title: CEMM.EXE - COMPAQ Expanded Memory Manager 386 Driver
9 ; EMMLIB.LIB - Expanded Memory Manager Functions Library
10 ;
11 ; Module: EMM Dispatcher
12 ;
13 ; Version: 0.04
14 ;
15 ; Date: May 17, 1986
16 ;
17 ;******************************************************************************
18 ;
19 ; Change log:
20 ;
21 ; DATE REVISION DESCRIPTION
22 ; -------- -------- -------------------------------------------------------
23 ; 5/17/86 0 initial code
24 ; 6/14/86 modified registers on stack for exit and removed call
25 ; to _emm_init (SBP).
26 ; 6/28/86 0.02 Name change from CEMM386 to CEMM (SBP).
27 ; 7/06/86 0.04 Changed data assumes to DGROUP (SBP).
28 ; 5/25/88 Changed function range check to cover LIM 4.0 (PC)
29 ;******************************************************************************
30 ;
31 ; Functional Description:
32 ; This module serves to trap Int 67h, place
33 ; arguments on the stack and call the associated
34 ; function
35 ;
36 ;
37 ;******************************************************************************
38 .lfcond ; list false conditionals
39 .386p
40
41 ;******************************************************************************
42 ; P U B L I C S
43 ;******************************************************************************
44 public int67_Entry
45 public dispatch_vector
46
47 ;******************************************************************************
48 ; I N C L U D E S
49 ;******************************************************************************
50 include vdmseg.inc
51 include vdmsel.inc
52 include emmdef.inc
53 ;
54 ;******************************************************************************
55 ; D E F I N E S
56 ;******************************************************************************
57 ;
58 FALSE equ 0
59 TRUE equ not FALSE
60 CR equ 0dh
61 LF equ 0ah
62
63 mkvect MACRO name
64 extrn _&name:near
65 dw offset _TEXT:_&name
66 endm
67
68 ;******************************************************************************
69 ; E X T E R N A L S
70 ;******************************************************************************
71
72 _DATA SEGMENT
73 extrn _EMMstatus:word
74 extrn Active_Status:byte
75 extrn Auto_Mode:byte
76 extrn _regp:word
77 _DATA ENDS
78
79
80 ;******************************************************************************
81 ; local data
82 ;******************************************************************************
83 ;
84 ; remove duplicated variables (defined in emmdata.asm)
85 ;
86 ;_DATA SEGMENT
87 ;
88 ;_regp label word
89 ; dw 0
90 ; dw 0
91 ;
92 ;_DATA ENDS
93
94 _TEXT SEGMENT
95 assume cs:_text,ds:DGROUP,ss:DGROUP,es:DGROUP
96 ;
97 db 'PxB'
98 ;
99
100 dispatch_vector label word
101 mkvect GetStatus
102 mkvect GetPageFrameAddress
103 mkvect GetUnallocatedPageCount
104 mkvect AllocatePages
105 mkvect MapHandlePage
106 mkvect DeallocatePages
107 mkvect GetEMMVersion
108 mkvect SavePageMap
109 mkvect RestorePageMap
110 mkvect GetPageMappingRegisterIOArray
111 mkvect GetLogicalToPhysicalPageTrans
112 mkvect GetEMMHandleCount
113 mkvect GetEMMHandlePages
114 mkvect GetAllEMMHandlePages
115 mkvect GetSetPageMap
116 mkvect GetSetPartial ; AH = 4Fh
117 ; 4.0 Functions...
118 mkvect MapHandleArray ; AH = 50h
119 mkvect ReallocatePages
120 mkvect GetSetHandleAttribute
121 mkvect GetSetHandleName
122 mkvect GetHandleDirectory
123 mkvect AlterMapAndJump
124 mkvect AlterMapAndCall
125 mkvect MoveExchangeMemory
126 mkvect GetMappablePAddrArray
127 mkvect GetInformation
128 mkvect AllocateRawPages
129 mkvect AlternateMapRegisterSet
130 mkvect PrepareForWarmBoot
131 mkvect OSDisable
132
133 ;*************************************
134 ; int67_Entry(PFlag,DS,ES) - entry point for int 67 (EMM functions)
135 ;
136 ; unsigned PFlag; /* non-zero = protected mode, else */
137 ; /* virtual or real mode */
138 ; unsigned DS; /* DS segment value on entry to int67 */
139 ; unsigned ES; /* ES segment value on entry to int67 */
140 ;
141 ; ENTRY:
142 ; REAL or VIRTUAL mode
143 ; DS = DGROUP segment
144 ; PROTECTED mode
145 ; DS = VDMD_GSEL
146 ;
147 ; At the point of the indirect call,
148 ; The stack looks as follows:
149 ;
150 ;
151 ; +-------+
152 ; | FS | +2CH <--- entry FS segment
153 ; +-------+
154 ; | GS | +2AH <--- entry GS segment
155 ; +-------+
156 ; | ES | +28H <--- entry ES segment
157 ; +-------+
158 ; | DS | +26h <--- entry DS segment
159 ; +-------+
160 ; | PFlag | +24h <--- protected mode flag
161 ; +-------+
162 ; | CS | +22h <--- from FAR call to int67_handler
163 ; +-------+
164 ; | ret | +20h <--- CS:ret
165 ; +-------+
166 ; | EAX | +1C <-+- from PUSH ALL
167 ; +-------+ |
168 ; | ECX | +18 V
169 ; +-------+
170 ; | EDX | +14
171 ; +-------+
172 ; | EBX | +10
173 ; +-------+
174 ; | ESP | +C
175 ; +-------+
176 ; | EBP | +8
177 ; +-------+
178 ; | ESI | +4
179 ; +-------+
180 ; | EDI | <--- regp
181 ; +-------+
182 ;
183 ;*************************************
184 int67_Entry proc far
185 pushad ; save all regs
186 mov bp,sp ; SS:[BP] points to stack frame
187 ;
188 mov [_regp],sp ; regp points to regs on stack
189 mov [_regp+2],ss ; regp now has a far ptr to regs
190
191 ;
192 ; validate function code
193 ;
194 sub ah,40h ; check if entry code too small
195 jb i67_inv_exit ; if so, error exit
196 cmp ah,(5Dh-40h) ; check if entry code too big
197 ja i67_inv_exit ; if so, error exit
198
199 ;
200 ; check for VDM off
201 ;
202 cmp [Auto_Mode],0 ;Q: Auto mode on ?
203 jne i67_jump ; Y: go ahead
204 cmp [Active_Status],0 ; N:Q: are we ON ?
205 je i67_off_err ; N: exit with error code
206
207 ;
208 ; call through the jump table
209 ;
210 i67_jump:
211 xchg ah,al ; AL = function code
212 mov si,ax
213 xchg ah,al ; AH = function code again
214 and si,00FFh ; SI = function #
215 shl si,1 ; SI = table offset
216 call CS:dispatch_vector[si] ; call function
217
218 ok_exit:
219 popad ; restore all regs
220 ret ; bye!
221
222 i67_off_err: ; set h/w error
223 mov byte ptr [bp.rAX+1],EMM_HW_MALFUNCTION
224 jmp ok_exit
225
226 i67_inv_exit: ; set invalid function code error
227 mov byte ptr [bp.rAX+1],INVALID_FUNCTION
228 jmp ok_exit
229
230 int67_entry endp
231
232 _TEXT ENDS
233 END
234 \1a