- 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.

svn path=/trunk/; revision=20919
This commit is contained in:
Alex Ionescu 2006-01-16 19:59:32 +00:00
parent 4334f8a57f
commit 58964b9893
2 changed files with 21 additions and 75 deletions

View file

@ -458,7 +458,6 @@ KiRosTrapReturn:
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 @@ V86_Exit_Return:
/* 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,7 +550,17 @@ V86_Exit:
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 */
@ -692,10 +701,9 @@ KiRosTrapReturn2:
/* 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 @@ CommonStackClean2:
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 @@ KiRosTrapReturn3:
/* 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 @@ CommonStackClean3:
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]

View file

@ -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,43 +22,8 @@
*/
_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:
@ -106,7 +65,7 @@ _KiTrapProlog2:
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 @@ _Ki386AdjustEsp0@4:
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 */