ReactOS 0.4.16-dev-2491-g3dc6630
int10.c
Go to the documentation of this file.
1/*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include "videoprt.h"
23
24#include <ndk/kefuncs.h>
25#include <ndk/mmfuncs.h>
26
27#define NDEBUG
28#include <debug.h>
29
30/* GLOBAL VARIABLES ***********************************************************/
31
32#ifdef _M_IX86
33/* Use the 32-bit x86 emulator by default, on NT 6.x (Vista+), or on NT 5.x
34 * if the HAL has the necessary exports. Otherwise fall back to V86 mode. */
35BOOLEAN VideoPortDisableX86Emulator = FALSE;
36
37/* Tells whether the video address space has been initialized for VDM calls */
38static BOOLEAN VDMAddressSpaceInitialized = FALSE;
39#endif
40
42
43
44/* X86 EMULATOR & V86 MODE INITIALIZATION *************************************/
45
46#if (NTDDI_VERSION < NTDDI_VISTA) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
47/*
48 * x86 Emulator callbacks
49 */
50#include <ndk/haltypes.h> // For X86_BIOS_REGISTERS
51
52static BOOLEAN
54 _In_ ULONG InterruptNumber,
56
57static NTSTATUS
62
63static NTSTATUS
67
68static NTSTATUS
74
75static NTSTATUS
81
82#else // (NTDDI_VERSION >= NTDDI_VISTA) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA)
83#include <ndk/halfuncs.h> // For x86Bios*()
84#endif
85
86static BOOLEAN
88{
89#if (NTDDI_VERSION < NTDDI_VISTA) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
90 UNICODE_STRING ImportName;
91#define LOAD_IMPORT(func) \
92 (RtlInitUnicodeString(&ImportName, L ## #func), \
93 (func) = MmGetSystemRoutineAddress(&ImportName))
94
95 if (!LOAD_IMPORT(x86BiosCall)) // Check also HalInitializeBios ?
96 return FALSE; /* No emulator available */
97 if (!LOAD_IMPORT(x86BiosAllocateBuffer))
98 return FALSE;
99 if (!LOAD_IMPORT(x86BiosFreeBuffer))
100 return FALSE;
101 if (!LOAD_IMPORT(x86BiosReadMemory))
102 return FALSE;
103 if (!LOAD_IMPORT(x86BiosWriteMemory))
104 return FALSE;
105#undef LOAD_IMPORT
106#endif
107
108 return TRUE;
109}
110
111#ifdef _M_IX86
112
113#define IsLowV86Mem(_Seg, _Off) ((((_Seg) << 4) + (_Off)) < (0xa0000))
114
115/* Those two functions below are there so that CSRSS can't access low mem.
116 * Especially, MAKE IT CRASH ON NULL ACCESS */
117static VOID
118ProtectLowV86Mem(VOID)
119{
120 /* We pass a non-NULL address so that ZwAllocateVirtualMemory really does it
121 * And we truncate one page to get the right range spanned. */
124 SIZE_T ViewSize = 0xa0000 - PAGE_SIZE;
125
126 /* We should only do that for CSRSS */
128
129 /* Commit (again) the pages, but with PAGE_NOACCESS protection */
130 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
132 0,
133 &ViewSize,
137}
138
139static VOID
140UnprotectLowV86Mem(VOID)
141{
142 /* We pass a non-NULL address so that ZwAllocateVirtualMemory really does it
143 * And we truncate one page to get the right range spanned. */
146 SIZE_T ViewSize = 0xa0000 - PAGE_SIZE;
147
148 /* We should only do that for CSRSS, for the v86 address space */
150
151 /* Commit (again) the pages, but with PAGE_READWRITE protection */
152 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
154 0,
155 &ViewSize,
159}
160
161static inline
163IntInitializeVideoAddressSpace(VOID)
164{
166 UNICODE_STRING PhysMemName = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
168 HANDLE PhysMemHandle;
172 CHAR IVTAndBda[1024 + 256];
173
174 /* We should only do that for CSRSS */
176
177 /* Free the 1MB pre-reserved region. In reality, ReactOS should simply
178 * support us mapping the view into the reserved area, but it doesn't. */
179 BaseAddress = 0;
180 ViewSize = 1024 * 1024;
181 Status = ZwFreeVirtualMemory(NtCurrentProcess(),
183 &ViewSize,
185 if (!NT_SUCCESS(Status))
186 {
187 DPRINT1("Couldn't unmap reserved memory (%x)\n", Status);
188 return Status;
189 }
190
191 /* Open the physical memory section */
193 &PhysMemName,
195 NULL,
196 NULL);
197 Status = ZwOpenSection(&PhysMemHandle,
200 if (!NT_SUCCESS(Status))
201 {
202 DPRINT1("Couldn't open \\Device\\PhysicalMemory\n");
203 return Status;
204 }
205
206 /* Map the BIOS and device registers into the address space */
207 Offset.QuadPart = 0xa0000;
208 ViewSize = 0x100000 - 0xa0000;
209 BaseAddress = (PVOID)0xa0000;
210 Status = ZwMapViewOfSection(PhysMemHandle,
213 0,
214 ViewSize,
215 &Offset,
216 &ViewSize,
217 ViewUnmap,
218 0,
220 if (!NT_SUCCESS(Status))
221 {
222 DPRINT1("Couldn't map physical memory (%x)\n", Status);
223 ZwClose(PhysMemHandle);
224 return Status;
225 }
226
227 /* Close physical memory section handle */
228 ZwClose(PhysMemHandle);
229
230 if (BaseAddress != (PVOID)0xa0000)
231 {
232 DPRINT1("Couldn't map physical memory at the right address (was %x)\n",
234 return STATUS_UNSUCCESSFUL;
235 }
236
237 /* Allocate some low memory to use for the non-BIOS
238 * parts of the v86 mode address space
239 */
240 BaseAddress = (PVOID)0x1;
241 ViewSize = 0xa0000 - 0x1000;
242 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
244 0,
245 &ViewSize,
248 if (!NT_SUCCESS(Status))
249 {
250 DPRINT1("Failed to allocate virtual memory (Status %x)\n", Status);
251 return Status;
252 }
253 if (BaseAddress != (PVOID)0x0)
254 {
255 DPRINT1("Failed to allocate virtual memory at right address (was %x)\n",
257 return STATUS_UNSUCCESSFUL;
258 }
259
260 /* Get the real mode IVT and BDA from the kernel */
261 Status = NtVdmControl(VdmInitialize, IVTAndBda);
262 if (!NT_SUCCESS(Status))
263 {
264 DPRINT1("NtVdmControl failed (status %x)\n", Status);
265 return Status;
266 }
267
268 /* Protect the V86 address space after this */
269 ProtectLowV86Mem();
270
271 /* Return success */
272 VDMAddressSpaceInitialized = TRUE;
273 return STATUS_SUCCESS;
274}
275
276#endif // _M_IX86
277
278
279/* VideoPortServicesInt10 CALLBACKS *******************************************/
280
281#ifdef _M_IX86
282typedef struct _INT10_INTERFACE
283{
284 PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
285 PINT10_FREE_BUFFER Int10FreeBuffer;
286 PINT10_READ_MEMORY Int10ReadMemory;
287 PINT10_WRITE_MEMORY Int10WriteMemory;
288 PINT10_CALL_BIOS Int10CallBios;
289} INT10_INTERFACE;
290
291// Remark: Instead of `Int10Vtbl->`, one could use: `Int10IFace[VideoPortDisableX86Emulator].`
292static const INT10_INTERFACE *Int10Vtbl; // Int10IFace[2];
293#define INT10(func) Int10Vtbl->Int10##func
294#else
295#define INT10(func) IntInt10##func##Emu
296#endif // _M_IX86
297
298
299static VP_STATUS
300NTAPI
303 _Out_ PUSHORT Seg,
306{
308
310
313}
314
315#ifdef _M_IX86
316static VP_STATUS
317NTAPI
318IntInt10AllocateBufferV86(
320 _Out_ PUSHORT Seg,
323{
325 PVOID MemoryAddress;
326 PKPROCESS CallingProcess;
328 SIZE_T Size;
329
331
332 /* Perform the call in the CSRSS context */
333 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
335
336 Size = *Length;
337 MemoryAddress = (PVOID)0x20000;
338
339 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
340 &MemoryAddress,
341 0,
342 &Size,
345 if (!NT_SUCCESS(Status))
346 {
347 WARN_(VIDEOPRT, "- ZwAllocateVirtualMemory failed\n");
348 IntDetachFromCSRSS(CallingProcess, &ApcState);
350 }
351
352 if (MemoryAddress > (PVOID)(0x100000 - Size))
353 {
354 ZwFreeVirtualMemory(NtCurrentProcess(),
355 &MemoryAddress,
356 &Size,
358 WARN_(VIDEOPRT, "- Unacceptable memory allocated\n");
359 IntDetachFromCSRSS(CallingProcess, &ApcState);
361 }
362
363 IntDetachFromCSRSS(CallingProcess, &ApcState);
364
365 *Length = (ULONG)Size;
366 *Seg = (USHORT)((ULONG_PTR)MemoryAddress >> 4);
367 *Off = (USHORT)((ULONG_PTR)MemoryAddress & 0xF);
368
369 return NO_ERROR;
370}
371#endif // _M_IX86
372
374NTAPI
377 _Out_ PUSHORT Seg,
380{
382
383 TRACE_(VIDEOPRT, "IntInt10AllocateBuffer\n");
384
385 Status = INT10(AllocateBuffer)(Context, Seg, Off, Length);
386 if (Status == NO_ERROR)
387 {
388 INFO_(VIDEOPRT, "- Segment: 0x%x\n", *Seg);
389 INFO_(VIDEOPRT, "- Offset : 0x%x\n", *Off);
390 INFO_(VIDEOPRT, "- Length : 0x%x\n", *Length);
391 }
392 return Status;
393}
394
395
396static VP_STATUS
397NTAPI
400 _In_ USHORT Seg,
402{
404
406
409}
410
411#ifdef _M_IX86
412static VP_STATUS
413NTAPI
414IntInt10FreeBufferV86(
416 _In_ USHORT Seg,
418{
420 PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
421 PKPROCESS CallingProcess;
423 SIZE_T Size = 0;
424
426
427 /* Perform the call in the CSRSS context */
428 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
430
431 Status = ZwFreeVirtualMemory(NtCurrentProcess(),
432 &MemoryAddress,
433 &Size,
435
436 IntDetachFromCSRSS(CallingProcess, &ApcState);
437
438 return Status;
439}
440#endif // _M_IX86
441
443NTAPI
446 _In_ USHORT Seg,
448{
449 TRACE_(VIDEOPRT, "IntInt10FreeBuffer\n");
450 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
451 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
452
453 return INT10(FreeBuffer)(Context, Seg, Off);
454}
455
456
457static VP_STATUS
458NTAPI
461 _In_ USHORT Seg,
465{
467
469
472}
473
474#ifdef _M_IX86
475static VP_STATUS
476NTAPI
477IntInt10ReadMemoryV86(
479 _In_ USHORT Seg,
483{
484 PKPROCESS CallingProcess;
486
488
489 /* Perform the call in the CSRSS context */
490 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
492
493 if (IsLowV86Mem(Seg, Off))
494 UnprotectLowV86Mem();
495 RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)(Seg << 4) | Off), Length);
496 if (IsLowV86Mem(Seg, Off))
497 ProtectLowV86Mem();
498
499 IntDetachFromCSRSS(CallingProcess, &ApcState);
500
501 return NO_ERROR;
502}
503#endif // _M_IX86
504
506NTAPI
509 _In_ USHORT Seg,
513{
514 TRACE_(VIDEOPRT, "IntInt10ReadMemory\n");
515 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
516 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
517 INFO_(VIDEOPRT, "- Buffer : 0x%x\n", Buffer);
518 INFO_(VIDEOPRT, "- Length : 0x%x\n", Length);
519
520 return INT10(ReadMemory)(Context, Seg, Off, Buffer, Length);
521}
522
523
524static VP_STATUS
525NTAPI
528 _In_ USHORT Seg,
532{
534
536
539}
540
541#ifdef _M_IX86
542static VP_STATUS
543NTAPI
544IntInt10WriteMemoryV86(
546 _In_ USHORT Seg,
550{
551 PKPROCESS CallingProcess;
553
555
556 /* Perform the call in the CSRSS context */
557 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
559
560 if (IsLowV86Mem(Seg, Off))
561 UnprotectLowV86Mem();
562 RtlCopyMemory((PVOID)((ULONG_PTR)(Seg << 4) | Off), Buffer, Length);
563 if (IsLowV86Mem(Seg, Off))
564 ProtectLowV86Mem();
565
566 IntDetachFromCSRSS(CallingProcess, &ApcState);
567
568 return NO_ERROR;
569}
570#endif // _M_IX86
571
573NTAPI
576 _In_ USHORT Seg,
580{
581 TRACE_(VIDEOPRT, "IntInt10WriteMemory\n");
582 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
583 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
584 INFO_(VIDEOPRT, "- Buffer : 0x%x\n", Buffer);
585 INFO_(VIDEOPRT, "- Length : 0x%x\n", Length);
586
587 return INT10(WriteMemory)(Context, Seg, Off, Buffer, Length);
588}
589
590
591static VP_STATUS
592NTAPI
595 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
596{
599
601
602#ifdef _M_IX86
603 if (!VDMAddressSpaceInitialized)
604 {
605 /* There are buggy 3rd-party miniport drivers that invoke the Int10 service
606 * in their initialization routine, before the VDM address space has been
607 * mapped and Ke386CallBios() can be called. They would therefore hit this
608 * ASSERT. Instead, disable it, log an error and bail out. */
609 //ASSERT(FALSE);
610 ERR_(VIDEOPRT, "Warning: Attempt to call %s before Int10 support is initialized.\n", __FUNCTION__);
612 }
613#endif
614
615 /* Clear the context and fill out the BIOS arguments */
617 BiosContext.Eax = BiosArguments->Eax;
618 BiosContext.Ebx = BiosArguments->Ebx;
619 BiosContext.Ecx = BiosArguments->Ecx;
620 BiosContext.Edx = BiosArguments->Edx;
621 BiosContext.Esi = BiosArguments->Esi;
622 BiosContext.Edi = BiosArguments->Edi;
623 BiosContext.Ebp = BiosArguments->Ebp;
624 BiosContext.SegDs = BiosArguments->SegDs;
625 BiosContext.SegEs = BiosArguments->SegEs;
626
627 /* Do the ROM BIOS call */
629 Executive,
631 FALSE,
632 NULL);
633
635
637
638 /* Return the arguments */
639 BiosArguments->Eax = BiosContext.Eax;
640 BiosArguments->Ebx = BiosContext.Ebx;
641 BiosArguments->Ecx = BiosContext.Ecx;
642 BiosArguments->Edx = BiosContext.Edx;
643 BiosArguments->Esi = BiosContext.Esi;
644 BiosArguments->Edi = BiosContext.Edi;
645 BiosArguments->Ebp = BiosContext.Ebp;
646 BiosArguments->SegDs = (USHORT)BiosContext.SegDs;
647 BiosArguments->SegEs = (USHORT)BiosContext.SegEs;
648
650}
651
652#ifdef _M_IX86
653static VP_STATUS
654NTAPI
655IntInt10CallBiosV86(
657 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
658{
661 PKPROCESS CallingProcess;
663
665
666 if (!VDMAddressSpaceInitialized)
667 {
668 /* There are buggy 3rd-party miniport drivers that invoke the Int10 service
669 * in their initialization routine, before the VDM address space has been
670 * mapped and Ke386CallBios() can be called. They would therefore hit this
671 * ASSERT. Instead, disable it, log an error and bail out. */
672 //ASSERT(FALSE);
673 ERR_(VIDEOPRT, "Warning: Attempt to call %s before Int10 support is initialized.\n", __FUNCTION__);
675 }
676
677 /* Clear the context and fill out the BIOS arguments */
679 BiosContext.Eax = BiosArguments->Eax;
680 BiosContext.Ebx = BiosArguments->Ebx;
681 BiosContext.Ecx = BiosArguments->Ecx;
682 BiosContext.Edx = BiosArguments->Edx;
683 BiosContext.Esi = BiosArguments->Esi;
684 BiosContext.Edi = BiosArguments->Edi;
685 BiosContext.Ebp = BiosArguments->Ebp;
686 BiosContext.SegDs = BiosArguments->SegDs;
687 BiosContext.SegEs = BiosArguments->SegEs;
688
689 /* Perform the call in the CSRSS context */
690 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
692
693 /* Do the ROM BIOS call */
695 Executive,
697 FALSE,
698 NULL);
699
700 /* The kernel needs access here */
701 UnprotectLowV86Mem();
702
703 /* Invoke the V86 monitor under SEH, as it can raise exceptions */
705 {
707 }
709 {
711 }
712 _SEH2_END;
713
714 ProtectLowV86Mem();
715
717
718 IntDetachFromCSRSS(CallingProcess, &ApcState);
719
720 /* Return the arguments */
721 BiosArguments->Eax = BiosContext.Eax;
722 BiosArguments->Ebx = BiosContext.Ebx;
723 BiosArguments->Ecx = BiosContext.Ecx;
724 BiosArguments->Edx = BiosContext.Edx;
725 BiosArguments->Esi = BiosContext.Esi;
726 BiosArguments->Edi = BiosContext.Edi;
727 BiosArguments->Ebp = BiosContext.Ebp;
728 BiosArguments->SegDs = (USHORT)BiosContext.SegDs;
729 BiosArguments->SegEs = (USHORT)BiosContext.SegEs;
730
732}
733#endif // _M_IX86
734
736NTAPI
739 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
740{
741 return INT10(CallBios)(Context, BiosArguments);
742}
743
744
745#ifdef _M_IX86
746static const INT10_INTERFACE Int10IFace[2] =
752 ,
753 { IntInt10AllocateBufferV86,
754 IntInt10FreeBufferV86,
755 IntInt10ReadMemoryV86,
756 IntInt10WriteMemoryV86,
757 IntInt10CallBiosV86 }
758};
759static const INT10_INTERFACE *Int10Vtbl = &Int10IFace[0];
760#endif
761
762
763/* PRIVATE FUNCTIONS **********************************************************/
764
767{
768 static BOOLEAN FirstInitialization = FALSE;
769
770 if (!FirstInitialization)
771 {
772 FirstInitialization = TRUE;
773#ifdef _M_IX86
774 /* Initialize the x86 emulator if necessary, otherwise fall back to V86 mode */
775 if (!VideoPortDisableX86Emulator)
776 {
777 /* Use the emulation routines */
778 //Int10Vtbl = &Int10IFace[0];
780 return STATUS_SUCCESS;
781 DPRINT1("Could not initialize the x86 emulator; falling back to V86 mode\n");
782 VideoPortDisableX86Emulator = TRUE;
783 }
784
785 /* Fall back to the V86 routines */
786 Int10Vtbl = &Int10IFace[1];
787 return STATUS_SUCCESS;
788#else
789 /* Initialize the x86 emulator */
791#endif
792 }
793
794 /* We should only do that for CSRSS */
796#ifdef _M_IX86
797 return IntInitializeVideoAddressSpace();
798#else
799 return STATUS_SUCCESS;
800#endif
801}
802
803
804/* PUBLIC FUNCTIONS ***********************************************************/
805
806/*
807 * @implemented
808 */
810NTAPI
812 IN PVOID HwDeviceExtension,
813 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
814{
816 INT10_BIOS_ARGUMENTS Int10BiosArguments;
817
818 /* Copy arguments to other format */
819 RtlCopyMemory(&Int10BiosArguments, BiosArguments, sizeof(*BiosArguments));
820 Int10BiosArguments.SegDs = 0;
821 Int10BiosArguments.SegEs = 0;
822
823 /* Do the BIOS call */
824 Status = IntInt10CallBios(NULL, &Int10BiosArguments);
825
826 /* Copy results back */
827 RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(*BiosArguments));
828
829 return Status;
830}
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
CALLBACK16 BiosContext
Definition: bios32.c:45
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define NTSTATUS
Definition: precomp.h:19
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRACE_(x)
Definition: compat.h:76
#define L(x)
Definition: resources.c:13
#define __FUNCTION__
Definition: types.h:116
#define PAGE_SIZE
Definition: env_spec_w32.h:49
@ Success
Definition: eventcreate.c:712
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
NTSTATUS IntInitializeInt10(VOID)
Definition: int10.c:766
VP_STATUS NTAPI IntInt10CallBios(_In_ PVOID Context, _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:737
VP_STATUS NTAPI IntInt10WriteMemory(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
Definition: int10.c:574
#define INT10(func)
Definition: int10.c:295
VP_STATUS NTAPI VideoPortInt10(IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:811
static VP_STATUS NTAPI IntInt10AllocateBufferEmu(_In_ PVOID Context, _Out_ PUSHORT Seg, _Out_ PUSHORT Off, _Inout_ PULONG Length)
Definition: int10.c:301
VP_STATUS NTAPI IntInt10AllocateBuffer(_In_ PVOID Context, _Out_ PUSHORT Seg, _Out_ PUSHORT Off, _Inout_ PULONG Length)
Definition: int10.c:375
static VP_STATUS NTAPI IntInt10ReadMemoryEmu(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
Definition: int10.c:459
static VP_STATUS NTAPI IntInt10FreeBufferEmu(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off)
Definition: int10.c:398
static BOOLEAN IntInitializeX86Emu(VOID)
Definition: int10.c:87
static VP_STATUS NTAPI IntInt10WriteMemoryEmu(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
Definition: int10.c:526
KMUTEX VideoPortInt10Mutex
Definition: int10.c:41
VP_STATUS NTAPI IntInt10ReadMemory(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
Definition: int10.c:507
VP_STATUS NTAPI IntInt10FreeBuffer(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off)
Definition: int10.c:444
static VP_STATUS NTAPI IntInt10CallBiosEmu(_In_ PVOID Context, _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:593
#define ASSERT(a)
Definition: mode.c:44
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KernelMode
Definition: asm.h:38
@ VdmInitialize
Definition: ketypes.h:475
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _Out_writes_bytes_(s)
Definition: no_sal2.h:178
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1296
#define NtCurrentProcess()
Definition: nt_native.h:1660
@ ViewUnmap
Definition: nt_native.h:1282
#define MEM_RESERVE
Definition: nt_native.h:1317
#define MEM_RELEASE
Definition: nt_native.h:1319
#define MEM_COMMIT
Definition: nt_native.h:1316
#define PAGE_NOACCESS
Definition: nt_native.h:1305
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1311
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1769
NTSTATUS NTAPI NtVdmControl(IN ULONG ControlCode, IN PVOID ControlData)
Definition: stubs.c:198
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define BOOLEAN
Definition: pedump.c:73
unsigned short USHORT
Definition: pedump.c:61
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
LONG VP_STATUS
Definition: video.h:153
VP_STATUS(NTAPI * PINT10_CALL_BIOS)(IN PVOID Context, IN OUT PINT10_BIOS_ARGUMENTS BiosArguments)
Definition: video.h:446
VP_STATUS(NTAPI * PINT10_ALLOCATE_BUFFER)(IN PVOID Context, OUT PUSHORT Seg, OUT PUSHORT Off, IN OUT PULONG Length)
Definition: video.h:451
VP_STATUS(NTAPI * PINT10_FREE_BUFFER)(IN PVOID Context, IN USHORT Seg, IN USHORT Off)
Definition: video.h:458
VP_STATUS(NTAPI * PINT10_WRITE_MEMORY)(IN PVOID Context, IN USHORT Seg, IN USHORT Off, IN PVOID Buffer, IN ULONG Length)
Definition: video.h:472
VP_STATUS(NTAPI * PINT10_READ_MEMORY)(IN PVOID Context, IN USHORT Seg, IN USHORT Off, OUT PVOID Buffer, IN ULONG Length)
Definition: video.h:464
#define INFO_(ch,...)
Definition: debug.h:159
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ PVOID Context
Definition: storport.h:2269
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI Ke386CallBios(IN ULONG Int, OUT PCONTEXT Context)
Definition: v86vdm.c:628
PKPROCESS CsrProcess
Definition: videoprt.c:39
VOID FASTCALL IntDetachFromCSRSS(_In_ PKPROCESS CallingProcess, _In_ PKAPC_STATE ApcState)
Detach the current thread from the CSRSS process. This routine is to be invoked after a previous succ...
Definition: videoprt.c:763
BOOLEAN FASTCALL IntAttachToCSRSS(_Outptr_ PKPROCESS *CallingProcess, _Out_ PKAPC_STATE ApcState)
Attach the current thread to the CSRSS process. The caller must detach from the process by invoking I...
Definition: videoprt.c:736
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY ReadMemory
Definition: wdfusb.h:2000
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY WriteMemory
Definition: wdfusb.h:1918
NTSTATUS NTAPI x86BiosAllocateBuffer(_Inout_ ULONG *Size, _Out_ USHORT *Segment, _Out_ USHORT *Offset)
Definition: x86bios.c:151
NTSTATUS NTAPI x86BiosFreeBuffer(_In_ USHORT Segment, _In_ USHORT Offset)
Definition: x86bios.c:180
NTSTATUS NTAPI x86BiosReadMemory(_In_ USHORT Segment, _In_ USHORT Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
Definition: x86bios.c:204
BOOLEAN NTAPI x86BiosCall(_In_ ULONG InterruptNumber, _Inout_ PX86_BIOS_REGISTERS Registers)
Definition: x86bios.c:410
NTSTATUS NTAPI x86BiosWriteMemory(_In_ USHORT Segment, _In_ USHORT Offset, _In_reads_bytes_(Size) PVOID Buffer, _In_ ULONG Size)
Definition: x86bios.c:231
_Inout_ PVOID Segment
Definition: exfuncs.h:1101
#define KeWaitForMutexObject
Definition: kefuncs.h:543
@ Executive
Definition: ketypes.h:467
KAPC_STATE
Definition: ketypes.h:1711
#define PsGetCurrentProcess
Definition: psfuncs.h:17
char CHAR
Definition: xmlstorage.h:175