https://git.reactos.org/?p=reactos.git;a=commitdiff;h=832f8863beca681d12eb7a3fba22b5a440728e6e
commit 832f8863beca681d12eb7a3fba22b5a440728e6e Author: Timo Kreuzer <timo.kreu...@reactos.org> AuthorDate: Sun Feb 11 13:49:14 2018 +0100 Commit: Timo Kreuzer <timo.kreu...@reactos.org> CommitDate: Thu Aug 15 14:13:54 2019 +0200 [VIDEOPRT] Call IntInt10CallBios from VideoPortInt10, instead of code duplication --- win32ss/drivers/videoprt/int10.c | 54 ++++++++-------------------------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/win32ss/drivers/videoprt/int10.c b/win32ss/drivers/videoprt/int10.c index 82f3774067f..dd6526a7898 100644 --- a/win32ss/drivers/videoprt/int10.c +++ b/win32ss/drivers/videoprt/int10.c @@ -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); - - /* Clear the context */ - RtlZeroMemory(&BiosContext, sizeof(CONTEXT)); - - /* 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; - - /* 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; + /* Copy arguments to other format */ + RtlCopyMemory(&Int10BiosArguments, BiosArguments, sizeof(BiosArguments)); + Int10BiosArguments.SegDs = 0; + Int10BiosArguments.SegEs = 0; - /* Detach from CSRSS */ - IntDetachFromCSRSS(&CallingProcess, &ApcState); + /* Do the BIOS call */ + Status = IntInt10CallBios(NULL, &Int10BiosArguments); - if (NT_SUCCESS(Status)) - { - return NO_ERROR; - } + /* Copy results back */ + RtlCopyMemory(BiosArguments, &Int10BiosArguments, sizeof(BiosArguments)); - return ERROR_INVALID_PARAMETER; + return Status; #else /* Not implemented for anything else than X86*/ DPRINT1("Int10 not available on non-x86!\n");