2 ;******************************************************************************
3 title EMMDISP
- EMM dispatcher
4 ;******************************************************************************
6 ; (C) Copyright MICROSOFT Corp. 1986
8 ; Title: CEMM.EXE - COMPAQ Expanded Memory Manager 386 Driver
9 ; EMMLIB.LIB - Expanded Memory Manager Functions Library
11 ; Module: EMM Dispatcher
17 ;******************************************************************************
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
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 ;******************************************************************************
31 ; Functional Description:
32 ; This module serves to trap Int 67h, place
33 ; arguments on the stack and call the associated
37 ;******************************************************************************
38 .lfcond
; list false conditionals
41 ;******************************************************************************
43 ;******************************************************************************
45 public dispatch_vector
47 ;******************************************************************************
49 ;******************************************************************************
54 ;******************************************************************************
56 ;******************************************************************************
65 dw offset _TEXT
:_
&name
68 ;******************************************************************************
70 ;******************************************************************************
74 extrn Active_Status
:byte
80 ;******************************************************************************
82 ;******************************************************************************
84 ; remove duplicated variables (defined in emmdata.asm)
95 assume
cs:_text
,ds:DGROUP
,ss:DGROUP
,es:DGROUP
100 dispatch_vector
label word
102 mkvect GetPageFrameAddress
103 mkvect GetUnallocatedPageCount
106 mkvect DeallocatePages
109 mkvect RestorePageMap
110 mkvect GetPageMappingRegisterIOArray
111 mkvect GetLogicalToPhysicalPageTrans
112 mkvect GetEMMHandleCount
113 mkvect GetEMMHandlePages
114 mkvect GetAllEMMHandlePages
116 mkvect GetSetPartial
; AH = 4Fh
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
133 ;*************************************
134 ; int67_Entry(PFlag,DS,ES) - entry point for int 67 (EMM functions)
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 */
142 ; REAL or VIRTUAL mode
143 ; DS = DGROUP segment
147 ; At the point of the indirect call,
148 ; The stack looks as follows:
152 ; | FS | +2CH <--- entry FS segment
154 ; | GS | +2AH <--- entry GS segment
156 ; | ES | +28H <--- entry ES segment
158 ; | DS | +26h <--- entry DS segment
160 ; | PFlag | +24h <--- protected mode flag
162 ; | CS | +22h <--- from FAR call to int67_handler
164 ; | ret | +20h <--- CS:ret
166 ; | EAX | +1C <-+- from PUSH ALL
183 ;*************************************
185 pushad ; save all regs
186 mov bp,sp ; SS:[BP] points to stack frame
188 mov [_regp
],sp ; regp points to regs on stack
189 mov [_regp
+2],ss ; regp now has a far ptr to regs
192 ; validate function code
194 sub ah,40h
; check if entry code too small
195 jb i67_inv_exit
; if so, error exit
196 cmp ah,(5
Dh-40h
) ; check if entry code too big
197 ja i67_inv_exit
; if so, error exit
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
208 ; call through the jump table
211 xchg ah,al ; AL = function code
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
219 popad ; restore all regs
222 i67_off_err: ; set h/w error
223 mov byte ptr [bp.rAX+1],EMM_HW_MALFUNCTION
226 i67_inv_exit: ; set invalid function code error
227 mov byte ptr [bp.rAX+1],INVALID_FUNCTION