mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
[VIDEOPRT] Fixes for x64
This commit is contained in:
parent
832f8863be
commit
eba27d5856
1 changed files with 27 additions and 19 deletions
|
@ -150,7 +150,6 @@ IntInitializeVideoAddressSpace(VOID)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_M_IX86)
|
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
IntInt10AllocateBuffer(
|
IntInt10AllocateBuffer(
|
||||||
|
@ -163,16 +162,18 @@ IntInt10AllocateBuffer(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
|
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
SIZE_T Size;
|
||||||
|
|
||||||
TRACE_(VIDEOPRT, "IntInt10AllocateBuffer\n");
|
TRACE_(VIDEOPRT, "IntInt10AllocateBuffer\n");
|
||||||
|
|
||||||
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
||||||
|
|
||||||
|
Size = *Length;
|
||||||
MemoryAddress = (PVOID)0x20000;
|
MemoryAddress = (PVOID)0x20000;
|
||||||
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
||||||
&MemoryAddress,
|
&MemoryAddress,
|
||||||
0,
|
0,
|
||||||
Length,
|
&Size,
|
||||||
MEM_COMMIT,
|
MEM_COMMIT,
|
||||||
PAGE_EXECUTE_READWRITE);
|
PAGE_EXECUTE_READWRITE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -182,20 +183,23 @@ IntInt10AllocateBuffer(
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MemoryAddress > (PVOID)(0x100000 - *Length))
|
if (MemoryAddress > (PVOID)(0x100000 - Size))
|
||||||
{
|
{
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(), &MemoryAddress, Length,
|
ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
|
&MemoryAddress,
|
||||||
|
&Size,
|
||||||
MEM_RELEASE);
|
MEM_RELEASE);
|
||||||
WARN_(VIDEOPRT, "- Unacceptable memory allocated\n");
|
WARN_(VIDEOPRT, "- Unacceptable memory allocated\n");
|
||||||
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Seg = (USHORT)((ULONG)MemoryAddress >> 4);
|
*Length = (ULONG)Size;
|
||||||
*Off = (USHORT)((ULONG)MemoryAddress & 0xF);
|
*Seg = (USHORT)((ULONG_PTR)MemoryAddress >> 4);
|
||||||
|
*Off = (USHORT)((ULONG_PTR)MemoryAddress & 0xF);
|
||||||
|
|
||||||
INFO_(VIDEOPRT, "- Segment: %x\n", (ULONG)MemoryAddress >> 4);
|
INFO_(VIDEOPRT, "- Segment: %x\n", (ULONG_PTR)MemoryAddress >> 4);
|
||||||
INFO_(VIDEOPRT, "- Offset: %x\n", (ULONG)MemoryAddress & 0xF);
|
INFO_(VIDEOPRT, "- Offset: %x\n", (ULONG_PTR)MemoryAddress & 0xF);
|
||||||
INFO_(VIDEOPRT, "- Length: %x\n", *Length);
|
INFO_(VIDEOPRT, "- Length: %x\n", *Length);
|
||||||
|
|
||||||
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
||||||
|
@ -210,7 +214,7 @@ IntInt10FreeBuffer(
|
||||||
IN USHORT Seg,
|
IN USHORT Seg,
|
||||||
IN USHORT Off)
|
IN USHORT Off)
|
||||||
{
|
{
|
||||||
PVOID MemoryAddress = (PVOID)((Seg << 4) | Off);
|
PVOID MemoryAddress = (PVOID)((ULONG_PTR)(Seg << 4) | Off);
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
|
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
@ -250,7 +254,7 @@ IntInt10ReadMemory(
|
||||||
INFO_(VIDEOPRT, "- Length: %x\n", Length);
|
INFO_(VIDEOPRT, "- Length: %x\n", Length);
|
||||||
|
|
||||||
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
||||||
RtlCopyMemory(Buffer, (PVOID)((Seg << 4) | Off), Length);
|
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)(Seg << 4) | Off), Length);
|
||||||
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
||||||
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
|
@ -275,12 +279,13 @@ IntInt10WriteMemory(
|
||||||
INFO_(VIDEOPRT, "- Length: %x\n", Length);
|
INFO_(VIDEOPRT, "- Length: %x\n", Length);
|
||||||
|
|
||||||
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
IntAttachToCSRSS(&CallingProcess, &ApcState);
|
||||||
RtlCopyMemory((PVOID)((Seg << 4) | Off), Buffer, Length);
|
RtlCopyMemory((PVOID)((ULONG_PTR)(Seg << 4) | Off), Buffer, Length);
|
||||||
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
IntDetachFromCSRSS(&CallingProcess, &ApcState);
|
||||||
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_M_IX86)
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
IntInt10CallBios(
|
IntInt10CallBios(
|
||||||
|
@ -341,6 +346,16 @@ IntInt10CallBios(
|
||||||
|
|
||||||
return ERROR_INVALID_PARAMETER;
|
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
|
#endif
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
@ -348,14 +363,12 @@ IntInt10CallBios(
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
VideoPortInt10(
|
VideoPortInt10(
|
||||||
IN PVOID HwDeviceExtension,
|
IN PVOID HwDeviceExtension,
|
||||||
IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
|
IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
|
||||||
{
|
{
|
||||||
#if defined(_M_IX86)
|
|
||||||
INT10_BIOS_ARGUMENTS Int10BiosArguments;
|
INT10_BIOS_ARGUMENTS Int10BiosArguments;
|
||||||
VP_STATUS Status;
|
VP_STATUS Status;
|
||||||
|
|
||||||
|
@ -376,9 +389,4 @@ VideoPortInt10(
|
||||||
RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(BiosArguments));
|
RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(BiosArguments));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#else
|
|
||||||
/* Not implemented for anything else than X86*/
|
|
||||||
DPRINT1("Int10 not available on non-x86!\n");
|
|
||||||
return ERROR_INVALID_FUNCTION;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue