https://git.reactos.org/?p=reactos.git;a=commitdiff;h=826704ba6b1ea46795097…
commit 826704ba6b1ea46795097a1917e96f8fba4d7468
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Feb 11 19:22:30 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Aug 15 14:13:54 2019 +0200
[VIDEOPRT] Implement support for INT10 on x64 using the newly implemented HAL
functions.
---
win32ss/drivers/videoprt/dispatch.c | 8 +++++-
win32ss/drivers/videoprt/int10.c | 49 ++++++++++++++++++++++++++-----------
win32ss/drivers/videoprt/services.c | 3 +--
3 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/win32ss/drivers/videoprt/dispatch.c b/win32ss/drivers/videoprt/dispatch.c
index 34ae1074626..d1682549185 100644
--- a/win32ss/drivers/videoprt/dispatch.c
+++ b/win32ss/drivers/videoprt/dispatch.c
@@ -103,6 +103,7 @@ IntVideoPortDispatchOpen(
{
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
+ NTSTATUS Status;
TRACE_(VIDEOPRT, "IntVideoPortDispatchOpen\n");
@@ -117,7 +118,12 @@ IntVideoPortDispatchOpen(
Csrss = (PKPROCESS)PsGetCurrentProcess();
INFO_(VIDEOPRT, "Csrss %p\n", Csrss);
- IntInitializeVideoAddressSpace();
+ Status = IntInitializeVideoAddressSpace();
+ if (!NT_SUCCESS(Status))
+ {
+ ERR_(VIDEOPRT, "IntInitializeVideoAddressSpace() failed: 0x%lx\n",
Status);
+ return Status;
+ }
CsrssInitialized = TRUE;
}
diff --git a/win32ss/drivers/videoprt/int10.c b/win32ss/drivers/videoprt/int10.c
index 8b35709fbdb..35452501421 100644
--- a/win32ss/drivers/videoprt/int10.c
+++ b/win32ss/drivers/videoprt/int10.c
@@ -22,6 +22,7 @@
#include "videoprt.h"
#include <ndk/kefuncs.h>
+#include <ndk/halfuncs.h>
#define NDEBUG
#include <debug.h>
@@ -158,8 +159,9 @@ IntInt10AllocateBuffer(
OUT PUSHORT Off,
IN OUT PULONG Length)
{
- PVOID MemoryAddress;
NTSTATUS Status;
+#ifdef _M_IX86
+ PVOID MemoryAddress;
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
SIZE_T Size;
@@ -205,6 +207,10 @@ IntInt10AllocateBuffer(
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return NO_ERROR;
+#else
+ Status = x86BiosAllocateBuffer(Length, Seg, Off);
+ return NT_SUCCESS(Status) ? NO_ERROR : ERROR_NOT_ENOUGH_MEMORY;
+#endif
}
VP_STATUS
@@ -214,8 +220,9 @@ IntInt10FreeBuffer(
IN USHORT Seg,
IN USHORT Off)
{
- PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
NTSTATUS Status;
+#ifdef _M_IX86
+ PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
SIZE_T Size = 0;
@@ -233,6 +240,10 @@ IntInt10FreeBuffer(
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return Status;
+#else
+ Status = x86BiosFreeBuffer(Seg, Off);
+ return NT_SUCCESS(Status) ? NO_ERROR : ERROR_INVALID_PARAMETER;
+#endif
}
VP_STATUS
@@ -244,6 +255,7 @@ IntInt10ReadMemory(
OUT PVOID Buffer,
IN ULONG Length)
{
+#ifdef _M_IX86
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
@@ -258,6 +270,12 @@ IntInt10ReadMemory(
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return NO_ERROR;
+#else
+ NTSTATUS Status;
+
+ Status = x86BiosReadMemory(Seg, Off, Buffer, Length);
+ return NT_SUCCESS(Status) ? NO_ERROR : ERROR_INVALID_PARAMETER;
+#endif
}
VP_STATUS
@@ -269,6 +287,7 @@ IntInt10WriteMemory(
IN PVOID Buffer,
IN ULONG Length)
{
+#ifdef _M_IX86
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
@@ -283,16 +302,25 @@ IntInt10WriteMemory(
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return NO_ERROR;
+#else
+ NTSTATUS Status;
+
+ Status = x86BiosWriteMemory(Seg, Off, Buffer, Length);
+ return NT_SUCCESS(Status) ? NO_ERROR : ERROR_INVALID_PARAMETER;
+#endif
}
-#if defined(_M_IX86)
VP_STATUS
NTAPI
IntInt10CallBios(
IN PVOID Context,
IN OUT PINT10_BIOS_ARGUMENTS BiosArguments)
{
+#ifdef _M_AMD64
+ X86_BIOS_REGISTERS BiosContext;
+#else
CONTEXT BiosContext;
+#endif
NTSTATUS Status;
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
@@ -321,7 +349,11 @@ IntInt10CallBios(
FALSE,
NULL);
+#ifdef _M_AMD64
+ Status = x86BiosCall(0x10, &BiosContext) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
+#else
Status = Ke386CallBios(0x10, &BiosContext);
+#endif
KeReleaseMutex(&VideoPortInt10Mutex, FALSE);
@@ -346,17 +378,6 @@ IntInt10CallBios(
return ERROR_INVALID_PARAMETER;
}
-#else
-VP_STATUS
-NTAPI
-IntInt10CallBios(
- IN PVOID Context,
- IN OUT PINT10_BIOS_ARGUMENTS BiosArguments)
-{
- DPRINT1("Int10 not available on non-x86!\n");
- return ERROR_INVALID_FUNCTION;
-}
-#endif
/* PUBLIC FUNCTIONS ***********************************************************/
diff --git a/win32ss/drivers/videoprt/services.c b/win32ss/drivers/videoprt/services.c
index 18290c08d26..93a7a8fc6c8 100644
--- a/win32ss/drivers/videoprt/services.c
+++ b/win32ss/drivers/videoprt/services.c
@@ -46,7 +46,6 @@ VideoPortQueryServices(
switch (ServicesType)
{
-#if defined(_M_IX86)
case VideoPortServicesInt10:
if (Interface->Version >= VIDEO_PORT_INT10_INTERFACE_VERSION_1 ||
Interface->Size >= sizeof(VIDEO_PORT_INT10_INTERFACE))
@@ -64,7 +63,7 @@ VideoPortQueryServices(
return NO_ERROR;
}
break;
-#endif
+
case VideoPortServicesAGP:
if ((Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2 &&
Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE_2)) ||