mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 21:33:42 +00:00
Fix VideoPortMapMemory.
svn path=/trunk/; revision=13411
This commit is contained in:
parent
9566275d1b
commit
824d1552c9
1 changed files with 24 additions and 1 deletions
|
@ -82,6 +82,7 @@ IntVideoPortMapMemory(
|
||||||
IN PHYSICAL_ADDRESS IoAddress,
|
IN PHYSICAL_ADDRESS IoAddress,
|
||||||
IN ULONG NumberOfUchars,
|
IN ULONG NumberOfUchars,
|
||||||
IN UCHAR InIoSpace,
|
IN UCHAR InIoSpace,
|
||||||
|
IN HANDLE ProcessHandle,
|
||||||
OUT VP_STATUS *Status)
|
OUT VP_STATUS *Status)
|
||||||
{
|
{
|
||||||
PHYSICAL_ADDRESS TranslatedAddress;
|
PHYSICAL_ADDRESS TranslatedAddress;
|
||||||
|
@ -101,6 +102,23 @@ IntVideoPortMapMemory(
|
||||||
InIoSpace &= ~VIDEO_MEMORY_SPACE_P6CACHE;
|
InIoSpace &= ~VIDEO_MEMORY_SPACE_P6CACHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ProcessHandle != NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
|
||||||
|
{
|
||||||
|
DPRINT("ProcessHandle is not NULL (0x%x) but InIoSpace does not have "
|
||||||
|
"VIDEO_MEMORY_SPACE_USER_MODE set! Setting "
|
||||||
|
"VIDEO_MEMORY_SPACE_USER_MODE.\n",
|
||||||
|
ProcessHandle);
|
||||||
|
InIoSpace |= VIDEO_MEMORY_SPACE_USER_MODE;
|
||||||
|
}
|
||||||
|
else if (ProcessHandle == NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
|
||||||
|
{
|
||||||
|
DPRINT("ProcessHandle is NULL (0x%x) but InIoSpace does have "
|
||||||
|
"VIDEO_MEMORY_SPACE_USER_MODE set! Setting ProcessHandle "
|
||||||
|
"to NtCurrentProcess()\n",
|
||||||
|
ProcessHandle);
|
||||||
|
ProcessHandle = NtCurrentProcess();
|
||||||
|
}
|
||||||
|
|
||||||
if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0 &&
|
if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0 &&
|
||||||
!IsListEmpty(&DeviceExtension->AddressMappingListHead))
|
!IsListEmpty(&DeviceExtension->AddressMappingListHead))
|
||||||
{
|
{
|
||||||
|
@ -155,7 +173,7 @@ IntVideoPortMapMemory(
|
||||||
{
|
{
|
||||||
NTSTATUS NtStatus;
|
NTSTATUS NtStatus;
|
||||||
MappedAddress = NULL;
|
MappedAddress = NULL;
|
||||||
NtStatus = IntVideoPortMapPhysicalMemory(NtCurrentProcess(),
|
NtStatus = IntVideoPortMapPhysicalMemory(ProcessHandle,
|
||||||
TranslatedAddress,
|
TranslatedAddress,
|
||||||
NumberOfUchars,
|
NumberOfUchars,
|
||||||
PAGE_READWRITE/* | PAGE_WRITECOMBINE*/,
|
PAGE_READWRITE/* | PAGE_WRITECOMBINE*/,
|
||||||
|
@ -249,6 +267,8 @@ IntVideoPortUnmapMemory(
|
||||||
|
|
||||||
/* If there was no kernelmode mapping for the given address found we assume
|
/* If there was no kernelmode mapping for the given address found we assume
|
||||||
* that the given address is a usermode mapping and try to unmap it.
|
* that the given address is a usermode mapping and try to unmap it.
|
||||||
|
*
|
||||||
|
* FIXME: Is it ok to use NtCurrentProcess?
|
||||||
*/
|
*/
|
||||||
Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
|
Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -276,6 +296,7 @@ VideoPortGetDeviceBase(
|
||||||
IoAddress,
|
IoAddress,
|
||||||
NumberOfUchars,
|
NumberOfUchars,
|
||||||
InIoSpace,
|
InIoSpace,
|
||||||
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,6 +353,7 @@ VideoPortMapMemory(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("VideoPortMapMemory\n");
|
DPRINT("VideoPortMapMemory\n");
|
||||||
|
DPRINT("- *VirtualAddress: 0x%x\n", *VirtualAddress);
|
||||||
|
|
||||||
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
||||||
*VirtualAddress = IntVideoPortMapMemory(
|
*VirtualAddress = IntVideoPortMapMemory(
|
||||||
|
@ -339,6 +361,7 @@ VideoPortMapMemory(
|
||||||
PhysicalAddress,
|
PhysicalAddress,
|
||||||
*Length,
|
*Length,
|
||||||
*InIoSpace,
|
*InIoSpace,
|
||||||
|
(HANDLE)*VirtualAddress,
|
||||||
&Status);
|
&Status);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue