ReactOS 0.4.16-dev-1946-g52006dd
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#endif
37
39
40
41/* X86 EMULATOR & V86 MODE INITIALIZATION *************************************/
42
43#if (NTDDI_VERSION < NTDDI_VISTA) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
44/*
45 * x86 Emulator callbacks
46 */
47#include <ndk/haltypes.h> // For X86_BIOS_REGISTERS
48
49static BOOLEAN
51 _In_ ULONG InterruptNumber,
53
54static NTSTATUS
59
60static NTSTATUS
64
65static NTSTATUS
71
72static NTSTATUS
78
79#else // (NTDDI_VERSION >= NTDDI_VISTA) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA)
80#include <ndk/halfuncs.h> // For x86Bios*()
81#endif
82
83static BOOLEAN
85{
86#if (NTDDI_VERSION < NTDDI_VISTA) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
87 UNICODE_STRING ImportName;
88#define LOAD_IMPORT(func) \
89 (RtlInitUnicodeString(&ImportName, L ## #func), \
90 (func) = MmGetSystemRoutineAddress(&ImportName))
91
92 if (!LOAD_IMPORT(x86BiosCall)) // Check also HalInitializeBios ?
93 return FALSE; /* No emulator available */
94 if (!LOAD_IMPORT(x86BiosAllocateBuffer))
95 return FALSE;
96 if (!LOAD_IMPORT(x86BiosFreeBuffer))
97 return FALSE;
98 if (!LOAD_IMPORT(x86BiosReadMemory))
99 return FALSE;
100 if (!LOAD_IMPORT(x86BiosWriteMemory))
101 return FALSE;
102#undef LOAD_IMPORT
103#endif
104
105 return TRUE;
106}
107
108#ifdef _M_IX86
109
110#define IsLowV86Mem(_Seg, _Off) ((((_Seg) << 4) + (_Off)) < (0xa0000))
111
112/* Those two functions below are there so that CSRSS can't access low mem.
113 * Especially, MAKE IT CRASH ON NULL ACCESS */
114static VOID
115ProtectLowV86Mem(VOID)
116{
117 /* We pass a non-NULL address so that ZwAllocateVirtualMemory really does it
118 * And we truncate one page to get the right range spanned. */
121 SIZE_T ViewSize = 0xa0000 - PAGE_SIZE;
122
123 /* We should only do that for CSRSS */
125
126 /* Commit (again) the pages, but with PAGE_NOACCESS protection */
127 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
129 0,
130 &ViewSize,
134}
135
136static VOID
137UnprotectLowV86Mem(VOID)
138{
139 /* We pass a non-NULL address so that ZwAllocateVirtualMemory really does it
140 * And we truncate one page to get the right range spanned. */
143 SIZE_T ViewSize = 0xa0000 - PAGE_SIZE;
144
145 /* We should only do that for CSRSS, for the v86 address space */
147
148 /* Commit (again) the pages, but with PAGE_READWRITE protection */
149 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
151 0,
152 &ViewSize,
156}
157
158static inline
160IntInitializeVideoAddressSpace(VOID)
161{
163 UNICODE_STRING PhysMemName = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
165 HANDLE PhysMemHandle;
169 CHAR IVTAndBda[1024 + 256];
170
171 /* We should only do that for CSRSS */
173
174 /* Free the 1MB pre-reserved region. In reality, ReactOS should simply support us mapping the view into the reserved area, but it doesn't. */
175 BaseAddress = 0;
176 ViewSize = 1024 * 1024;
177 Status = ZwFreeVirtualMemory(NtCurrentProcess(),
179 &ViewSize,
181 if (!NT_SUCCESS(Status))
182 {
183 DPRINT1("Couldn't unmap reserved memory (%x)\n", Status);
184 return 0;
185 }
186
187 /* Open the physical memory section */
189 &PhysMemName,
191 NULL,
192 NULL);
193 Status = ZwOpenSection(&PhysMemHandle,
196 if (!NT_SUCCESS(Status))
197 {
198 DPRINT1("Couldn't open \\Device\\PhysicalMemory\n");
199 return Status;
200 }
201
202 /* Map the BIOS and device registers into the address space */
203 Offset.QuadPart = 0xa0000;
204 ViewSize = 0x100000 - 0xa0000;
205 BaseAddress = (PVOID)0xa0000;
206 Status = ZwMapViewOfSection(PhysMemHandle,
209 0,
210 ViewSize,
211 &Offset,
212 &ViewSize,
213 ViewUnmap,
214 0,
216 if (!NT_SUCCESS(Status))
217 {
218 DPRINT1("Couldn't map physical memory (%x)\n", Status);
219 ZwClose(PhysMemHandle);
220 return Status;
221 }
222
223 /* Close physical memory section handle */
224 ZwClose(PhysMemHandle);
225
226 if (BaseAddress != (PVOID)0xa0000)
227 {
228 DPRINT1("Couldn't map physical memory at the right address (was %x)\n",
230 return STATUS_UNSUCCESSFUL;
231 }
232
233 /* Allocate some low memory to use for the non-BIOS
234 * parts of the v86 mode address space
235 */
236 BaseAddress = (PVOID)0x1;
237 ViewSize = 0xa0000 - 0x1000;
238 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
240 0,
241 &ViewSize,
244 if (!NT_SUCCESS(Status))
245 {
246 DPRINT1("Failed to allocate virtual memory (Status %x)\n", Status);
247 return Status;
248 }
249 if (BaseAddress != (PVOID)0x0)
250 {
251 DPRINT1("Failed to allocate virtual memory at right address (was %x)\n",
253 return 0;
254 }
255
256 /* Get the real mode IVT and BDA from the kernel */
257 Status = NtVdmControl(VdmInitialize, IVTAndBda);
258 if (!NT_SUCCESS(Status))
259 {
260 DPRINT1("NtVdmControl failed (status %x)\n", Status);
261 return Status;
262 }
263
264 /* Protect the V86 address space after this */
265 ProtectLowV86Mem();
266
267 /* Return success */
268 return STATUS_SUCCESS;
269}
270
271#endif // _M_IX86
272
273
274/* VideoPortServicesInt10 CALLBACKS *******************************************/
275
276#ifdef _M_IX86
277typedef struct _INT10_INTERFACE
278{
279 PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
280 PINT10_FREE_BUFFER Int10FreeBuffer;
281 PINT10_READ_MEMORY Int10ReadMemory;
282 PINT10_WRITE_MEMORY Int10WriteMemory;
283 PINT10_CALL_BIOS Int10CallBios;
284} INT10_INTERFACE;
285
286// Remark: Instead of `Int10Vtbl->`, one could use: `Int10IFace[VideoPortDisableX86Emulator].`
287static const INT10_INTERFACE *Int10Vtbl; // Int10IFace[2];
288#define INT10(func) Int10Vtbl->Int10##func
289#else
290#define INT10(func) IntInt10##func##Emu
291#endif // _M_IX86
292
293
294static VP_STATUS
295NTAPI
298 _Out_ PUSHORT Seg,
299 _Out_ PUSHORT Off,
301{
303
305
308}
309
310#ifdef _M_IX86
311static VP_STATUS
312NTAPI
313IntInt10AllocateBufferV86(
315 _Out_ PUSHORT Seg,
316 _Out_ PUSHORT Off,
318{
320 PVOID MemoryAddress;
321 PKPROCESS CallingProcess;
323 SIZE_T Size;
324
326
327 /* Perform the call in the CSRSS context */
328 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
330
331 Size = *Length;
332 MemoryAddress = (PVOID)0x20000;
333
334 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
335 &MemoryAddress,
336 0,
337 &Size,
340 if (!NT_SUCCESS(Status))
341 {
342 WARN_(VIDEOPRT, "- ZwAllocateVirtualMemory failed\n");
343 IntDetachFromCSRSS(CallingProcess, &ApcState);
345 }
346
347 if (MemoryAddress > (PVOID)(0x100000 - Size))
348 {
349 ZwFreeVirtualMemory(NtCurrentProcess(),
350 &MemoryAddress,
351 &Size,
353 WARN_(VIDEOPRT, "- Unacceptable memory allocated\n");
354 IntDetachFromCSRSS(CallingProcess, &ApcState);
356 }
357
358 IntDetachFromCSRSS(CallingProcess, &ApcState);
359
360 *Length = (ULONG)Size;
361 *Seg = (USHORT)((ULONG_PTR)MemoryAddress >> 4);
362 *Off = (USHORT)((ULONG_PTR)MemoryAddress & 0xF);
363
364 return NO_ERROR;
365}
366#endif // _M_IX86
367
369NTAPI
372 _Out_ PUSHORT Seg,
373 _Out_ PUSHORT Off,
375{
377
378 TRACE_(VIDEOPRT, "IntInt10AllocateBuffer\n");
379
380 Status = INT10(AllocateBuffer)(Context, Seg, Off, Length);
381 if (Status == NO_ERROR)
382 {
383 INFO_(VIDEOPRT, "- Segment: 0x%x\n", *Seg);
384 INFO_(VIDEOPRT, "- Offset : 0x%x\n", *Off);
385 INFO_(VIDEOPRT, "- Length : 0x%x\n", *Length);
386 }
387 return Status;
388}
389
390
391static VP_STATUS
392NTAPI
395 _In_ USHORT Seg,
396 _In_ USHORT Off)
397{
399
401
402 Status = x86BiosFreeBuffer(Seg, Off);
404}
405
406#ifdef _M_IX86
407static VP_STATUS
408NTAPI
409IntInt10FreeBufferV86(
411 _In_ USHORT Seg,
412 _In_ USHORT Off)
413{
415 PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
416 PKPROCESS CallingProcess;
418 SIZE_T Size = 0;
419
421
422 /* Perform the call in the CSRSS context */
423 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
425
426 Status = ZwFreeVirtualMemory(NtCurrentProcess(),
427 &MemoryAddress,
428 &Size,
430
431 IntDetachFromCSRSS(CallingProcess, &ApcState);
432
433 return Status;
434}
435#endif // _M_IX86
436
438NTAPI
441 _In_ USHORT Seg,
442 _In_ USHORT Off)
443{
444 TRACE_(VIDEOPRT, "IntInt10FreeBuffer\n");
445 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
446 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
447
448 return INT10(FreeBuffer)(Context, Seg, Off);
449}
450
451
452static VP_STATUS
453NTAPI
456 _In_ USHORT Seg,
457 _In_ USHORT Off,
460{
462
464
467}
468
469#ifdef _M_IX86
470static VP_STATUS
471NTAPI
472IntInt10ReadMemoryV86(
474 _In_ USHORT Seg,
475 _In_ USHORT Off,
478{
479 PKPROCESS CallingProcess;
481
483
484 /* Perform the call in the CSRSS context */
485 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
487
488 if (IsLowV86Mem(Seg, Off))
489 UnprotectLowV86Mem();
490 RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)(Seg << 4) | Off), Length);
491 if (IsLowV86Mem(Seg, Off))
492 ProtectLowV86Mem();
493
494 IntDetachFromCSRSS(CallingProcess, &ApcState);
495
496 return NO_ERROR;
497}
498#endif // _M_IX86
499
501NTAPI
504 _In_ USHORT Seg,
505 _In_ USHORT Off,
508{
509 TRACE_(VIDEOPRT, "IntInt10ReadMemory\n");
510 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
511 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
512 INFO_(VIDEOPRT, "- Buffer : 0x%x\n", Buffer);
513 INFO_(VIDEOPRT, "- Length : 0x%x\n", Length);
514
515 return INT10(ReadMemory)(Context, Seg, Off, Buffer, Length);
516}
517
518
519static VP_STATUS
520NTAPI
523 _In_ USHORT Seg,
524 _In_ USHORT Off,
527{
529
531
534}
535
536#ifdef _M_IX86
537static VP_STATUS
538NTAPI
539IntInt10WriteMemoryV86(
541 _In_ USHORT Seg,
542 _In_ USHORT Off,
545{
546 PKPROCESS CallingProcess;
548
550
551 /* Perform the call in the CSRSS context */
552 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
554
555 if (IsLowV86Mem(Seg, Off))
556 UnprotectLowV86Mem();
557 RtlCopyMemory((PVOID)((ULONG_PTR)(Seg << 4) | Off), Buffer, Length);
558 if (IsLowV86Mem(Seg, Off))
559 ProtectLowV86Mem();
560
561 IntDetachFromCSRSS(CallingProcess, &ApcState);
562
563 return NO_ERROR;
564}
565#endif // _M_IX86
566
568NTAPI
571 _In_ USHORT Seg,
572 _In_ USHORT Off,
575{
576 TRACE_(VIDEOPRT, "IntInt10WriteMemory\n");
577 INFO_(VIDEOPRT, "- Segment: 0x%x\n", Seg);
578 INFO_(VIDEOPRT, "- Offset : 0x%x\n", Off);
579 INFO_(VIDEOPRT, "- Buffer : 0x%x\n", Buffer);
580 INFO_(VIDEOPRT, "- Length : 0x%x\n", Length);
581
582 return INT10(WriteMemory)(Context, Seg, Off, Buffer, Length);
583}
584
585
586static VP_STATUS
587NTAPI
590 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
591{
594
596
597 /* Clear the context and fill out the BIOS arguments */
599 BiosContext.Eax = BiosArguments->Eax;
600 BiosContext.Ebx = BiosArguments->Ebx;
601 BiosContext.Ecx = BiosArguments->Ecx;
602 BiosContext.Edx = BiosArguments->Edx;
603 BiosContext.Esi = BiosArguments->Esi;
604 BiosContext.Edi = BiosArguments->Edi;
605 BiosContext.Ebp = BiosArguments->Ebp;
606 BiosContext.SegDs = BiosArguments->SegDs;
607 BiosContext.SegEs = BiosArguments->SegEs;
608
609 /* Do the ROM BIOS call */
611 Executive,
613 FALSE,
614 NULL);
615
617
619
620 /* Return the arguments */
621 BiosArguments->Eax = BiosContext.Eax;
622 BiosArguments->Ebx = BiosContext.Ebx;
623 BiosArguments->Ecx = BiosContext.Ecx;
624 BiosArguments->Edx = BiosContext.Edx;
625 BiosArguments->Esi = BiosContext.Esi;
626 BiosArguments->Edi = BiosContext.Edi;
627 BiosArguments->Ebp = BiosContext.Ebp;
628 BiosArguments->SegDs = (USHORT)BiosContext.SegDs;
629 BiosArguments->SegEs = (USHORT)BiosContext.SegEs;
630
632}
633
634#ifdef _M_IX86
635static VP_STATUS
636NTAPI
637IntInt10CallBiosV86(
639 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
640{
643 PKPROCESS CallingProcess;
645
647
648 /* Clear the context and fill out the BIOS arguments */
650 BiosContext.Eax = BiosArguments->Eax;
651 BiosContext.Ebx = BiosArguments->Ebx;
652 BiosContext.Ecx = BiosArguments->Ecx;
653 BiosContext.Edx = BiosArguments->Edx;
654 BiosContext.Esi = BiosArguments->Esi;
655 BiosContext.Edi = BiosArguments->Edi;
656 BiosContext.Ebp = BiosArguments->Ebp;
657 BiosContext.SegDs = BiosArguments->SegDs;
658 BiosContext.SegEs = BiosArguments->SegEs;
659
660 /* Perform the call in the CSRSS context */
661 if (!IntAttachToCSRSS(&CallingProcess, &ApcState))
663
664 /* Do the ROM BIOS call */
666 Executive,
668 FALSE,
669 NULL);
670
671 /* The kernel needs access here */
672 UnprotectLowV86Mem();
673
674 /* Invoke the V86 monitor under SEH, as it can raise exceptions */
676 {
678 }
680 {
682 }
683 _SEH2_END;
684
685 ProtectLowV86Mem();
686
688
689 IntDetachFromCSRSS(CallingProcess, &ApcState);
690
691 /* Return the arguments */
692 BiosArguments->Eax = BiosContext.Eax;
693 BiosArguments->Ebx = BiosContext.Ebx;
694 BiosArguments->Ecx = BiosContext.Ecx;
695 BiosArguments->Edx = BiosContext.Edx;
696 BiosArguments->Esi = BiosContext.Esi;
697 BiosArguments->Edi = BiosContext.Edi;
698 BiosArguments->Ebp = BiosContext.Ebp;
699 BiosArguments->SegDs = (USHORT)BiosContext.SegDs;
700 BiosArguments->SegEs = (USHORT)BiosContext.SegEs;
701
703}
704#endif // _M_IX86
705
707NTAPI
710 _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
711{
712 return INT10(CallBios)(Context, BiosArguments);
713}
714
715
716#ifdef _M_IX86
717static const INT10_INTERFACE Int10IFace[2] =
723 ,
724 { IntInt10AllocateBufferV86,
725 IntInt10FreeBufferV86,
726 IntInt10ReadMemoryV86,
727 IntInt10WriteMemoryV86,
728 IntInt10CallBiosV86 }
729};
730static const INT10_INTERFACE *Int10Vtbl = &Int10IFace[0];
731#endif
732
733
734/* PRIVATE FUNCTIONS **********************************************************/
735
738{
739#ifdef _M_IX86
740 /* We should only do that for CSRSS */
742
743 /* Initialize the x86 emulator if necessary, otherwise fall back to V86 mode */
744 if (!VideoPortDisableX86Emulator)
745 {
746 /* Use the emulation routines */
747 //Int10Vtbl = &Int10IFace[0];
749 return STATUS_SUCCESS;
750 DPRINT1("Could not initialize the x86 emulator; falling back to V86 mode\n");
751 VideoPortDisableX86Emulator = TRUE;
752 }
753
754 /* Fall back to the V86 routines */
755 Int10Vtbl = &Int10IFace[1];
756 return IntInitializeVideoAddressSpace();
757#else
758 /* Initialize the x86 emulator */
760#endif
761}
762
763
764/* PUBLIC FUNCTIONS ***********************************************************/
765
766/*
767 * @implemented
768 */
770NTAPI
772 IN PVOID HwDeviceExtension,
773 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
774{
776 INT10_BIOS_ARGUMENTS Int10BiosArguments;
777
778 /* Copy arguments to other format */
779 RtlCopyMemory(&Int10BiosArguments, BiosArguments, sizeof(*BiosArguments));
780 Int10BiosArguments.SegDs = 0;
781 Int10BiosArguments.SegEs = 0;
782
783 /* Do the BIOS call */
784 Status = IntInt10CallBios(NULL, &Int10BiosArguments);
785
786 /* Copy results back */
787 RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(*BiosArguments));
788
789 return Status;
790}
unsigned char BOOLEAN
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 ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRACE_(x)
Definition: compat.h:76
#define L(x)
Definition: resources.c:13
#define PAGE_SIZE
Definition: env_spec_w32.h:49
@ Success
Definition: eventcreate.c:712
Status
Definition: gdiplustypes.h:25
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
NTSTATUS IntInitializeInt10(VOID)
Definition: int10.c:737
VP_STATUS NTAPI IntInt10CallBios(_In_ PVOID Context, _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:708
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:569
#define INT10(func)
Definition: int10.c:290
VP_STATUS NTAPI VideoPortInt10(IN PVOID HwDeviceExtension, IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:771
static VP_STATUS NTAPI IntInt10AllocateBufferEmu(_In_ PVOID Context, _Out_ PUSHORT Seg, _Out_ PUSHORT Off, _Inout_ PULONG Length)
Definition: int10.c:296
VP_STATUS NTAPI IntInt10AllocateBuffer(_In_ PVOID Context, _Out_ PUSHORT Seg, _Out_ PUSHORT Off, _Inout_ PULONG Length)
Definition: int10.c:370
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:454
static VP_STATUS NTAPI IntInt10FreeBufferEmu(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off)
Definition: int10.c:393
static BOOLEAN IntInitializeX86Emu(VOID)
Definition: int10.c:84
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:521
KMUTEX VideoPortInt10Mutex
Definition: int10.c:38
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:502
VP_STATUS NTAPI IntInt10FreeBuffer(_In_ PVOID Context, _In_ USHORT Seg, _In_ USHORT Off)
Definition: int10.c:439
static VP_STATUS NTAPI IntInt10CallBiosEmu(_In_ PVOID Context, _Inout_ PINT10_BIOS_ARGUMENTS BiosArguments)
Definition: int10.c:588
#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:1768
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 _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
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 WARN_(ch,...)
Definition: debug.h:157
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
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:616
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:589
_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