mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[VIDEOPRT] Call IntInt10CallBios from VideoPortInt10, instead of code duplication
This commit is contained in:
parent
e7b3c66a42
commit
832f8863be
1 changed files with 11 additions and 43 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue