https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eba27d5856367e813f13b…
commit eba27d5856367e813f13b129024f4b91ae44b6e0
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Feb 11 14:01:43 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Aug 15 14:13:54 2019 +0200
[VIDEOPRT] Fixes for x64
---
win32ss/drivers/videoprt/int10.c | 46 +++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/win32ss/drivers/videoprt/int10.c b/win32ss/drivers/videoprt/int10.c
index dd6526a7898..8b35709fbdb 100644
--- a/win32ss/drivers/videoprt/int10.c
+++ b/win32ss/drivers/videoprt/int10.c
@@ -150,7 +150,6 @@ IntInitializeVideoAddressSpace(VOID)
}
#endif
-#if defined(_M_IX86)
VP_STATUS
NTAPI
IntInt10AllocateBuffer(
@@ -163,16 +162,18 @@ IntInt10AllocateBuffer(
NTSTATUS Status;
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
+ SIZE_T Size;
TRACE_(VIDEOPRT, "IntInt10AllocateBuffer\n");
IntAttachToCSRSS(&CallingProcess, &ApcState);
+ Size = *Length;
MemoryAddress = (PVOID)0x20000;
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
&MemoryAddress,
0,
- Length,
+ &Size,
MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
if (!NT_SUCCESS(Status))
@@ -182,20 +183,23 @@ IntInt10AllocateBuffer(
return ERROR_NOT_ENOUGH_MEMORY;
}
- if (MemoryAddress > (PVOID)(0x100000 - *Length))
+ if (MemoryAddress > (PVOID)(0x100000 - Size))
{
- ZwFreeVirtualMemory(NtCurrentProcess(), &MemoryAddress, Length,
- MEM_RELEASE);
+ ZwFreeVirtualMemory(NtCurrentProcess(),
+ &MemoryAddress,
+ &Size,
+ MEM_RELEASE);
WARN_(VIDEOPRT, "- Unacceptable memory allocated\n");
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return ERROR_NOT_ENOUGH_MEMORY;
}
- *Seg = (USHORT)((ULONG)MemoryAddress >> 4);
- *Off = (USHORT)((ULONG)MemoryAddress & 0xF);
+ *Length = (ULONG)Size;
+ *Seg = (USHORT)((ULONG_PTR)MemoryAddress >> 4);
+ *Off = (USHORT)((ULONG_PTR)MemoryAddress & 0xF);
- INFO_(VIDEOPRT, "- Segment: %x\n", (ULONG)MemoryAddress >> 4);
- INFO_(VIDEOPRT, "- Offset: %x\n", (ULONG)MemoryAddress & 0xF);
+ INFO_(VIDEOPRT, "- Segment: %x\n", (ULONG_PTR)MemoryAddress >> 4);
+ INFO_(VIDEOPRT, "- Offset: %x\n", (ULONG_PTR)MemoryAddress & 0xF);
INFO_(VIDEOPRT, "- Length: %x\n", *Length);
IntDetachFromCSRSS(&CallingProcess, &ApcState);
@@ -210,7 +214,7 @@ IntInt10FreeBuffer(
IN USHORT Seg,
IN USHORT Off)
{
- PVOID MemoryAddress = (PVOID)((Seg << 4) | Off);
+ PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
NTSTATUS Status;
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
@@ -250,7 +254,7 @@ IntInt10ReadMemory(
INFO_(VIDEOPRT, "- Length: %x\n", Length);
IntAttachToCSRSS(&CallingProcess, &ApcState);
- RtlCopyMemory(Buffer, (PVOID)((Seg << 4) | Off), Length);
+ RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)(Seg << 4) | Off), Length);
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return NO_ERROR;
@@ -275,12 +279,13 @@ IntInt10WriteMemory(
INFO_(VIDEOPRT, "- Length: %x\n", Length);
IntAttachToCSRSS(&CallingProcess, &ApcState);
- RtlCopyMemory((PVOID)((Seg << 4) | Off), Buffer, Length);
+ RtlCopyMemory((PVOID)((ULONG_PTR)(Seg << 4) | Off), Buffer, Length);
IntDetachFromCSRSS(&CallingProcess, &ApcState);
return NO_ERROR;
}
+#if defined(_M_IX86)
VP_STATUS
NTAPI
IntInt10CallBios(
@@ -341,6 +346,16 @@ 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 ***********************************************************/
@@ -348,14 +363,12 @@ IntInt10CallBios(
/*
* @implemented
*/
-
VP_STATUS
NTAPI
VideoPortInt10(
IN PVOID HwDeviceExtension,
IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
{
-#if defined(_M_IX86)
INT10_BIOS_ARGUMENTS Int10BiosArguments;
VP_STATUS Status;
@@ -376,9 +389,4 @@ VideoPortInt10(
RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(BiosArguments));
return Status;
-#else
- /* Not implemented for anything else than X86*/
- DPRINT1("Int10 not available on non-x86!\n");
- return ERROR_INVALID_FUNCTION;
-#endif
}