Major refactoring of the exception handling code + misc fixes:
authorAlex Ionescu <aionescu@gmail.com>
Sun, 11 Sep 2005 22:32:20 +0000 (22:32 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Sun, 11 Sep 2005 22:32:20 +0000 (22:32 +0000)
commitb9020b11dde3907355096dd60b453e330f47dc9b
treefbd9c1d968a2bd65e8d285fcea3d1fa0707c7f02
parent801ad7223fc062717433dc39205dd0035550e5e1
Major refactoring of the exception handling code + misc fixes:
- Fix/add prototypes for RtlCaptureContext, RtlDispatchException and RtlUnwind
- Fix EXCEPTION_REGISTRATION_RECORD structure and PEXCEPTION_ROUTINE
- Add w32api excpt.h (based on mingw) with PSDK compatibility fixes
- Fix seriously broken User-Mode Ldr thunk and APC Callback prototypes
- Fix KiUserExceptionDispatcher
- Remove useless NTDLL entrypoint
- Implement NTDLL Ki* callbacks in ASM
- Implement RtlCaptureContext
- Fix RtlRaiseException to handle cases when a user-mode debugger is present
- Fix RtlRaiseStatus as above, plus set the exception address and capture context
- Little cleanup of RTL headers
- Implement RtlpGetStackLimits, RtlpGetExceptionList, RtlpSetExceptionList, RtlpGetExceptionAddress in ASM
- Fix RtlDispatchException, add cases for exceptions in the DPC stack and validate the validity of the
exception frames. Add support for exception logging by the global flag. Use TRAP_FRAME/EXCPETION_FRAME instead of
Context.
- Fix RtlUnwind logic, support cases where it's called with custom arguments instead of NULL.
- Reimplement RtlpCaptureContext to work properly, convert exception handler calling functions to INTEL syntax
and fix some bugs (like checking for the right unwind flag, clearing volatile register values, etc. Also use some
optimizations to increase speed.
- Modify some kernel functions (like KeContextToTrapFrame, KiDispatchException, KiInitializeUserApc, etc.) to
support a PKEXCEPTION_FRAME for future PPC compatibility.
- Reimplement RtlCaptureUnicodeString/FreeUnicodeString as inlined probe macros and optimize them.
- Export ExRaiseStatus/Exception as Rtl*
- Reimplement NtContinue to have more platform-independent code, and to protect and validate user-mode context
and parameters with SEH.
- Implement KiRaiseException, add SEH to all user-mode parameters and when copying data to the user-mode stack.
- Fix KiInitializeUserApc to use KeTrapFrameToContext, to save the debug registers, not to deliver APCs during
v86 mode, and to protect user-mode stack operations in SEH and probing. Also make it generate the proper stack for the
user-mode callback.
- Implement KiUnexpectedInterrupt and KiCoprocessorError
- Reimplement NtRaiseException in ASM to take advantage of optimizations due to the trap frame being in the
stack when called through System call interface.
- Fix Ntcontinue to respect AlertThread paramter
- Fix some functiosn to return with KiServiceExit2 instead of KiServiceExit when required/needed
- Fix KiDispatchException's logic, fix hacks when calling KeUserExceptionDispatcher, use correct context
flags,...
- Make NTDLL Ki* callbacks have SEH to protect them and return to kernel-mode with notification of any
exceptions (the kernel-mode code to handle this isn't written yet though)

svn path=/trunk/; revision=17811
48 files changed:
reactos/include/ndk/asm.h
reactos/include/ndk/ntndk.h
reactos/include/ndk/rtlfuncs.h
reactos/include/ndk/rtltypes.h
reactos/include/wine/exception.h
reactos/lib/crt/except/unwind.c
reactos/lib/crt/wine/scanf.c
reactos/lib/dbghelp/stack.c
reactos/lib/dbghelp/stackframe.h
reactos/lib/dbghelp/thread.h
reactos/lib/ntdll/def/ntdll.def
reactos/lib/ntdll/ldr/entry.S [deleted file]
reactos/lib/ntdll/ldr/startup.c
reactos/lib/ntdll/main/dispatch.c
reactos/lib/ntdll/main/dllmain.c [deleted file]
reactos/lib/ntdll/main/i386/dispatch.S [new file with mode: 0644]
reactos/lib/ntdll/ntdll.xml
reactos/lib/ntdll/rtl/libsupp.c
reactos/lib/rtl/exception.c
reactos/lib/rtl/i386/except.s
reactos/lib/rtl/i386/exception.c
reactos/lib/rtl/rtl.h
reactos/lib/rtl/rtlp.h [new file with mode: 0644]
reactos/ntoskrnl/ex/error.c
reactos/ntoskrnl/ex/sysinfo.c
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/include/ntoskrnl.h
reactos/ntoskrnl/io/driver.c
reactos/ntoskrnl/kd/wrappers/gdbstub.c
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/exception.c [new file with mode: 0644]
reactos/ntoskrnl/ke/i386/exp.c
reactos/ntoskrnl/ke/i386/fpu.c
reactos/ntoskrnl/ke/i386/irqhand.s
reactos/ntoskrnl/ke/i386/syscall.S
reactos/ntoskrnl/ke/i386/thread.c
reactos/ntoskrnl/ke/i386/trap.s
reactos/ntoskrnl/mm/pagefile.c
reactos/ntoskrnl/ntoskrnl.def
reactos/ntoskrnl/ntoskrnl.xml
reactos/ntoskrnl/ob/symlink.c
reactos/ntoskrnl/ps/debug.c
reactos/ntoskrnl/rtl/capture.c [deleted file]
reactos/ntoskrnl/rtl/i386/exception.c
reactos/ntoskrnl/rtl/libsupp.c
reactos/w32api/include/ddk/ntddk.h
reactos/w32api/include/excpt.h [new file with mode: 0644]