Author: ion
Date: Mon Aug 21 06:32:08 2006
New Revision: 23633
URL:
http://svn.reactos.org/svn/reactos?rev=23633&view=rev
Log:
- Switch 4, 5, 6 to common ASM dispatcher as well.
Modified:
trunk/reactos/include/ndk/asm.h
trunk/reactos/ntoskrnl/ke/i386/trap.s
Modified: trunk/reactos/include/ndk/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=2363…
==============================================================================
--- trunk/reactos/include/ndk/asm.h (original)
+++ trunk/reactos/include/ndk/asm.h Mon Aug 21 06:32:08 2006
@@ -383,6 +383,9 @@
#define STATUS_ACCESS_VIOLATION 0xC0000005
#define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
#define STATUS_NO_CALLBACK_ACTIVE 0xC0000258
+#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
+#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
+#define STATUS_BREAKPOINT 0x80000003
#define STATUS_SINGLE_STEP 0x80000004
#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
#define STATUS_INTEGER_OVERFLOW 0xC0000095
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/trap.s (original)
+++ trunk/reactos/ntoskrnl/ke/i386/trap.s Mon Aug 21 06:32:08 2006
@@ -770,7 +770,7 @@
/* Check if the frame was from kernelmode */
test word ptr [ebp+KTRAP_FRAME_CS], MODE_MASK
- jz EnableInterrupts
+ jz SendException
/* Check the old mode */
cmp word ptr [ebp+KTRAP_FRAME_CS], KGDT_R3_CODE + RPL_MASK
@@ -849,6 +849,7 @@
call _KeBugCheckEx@20
.endfunc
+.func KiTrap3
_KiTrap3:
/* Push error code */
push 0
@@ -856,19 +857,47 @@
/* Enter trap */
TRAP_PROLOG(3)
- /* Call the C exception handler */
- push 3
- push ebp
- call _KiTrapHandler
- add esp, 8
-
- /* Check for v86 recovery */
- cmp eax, 1
-
- /* Return to caller */
- jne _Kei386EoiHelper@0
- jmp _KiV86Complete
-
+ /* Check for V86 */
+ test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK
+ jnz V86Int3
+
+ /* Check if the frame was from kernelmode */
+ test word ptr [ebp+KTRAP_FRAME_CS], MODE_MASK
+ jz PrepInt3
+
+ /* Check the old mode */
+ cmp word ptr [ebp+KTRAP_FRAME_CS], KGDT_R3_CODE + RPL_MASK
+ jne V86Int3
+
+EnableInterrupts3:
+ /* Enable interrupts for user-mode */
+ sti
+
+PrepInt3:
+ /* Prepare the exception */
+ mov esi, ecx
+ mov edi, edx
+ mov edx, eax
+
+ /* Setup EIP, NTSTATUS and parameter count, then dispatch */
+ mov ebx, [ebp+KTRAP_FRAME_EIP]
+ dec ebx
+ mov eax, STATUS_BREAKPOINT
+ mov ecx, 3
+ call _CommonDispatchException
+
+V86Int3:
+ /* Check if this is a VDM process */
+ mov ebx, [fs:KPCR_CURRENT_THREAD]
+ mov ebx, [ebx+KTHREAD_APCSTATE_PROCESS]
+ cmp dword ptr [ebx+EPROCESS_VDM_OBJECTS], 0
+ jz EnableInterrupts3
+
+ /* We don't support VDM! */
+ int 3
+.endfunc
+
+.func KiTrap4
_KiTrap4:
/* Push error code */
push 0
@@ -876,19 +905,39 @@
/* Enter trap */
TRAP_PROLOG(4)
- /* Call the C exception handler */
- push 4
- push ebp
- call _KiTrapHandler
- add esp, 8
-
- /* Check for v86 recovery */
- cmp eax, 1
-
- /* Return to caller */
- jne _Kei386EoiHelper@0
- jmp _KiV86Complete
-
+ /* Check for V86 */
+ test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK
+ jnz V86Int4
+
+ /* Check if the frame was from kernelmode */
+ test word ptr [ebp+KTRAP_FRAME_CS], MODE_MASK
+ jz SendException4
+
+ /* Check the old mode */
+ cmp word ptr [ebp+KTRAP_FRAME_CS], KGDT_R3_CODE + RPL_MASK
+ jne VdmCheck4
+
+SendException4:
+ /* Re-enable interrupts for user-mode and send the exception */
+ sti
+ mov eax, STATUS_INTEGER_OVERFLOW
+ mov ebx, [ebp+KTRAP_FRAME_EIP]
+ dec ebx
+ jmp _DispatchNoParam
+
+VdmCheck4:
+ /* Check if this is a VDM process */
+ mov ebx, [fs:KPCR_CURRENT_THREAD]
+ mov ebx, [ebx+KTHREAD_APCSTATE_PROCESS]
+ cmp dword ptr [ebx+EPROCESS_VDM_OBJECTS], 0
+ jz SendException4
+
+ /* We don't support this yet! */
+V86Int4:
+ int 3
+.endfunc
+
+.func KiTrap5
_KiTrap5:
/* Push error code */
push 0
@@ -896,18 +945,45 @@
/* Enter trap */
TRAP_PROLOG(5)
- /* Call the C exception handler */
+ /* Check for V86 */
+ test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK
+ jnz V86Int5
+
+ /* Check if the frame was from kernelmode */
+ test word ptr [ebp+KTRAP_FRAME_CS], MODE_MASK
+ jnz CheckMode
+
+ /* It did, and this should never happen */
+ push 0
+ push 0
+ push 0
push 5
- push ebp
- call _KiTrapHandler
- add esp, 8
-
- /* Check for v86 recovery */
- cmp eax, 1
-
- /* Return to caller */
- jne _Kei386EoiHelper@0
- jmp _KiV86Complete
+ push UNEXPECTED_KERNEL_MODE_TRAP
+ call _KeBugCheckEx@20
+
+ /* Check the old mode */
+CheckMode:
+ cmp word ptr [ebp+KTRAP_FRAME_CS], KGDT_R3_CODE + RPL_MASK
+ jne VdmCheck5
+
+ /* Re-enable interrupts for user-mode and send the exception */
+SendException5:
+ sti
+ mov eax, STATUS_ARRAY_BOUNDS_EXCEEDED
+ mov ebx, [ebp+KTRAP_FRAME_EIP]
+ jmp _DispatchNoParam
+
+VdmCheck5:
+ /* Check if this is a VDM process */
+ mov ebx, [fs:KPCR_CURRENT_THREAD]
+ mov ebx, [ebx+KTHREAD_APCSTATE_PROCESS]
+ cmp dword ptr [ebx+EPROCESS_VDM_OBJECTS], 0
+ jz SendException5
+
+ /* We don't support this yet! */
+V86Int5:
+ int 3
+.endfunc
_KiTrap6:
/* Push error code */