[NTOSKRNL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 22 May 2014 22:28:57 +0000 (22:28 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 22 May 2014 22:28:57 +0000 (22:28 +0000)
commitdf7e3fde891a80edffbadb5dfd1f80d8bbd226d4
tree91549eb9f17c530810c288ebbf600fe2721b6f7b
parentccd49a5b8a17ffa2eae3cfa178f128a316c67679
[NTOSKRNL]
When a user mode debugger has single stepping enabled and steps over a sysenter instruction, you are obviously not supposed to enter the kernel debugger on the syscall entry handler. But exactly this happened on reactos. This was because the sysenter instruction doesn't disable single stepping, so we need to handle this special case manually in the single stepping handler (which we didn't). We now check if the single step comes from KiFastCallEntry and when it does, disable single stepping in the current (nested) trap frame and return back to a secondary fast call entry. The 2nd entrypoint will make sure to re-enable the single step flag in EFLAGS before returning to usermode.
To make this actually work, the asm entry stub itself needs to handle saving of eflags, so some trap frame modification from KiFastCallEntryHandler was moved into the asm stub. Since the amount of asm instructions is rather small (10 instructions, pretty straight forward) I moved everything from KiSystemServiceHandler to the asm stub and killed KiFastCallEntryHandler entirely, calling KiSystemServiceHandler instead.
Now stepping over a sysenter instruction works with OllyDbg without breaking into the kernel debugger. CORE-8057 #resolve

svn path=/trunk/; revision=63420
reactos/include/asm/ks386.template.h
reactos/ntoskrnl/include/internal/i386/asmmacro.S
reactos/ntoskrnl/ke/i386/trap.s
reactos/ntoskrnl/ke/i386/traphdlr.c