2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/nt/vdm.c
5 * PURPOSE: Virtual DOS machine support
6 * PROGRAMMER: David Welch (welch@mcmail.com)
11 /* INCLUDES *****************************************************************/
14 #include <internal/debug.h>
16 /* GLOBALS *******************************************************************/
18 static UCHAR OrigIVT
[1024];
19 static UCHAR OrigBDA
[256];
20 /* static UCHAR OrigEBDA[]; */
22 extern VOID
Ki386RetToV86Mode(PKV86M_REGISTERS InRegs
,
23 PKV86M_REGISTERS OutRegs
);
25 /* FUNCTIONS *****************************************************************/
30 /* GCC 3.4 warns if NULL is passed in parameter 2 to the standard function memcpy */
31 PVOID start
= (PVOID
)0x0;
34 * Save various BIOS data tables. At this point the lower 4MB memory
35 * map is still active so we can just copy the data from low memory.
37 memcpy(OrigIVT
, start
, 1024);
38 memcpy(OrigBDA
, (PVOID
)0x400, 256);
44 NTSTATUS STDCALL
NtVdmControl(ULONG ControlCode
,
50 memcpy(ControlData
, OrigIVT
, 1024);
54 memcpy(ControlData
, OrigBDA
, 256);
59 KV86M_REGISTERS V86Registers
;
62 ret
= MmCopyFromCaller(&V86Registers
,
64 sizeof(KV86M_REGISTERS
));
65 if(!NT_SUCCESS(ret
)) return ret
;
67 KeGetCurrentProcess()->NtVdmFlag
= 1;
68 Ki386RetToV86Mode(&V86Registers
, &V86Registers
);
69 KeGetCurrentProcess()->NtVdmFlag
= 0;
71 ret
= MmCopyToCaller(ControlData
,
73 sizeof(KV86M_REGISTERS
));
74 if(!NT_SUCCESS(ret
)) return ret
;
79 return(STATUS_SUCCESS
);