1 /****************************************************************************
3 * SciTech OS Portability Manager Library
5 * ========================================================================
7 * The contents of this file are subject to the SciTech MGL Public
8 * License Version 1.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.scitechsoft.com/mgl-license.txt
12 * Software distributed under the License is distributed on an
13 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 * The Initial Developer of the Original Code is SciTech Software, Inc.
20 * All Rights Reserved.
22 * ========================================================================
25 * Environment: 32-bit Windows NT device drivers.
27 * Description: Implementation for the real mode software interrupt
30 ****************************************************************************/
33 #include "drvlib/os/os.h"
34 #include "sdd/sddhelp.h"
38 /*----------------------------- Implementation ----------------------------*/
40 /****************************************************************************
42 We do have limited BIOS access under Windows NT device drivers.
43 ****************************************************************************/
44 ibool PMAPI PM_haveBIOSAccess(void)
46 /* Return false unless we have full buffer passing! */
50 /****************************************************************************
52 len - Place to store the length of the buffer
53 rseg - Place to store the real mode segment of the buffer
54 roff - Place to store the real mode offset of the buffer
57 This function returns the address and length of the global VESA transfer
58 buffer that is used for communicating with the VESA BIOS functions from
59 Win16 and Win32 programs under Windows.
60 ****************************************************************************/
61 void * PMAPI PM_getVESABuf(
66 /* No buffers supported under Windows NT (Windows XP has them however if */
67 /* we ever decide to support this!) */
71 /****************************************************************************
73 Issue a protected mode software interrupt.
74 ****************************************************************************/
82 return PM_int386x(intno,in,out,&sregs);
85 /****************************************************************************
87 Map a real mode pointer to a protected mode pointer.
88 ****************************************************************************/
89 void * PMAPI PM_mapRealPointer(
93 /* Not used for Windows NT drivers! */
97 /****************************************************************************
99 Allocate a block of real mode memory
100 ****************************************************************************/
101 void * PMAPI PM_allocRealSeg(
106 /* Not supported in NT drivers */
113 /****************************************************************************
115 Free a block of real mode memory.
116 ****************************************************************************/
117 void PMAPI PM_freeRealSeg(
120 /* Not supported in NT drivers */
124 /****************************************************************************
126 Issue a real mode interrupt (parameters in DPMI compatible structure)
127 ****************************************************************************/
128 void PMAPI DPMI_int86(
132 /* Not used in NT drivers */
135 /****************************************************************************
137 Call a V86 real mode function with the specified register values
138 loaded before the call. The call returns with a far ret.
139 ****************************************************************************/
140 void PMAPI PM_callRealMode(
148 CLIENT_STRUCT saveRegs;
150 /* Bail if we do not have BIOS access (ie: the VxD was dynamically
151 * loaded, and not statically loaded.
156 TRACE("SDDHELP: Entering PM_callRealMode()\n");
157 Begin_Nest_V86_Exec();
158 LoadV86Registers(&saveRegs,regs,sregs);
159 Simulate_Far_Call(seg, off);
161 ReadV86Registers(&saveRegs,regs,sregs);
163 TRACE("SDDHELP: Exiting PM_callRealMode()\n");
167 /****************************************************************************
169 Issue a V86 real mode interrupt with the specified register values
170 loaded before the interrupt.
171 ****************************************************************************/
180 CLIENT_STRUCT saveRegs;
183 /* Disable pass-up to our VxD handler so we directly call BIOS */
184 TRACE("SDDHELP: Entering PM_int86()\n");
185 if (disableTSRFlag) {
186 oldDisable = *disableTSRFlag;
189 Begin_Nest_V86_Exec();
190 LoadV86Registers(&saveRegs,in,&sregs);
192 ReadV86Registers(&saveRegs,out,&sregs);
195 /* Re-enable pass-up to our VxD handler if previously enabled */
197 *disableTSRFlag = oldDisable;
199 TRACE("SDDHELP: Exiting PM_int86()\n");
206 /****************************************************************************
208 Issue a V86 real mode interrupt with the specified register values
209 loaded before the interrupt.
210 ****************************************************************************/
219 CLIENT_STRUCT saveRegs;
222 /* Bail if we do not have BIOS access (ie: the VxD was dynamically
223 * loaded, and not statically loaded.
230 /* Disable pass-up to our VxD handler so we directly call BIOS */
231 TRACE("SDDHELP: Entering PM_int86x()\n");
232 if (disableTSRFlag) {
233 oldDisable = *disableTSRFlag;
236 Begin_Nest_V86_Exec();
237 LoadV86Registers(&saveRegs,in,sregs);
239 ReadV86Registers(&saveRegs,out,sregs);
242 /* Re-enable pass-up to our VxD handler if previously enabled */
244 *disableTSRFlag = oldDisable;
246 TRACE("SDDHELP: Exiting PM_int86x()\n");