[VIDEOPRT] Call IntInt10CallBios from VideoPortInt10, instead of code duplication

This commit is contained in:
Timo Kreuzer 2018-02-11 13:49:14 +01:00
parent e7b3c66a42
commit 832f8863be

View file

@ -356,58 +356,26 @@ VideoPortInt10(
IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
{
#if defined(_M_IX86)
CONTEXT BiosContext;
NTSTATUS Status;
PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
KAPC_STATE ApcState;
INT10_BIOS_ARGUMENTS Int10BiosArguments;
VP_STATUS Status;
if (!CsrssInitialized)
{
return ERROR_INVALID_PARAMETER;
}
/* Attach to CSRSS */
IntAttachToCSRSS(&CallingProcess, &ApcState);
/* Copy arguments to other format */
RtlCopyMemory(&Int10BiosArguments, BiosArguments, sizeof(BiosArguments));
Int10BiosArguments.SegDs = 0;
Int10BiosArguments.SegEs = 0;
/* Clear the context */
RtlZeroMemory(&BiosContext, sizeof(CONTEXT));
/* Do the BIOS call */
Status = IntInt10CallBios(NULL, &Int10BiosArguments);
/* Fill out the bios arguments */
BiosContext.Eax = BiosArguments->Eax;
BiosContext.Ebx = BiosArguments->Ebx;
BiosContext.Ecx = BiosArguments->Ecx;
BiosContext.Edx = BiosArguments->Edx;
BiosContext.Esi = BiosArguments->Esi;
BiosContext.Edi = BiosArguments->Edi;
BiosContext.Ebp = BiosArguments->Ebp;
/* Copy results back */
RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(BiosArguments));
/* Do the ROM BIOS call */
(void)KeWaitForMutexObject(&VideoPortInt10Mutex,
Executive,
KernelMode,
FALSE,
NULL);
Status = Ke386CallBios(0x10, &BiosContext);
KeReleaseMutex(&VideoPortInt10Mutex, FALSE);
/* Return the arguments */
BiosArguments->Eax = BiosContext.Eax;
BiosArguments->Ebx = BiosContext.Ebx;
BiosArguments->Ecx = BiosContext.Ecx;
BiosArguments->Edx = BiosContext.Edx;
BiosArguments->Esi = BiosContext.Esi;
BiosArguments->Edi = BiosContext.Edi;
BiosArguments->Ebp = BiosContext.Ebp;
/* Detach from CSRSS */
IntDetachFromCSRSS(&CallingProcess, &ApcState);
if (NT_SUCCESS(Status))
{
return NO_ERROR;
}
return ERROR_INVALID_PARAMETER;
return Status;
#else
/* Not implemented for anything else than X86*/
DPRINT1("Int10 not available on non-x86!\n");