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