Author: mjmartin
Date: Fri Dec 26 22:01:26 2008
New Revision: 38365
URL:
http://svn.reactos.org/svn/reactos?rev=38365&view=rev
Log:
- Fix VideoPortInt10 implementation. The previous implementation was passing a
significantly smaller KV86M_REGISTERS struct vice CONTEXT struct to Ke386CallBios,
resulting in memory corruption.
- Part 2 of ? fixes for bug 2286.
Modified:
trunk/reactos/drivers/video/videoprt/int10.c
Modified: trunk/reactos/drivers/video/videoprt/int10.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/int…
==============================================================================
--- trunk/reactos/drivers/video/videoprt/int10.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/videoprt/int10.c [iso-8859-1] Fri Dec 26 22:01:26 2008
@@ -199,48 +199,48 @@
VP_STATUS NTAPI
VideoPortInt10(
- IN PVOID HwDeviceExtension,
- IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
-{
- KV86M_REGISTERS Regs;
- NTSTATUS Status;
- PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
- KAPC_STATE ApcState;
-
- TRACE_(VIDEOPRT, "VideoPortInt10\n");
-
- if (!CsrssInitialized)
- {
- return ERROR_INVALID_PARAMETER;
- }
-
- IntAttachToCSRSS(&CallingProcess, &ApcState);
-
- memset(&Regs, 0, sizeof(Regs));
- INFO_(VIDEOPRT, "- Input register Eax: %x\n", BiosArguments->Eax);
- Regs.Eax = BiosArguments->Eax;
- INFO_(VIDEOPRT, "- Input register Ebx: %x\n", BiosArguments->Ebx);
- Regs.Ebx = BiosArguments->Ebx;
- INFO_(VIDEOPRT, "- Input register Ecx: %x\n", BiosArguments->Ecx);
- Regs.Ecx = BiosArguments->Ecx;
- INFO_(VIDEOPRT, "- Input register Edx: %x\n", BiosArguments->Edx);
- Regs.Edx = BiosArguments->Edx;
- INFO_(VIDEOPRT, "- Input register Esi: %x\n", BiosArguments->Esi);
- Regs.Esi = BiosArguments->Esi;
- INFO_(VIDEOPRT, "- Input register Edi: %x\n", BiosArguments->Edi);
- Regs.Edi = BiosArguments->Edi;
- INFO_(VIDEOPRT, "- Input register Ebp: %x\n", BiosArguments->Ebp);
- Regs.Ebp = BiosArguments->Ebp;
- Status = Ke386CallBios(0x10, (PCONTEXT)&Regs);
- BiosArguments->Eax = Regs.Eax;
- BiosArguments->Ebx = Regs.Ebx;
- BiosArguments->Ecx = Regs.Ecx;
- BiosArguments->Edx = Regs.Edx;
- BiosArguments->Esi = Regs.Esi;
- BiosArguments->Edi = Regs.Edi;
- BiosArguments->Ebp = Regs.Ebp;
-
- IntDetachFromCSRSS(&CallingProcess, &ApcState);
-
- return Status;
-}
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments)
+{
+ CONTEXT BiosContext;
+ NTSTATUS Status;
+ PKPROCESS CallingProcess = (PKPROCESS)PsGetCurrentProcess();
+ KAPC_STATE ApcState;
+
+ 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 */
+ Status = Ke386CallBios(0x10, &BiosContext);
+
+ /* 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);
+
+ return Status;
+}