- Fix another V86 Mode exit bug which could cause non-volatiles to be incorrectly restored. - Make traps use the shared EOI (End Of Interrupt) helper instead of their own custom trap exit code. Modified: trunk/reactos/ntoskrnl/ke/i386/syscall.S Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s _____
Modified: trunk/reactos/ntoskrnl/ke/i386/syscall.S --- trunk/reactos/ntoskrnl/ke/i386/syscall.S 2006-01-16 19:32:55 UTC (rev 20918) +++ trunk/reactos/ntoskrnl/ke/i386/syscall.S 2006-01-16 19:59:32 UTC (rev 20919) @@ -458,7 +458,6 @@
jnz V86_Exit
/* Check if the frame was edited */ -V86_Exit_Return: test word ptr [esp+KTRAP_FRAME_CS], FRAME_EDITED jz EditedFrame
@@ -480,12 +479,12 @@
/* Restore FS */ RestoreFs: - //lea esp, [ebp+KTRAP_FRAME_FS] + lea esp, [ebp+KTRAP_FRAME_FS] pop fs
CommonStackClean: /* Skip debug information and unsaved registers */ - //lea esp, [ebp+KTRAP_FRAME_EDI] + lea esp, [ebp+KTRAP_FRAME_EDI] pop edi pop esi pop ebx @@ -551,8 +550,18 @@ pop edx pop ecx pop eax - jmp V86_Exit_Return
+ /* Move to non-volatiles */ + lea esp, [ebp+KTRAP_FRAME_EDI] + pop edi + pop esi + pop ebx + pop ebp + + /* Skip error code and return */ + add esp, 4 + iret + AbiosExit: /* Not yet supported */ int 3 @@ -692,10 +701,9 @@
/* Check for V86 */ test dword ptr [esp+KTRAP_FRAME_EFLAGS], X86_EFLAGS_VM - jnz V86_Exit2 + jnz V86_Exit
/* Check if the frame was edited */ -V86_Exit_Return2: test word ptr [esp+KTRAP_FRAME_CS], FRAME_EDITED jz EditedFrame2
@@ -734,16 +742,6 @@ add esp, 4 iret
-V86_Exit2: - /* Move to EDX position */ - add esp, KTRAP_FRAME_EDX - - /* Restore volatiles */ - pop edx - pop ecx - pop eax - jmp V86_Exit_Return2 - EditedFrame2: /* Restore real CS value */ mov ebx, [esp+KTRAP_FRAME_TEMPCS] @@ -943,10 +941,9 @@
/* Check for V86 */ test dword ptr [esp+KTRAP_FRAME_EFLAGS], X86_EFLAGS_VM - jnz V86_Exit3 + jnz V86_Exit
/* Check if the frame was edited */ -V86_Exit_Return3: test word ptr [esp+KTRAP_FRAME_CS], FRAME_EDITED jz EditedFrame3
@@ -985,16 +982,6 @@ add esp, 4 iret
-V86_Exit3: - /* Move to EDX position */ - add esp, KTRAP_FRAME_EDX - - /* Restore volatiles */ - pop edx - pop ecx - pop eax - jmp V86_Exit_Return3 - EditedFrame3: /* Restore real CS value */ mov ebx, [esp+KTRAP_FRAME_TEMPCS] _____
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s --- trunk/reactos/ntoskrnl/ke/i386/trap.s 2006-01-16 19:32:55 UTC (rev 20918) +++ trunk/reactos/ntoskrnl/ke/i386/trap.s 2006-01-16 19:59:32 UTC (rev 20919) @@ -1,22 +1,16 @@
-/* $Id$ - * +/* * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/i386/trap.s * PURPOSE: Exception handlers - * PROGRAMMER: David Welch welch@cwcom.net + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * David Welch welch@cwcom.net */
/* INCLUDES ******************************************************************/
-#include <roscfg.h> #include <ndk/asm.h> -#include <internal/i386/ke.h>
-#define KernelMode 0 -#define UserMode 1 - /* NOTES: - * The epilog will be replaced by a call to Ki386EoiHelper when bugs are fixed. * The prologue is currently a duplication of the trap enter code in KiDebugService. * It will be made a macro and shared later. */ @@ -28,44 +22,9 @@ */ _KiTrapEpilog: cmpl $1, %eax /* Check for v86 recovery */ - jne _KiTrapRet + jne Kei386EoiHelper@0 jmp _KiV86Complete -_KiTrapRet: - /* Skip debug information and unsaved registers */ - addl $0x18, %esp - popl %eax /* Dr0 */ - movl %eax, %dr0 - popl %eax /* Dr1 */ - movl %eax, %dr1 - popl %eax /* Dr2 */ - movl %eax, %dr2 - popl %eax /* Dr3 */ - movl %eax, %dr3 - popl %eax /* Dr6 */ - movl %eax, %dr6 - popl %eax /* Dr7 */ - movl %eax, %dr7 - popl %gs - popl %es - popl %ds - popl %edx - popl %ecx - popl %eax - popl %ebx
- /* Restore the old exception handler list */ - popl %ebx - movl %ebx, %fs:KPCR_EXCEPTION_LIST - - popl %fs - popl %edi - popl %esi - popl %ebx - popl %ebp - addl $0x4, %esp /* Ignore error code */ - - iret - .globl _KiTrapProlog _KiTrapProlog: movl $_KiTrapHandler, %ebx @@ -106,7 +65,7 @@ mov ebp, esp
/* Check if this was from V86 Mode */ - test dword ptr [ebp+KTRAP_FRAME_EFLAGS], X86_EFLAGS_VM + test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK //jnz V86_kids
/* Get current thread */ @@ -358,7 +317,7 @@ mov eax, [eax+KTHREAD_INITIAL_STACK]
/* Check if V86 */ - test dword ptr [edx+KTRAP_FRAME_EFLAGS], X86_EFLAGS_VM + test dword ptr [edx+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK jnz NoAdjust
/* Bias the stack */