<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>reactos/ntoskrnl/ke/i386</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">syscall.S</a></tt></td><td align="right" id="added">+231</td><td align="right" id="removed">-214</td><td nowrap="nowrap" align="center"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S?rev=1.14&amp;content-type=text/x-cvsweb-markup">1.14</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S.diff?r1=text&amp;tr1=1.14&amp;r2=text&amp;tr2=1.15&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S?rev=1.15&amp;content-type=text/x-cvsweb-markup">1.15</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">usercall.c</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c?rev=1.26&amp;content-type=text/x-cvsweb-markup">1.26</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c.diff?r1=text&amp;tr1=1.26&amp;r2=text&amp;tr2=1.27&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c?rev=1.27&amp;content-type=text/x-cvsweb-markup">1.27</a></td></tr>
<tr><td></td><td align="right" id="added">+238</td><td align="right" id="removed">-219</td><td></td></tr>
</table>
<small id="info">2 modified files</small><br />
<pre class="comment">
cleanup/reformat syscall code, save return value as soon as possible so that eax is freed up, which also simplifies the implementation of KiAfterSystemCallHook(), also removes a couple redundant instructions.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos">reactos</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl">ntoskrnl</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke">ke</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386">i386</a><br /></span>
<div class="fileheader"><big><b>syscall.S</b></big> <small id="info"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S?rev=1.14&amp;content-type=text/x-cvsweb-markup">1.14</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S.diff?r1=text&amp;tr1=1.14&amp;r2=text&amp;tr2=1.15&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/syscall.S?rev=1.15&amp;content-type=text/x-cvsweb-markup">1.15</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.14 -r1.15
--- syscall.S        7 Apr 2004 15:35:14 -0000        1.14
+++ syscall.S        1 Jul 2004 01:52:37 -0000        1.15
@@ -16,7 +16,7 @@
</small></pre><pre class="diff" id="context">  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
</pre><pre class="diff" id="removed">-/* $Id: syscall.S,v 1.14 2004/04/07 15:35:14 ekohl Exp $
</pre><pre class="diff" id="added">+/* $Id: syscall.S,v 1.15 2004/07/01 01:52:37 royce Exp $
</pre><pre class="diff" id="context">  *
  * FILE:            ntoskrnl/hal/x86/syscall.s
  * PURPOSE:         2E trap handler
</pre><pre class="diff"><small id="info">@@ -28,6 +28,7 @@
</small></pre><pre class="diff" id="context"> #include &lt;ddk/status.h&gt;
 #include &lt;internal/i386/segment.h&gt;
 #include &lt;internal/ps.h&gt;
</pre><pre class="diff" id="added">+#include &lt;internal/i386/ke.h&gt;
</pre><pre class="diff" id="context"> #include &lt;roscfg.h&gt;
 
 #define KernelMode  (0)
</pre><pre class="diff"><small id="info">@@ -41,250 +42,266 @@
</small></pre><pre class="diff" id="context"> .globl _interrupt_handler2e
 _interrupt_handler2e:
 
</pre><pre class="diff" id="removed">-<span id="removedchars">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>/* Construct a trap frame on the stack */
</pre><pre class="diff" id="added">+<span id="addedchars">        </span>/* Construct a trap frame on the stack */
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-           /* Error code */
-           pushl        $0     
-           pushl        %ebp
-           pushl        %ebx
-           pushl        %esi
-           pushl        %edi
-           pushl        %fs
-           /* Load PCR selector into fs */
-           movl                $PCR_SELECTOR, %ebx 
-           movl                %ebx, %fs
-
-           /* Save the old exception list */
-           movl         %fs:KPCR_EXCEPTION_LIST, %ebx
-           pushl        %ebx
-           /* Set the exception handler chain terminator */
-           movl         $0xffffffff, %fs:KPCR_EXCEPTION_LIST
-           /* Get a pointer to the current thread */
-           movl         %fs:KPCR_CURRENT_THREAD, %esi
-           /* Save the old previous mode */
-           movl         $0, %ebx
-           movb         %ss:KTHREAD_PREVIOUS_MODE(%esi), %bl
-           pushl        %ebx
-           /* Set the new previous mode based on the saved CS selector */
-           movl                0x24(%esp), %ebx
-           andl         $0x0000FFFF, %ebx
-           cmpl         $KERNEL_CS, %ebx
-           jne          L1
-           movb         $KernelMode, %ss:KTHREAD_PREVIOUS_MODE(%esi)
-           jmp          L3
</pre><pre class="diff" id="added">+        /* Error code */
+        pushl $0
+        pushl %ebp
+        pushl %ebx
+        pushl %esi
+        pushl %edi
+        pushl %fs
+        /* Load PCR selector into fs */
+        movl  $PCR_SELECTOR, %ebx
+        movl  %ebx, %fs
+
+        /* Save the old exception list */
+        movl  %fs:KPCR_EXCEPTION_LIST, %ebx
+        pushl %ebx
+        /* Set the exception handler chain terminator */
+        movl  $0xffffffff, %fs:KPCR_EXCEPTION_LIST
+        /* Get a pointer to the current thread */
+        movl  %fs:KPCR_CURRENT_THREAD, %esi
+        /* Save the old previous mode */
+        movl  $0, %ebx
+        movb  %ss:KTHREAD_PREVIOUS_MODE(%esi), %bl
+        pushl %ebx
+        /* Set the new previous mode based on the saved CS selector */
+        movl  0x24(%esp), %ebx
+        andl  $0x0000FFFF, %ebx
+        cmpl  $KERNEL_CS, %ebx
+        jne   L1
+        movb  $KernelMode, %ss:KTHREAD_PREVIOUS_MODE(%esi)
+        jmp   L3
</pre><pre class="diff" id="context"> L1:
</pre><pre class="diff" id="removed">-        <span id="removedchars">&nbsp;&nbsp;&nbsp;movb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>  $UserMode, %ss:KTHREAD_PREVIOUS_MODE(%esi)
</pre><pre class="diff" id="added">+        <span id="addedchars">movb</span>  $UserMode, %ss:KTHREAD_PREVIOUS_MODE(%esi)
</pre><pre class="diff" id="context"> L3:
 
</pre><pre class="diff" id="removed">-           /* Save other registers */           
-           pushl %eax
-           pushl %ecx
-           pushl %edx
-           pushl %ds
-           pushl %es
-           pushl %gs
-           pushl $0     /* DR7 */
-           pushl $0     /* DR6 */
-           pushl $0     /* DR3 */
-           pushl $0     /* DR2 */
-           pushl $0     /* DR1 */
-           pushl $0     /* DR0 */
-           pushl $0     /* XXX: TempESP */
-           pushl $0     /* XXX: TempCS */
-           pushl $0     /* XXX: DebugPointer */
-           pushl $0     /* XXX: DebugArgMark */
</pre><pre class="diff" id="added">+        /* Save other registers */
+        pushl %eax
+        pushl %ecx
+        pushl %edx
+        pushl %ds
+        pushl %es
+        pushl %gs
+        pushl $0     /* DR7 */
+        pushl $0     /* DR6 */
+        pushl $0     /* DR3 */
+        pushl $0     /* DR2 */
+        pushl $0     /* DR1 */
+        pushl $0     /* DR0 */
+        pushl $0     /* XXX: TempESP */
+        pushl $0     /* XXX: TempCS */
+        pushl $0     /* XXX: DebugPointer */
+        pushl $0     /* XXX: DebugArgMark */
</pre><pre class="diff" id="context"> #ifdef DBG
</pre><pre class="diff" id="removed">-           /* Trick gdb 6 into backtracing over the system call */
-           movl  4(%ebp), %ebx
-           pushl %ebx   /* DebugEIP */
-           movl  (%ebp), %ebx
-           pushl %ebx   /* DebugEBP */
</pre><pre class="diff" id="added">+        /* Trick gdb 6 into backtracing over the system call */
+        movl  4(%ebp), %ebx
+        pushl %ebx   /* DebugEIP */
+        movl  (%ebp), %ebx
+        pushl %ebx   /* DebugEBP */
</pre><pre class="diff" id="context"> #else
</pre><pre class="diff" id="removed">-           movl         0x60(%esp), %ebx
-           pushl %ebx   /* DebugEIP */
-           pushl %ebp   /* DebugEBP */
</pre><pre class="diff" id="added">+        movl  0x60(%esp), %ebx
+        pushl %ebx   /* DebugEIP */
+        pushl %ebp   /* DebugEBP */
</pre><pre class="diff" id="context"> #endif
 
</pre><pre class="diff" id="removed">-           /* Load the segment registers */
-           movl  $KERNEL_DS, %ebx
-           movl  %ebx, %ds
-           movl  %ebx, %es
-           movl  %ebx, %gs
-
-           /* 
-            * Save the old trap frame pointer over where we would save the EDX
-            * register.
-            */
-           movl KTHREAD_TRAP_FRAME(%esi), %ebx
-           movl %ebx, 0x3C(%esp)
-        
-           /* Save a pointer to the trap frame in the TCB */
-           movl        %esp, KTHREAD_TRAP_FRAME(%esi)
-         
-           /*  Set ES to kernel segment  */
-           movw $KERNEL_DS,%bx
-           movw %bx,%es
-
-           /*  Allocate new Kernel stack frame  */
-           movl %esp,%ebp
-
-           /*  Users's current stack frame pointer is source  */
-           movl %edx,%esi
-
-           /*  Determine system service table to use  */
-           cmpl  $0x0fff, %eax
-           ja    new_useShadowTable
-
-           /*  Check to see if EAX is valid/inrange  */
-           cmpl  %es:_KeServiceDescriptorTable + 8, %eax
-           jbe   new_serviceInRange
-           movl  $STATUS_INVALID_SYSTEM_SERVICE, %eax
-           jmp   KeReturnFromSystemCall
</pre><pre class="diff" id="added">+        /* Load the segment registers */
+        movl  $KERNEL_DS, %ebx
+        movl  %ebx, %ds
+        movl  %ebx, %es
+        movl  %ebx, %gs
+
+        /*
+         * Save the old trap frame pointer over where we would save the EDX
+         * register.
+         */
+        movl  KTHREAD_TRAP_FRAME(%esi), %ebx
+        movl  %ebx, KTRAP_FRAME_EDX(%esp)
+
+        /*  Allocate new Kernel stack frame  */
+        movl  %esp,%ebp
+
+        /* Save a pointer to the trap frame in the TCB */
+        movl  %ebp, KTHREAD_TRAP_FRAME(%esi)
+
+        /*  Set ES to kernel segment  */
+        movw  $KERNEL_DS,%bx
+        movw  %bx,%es
+
+        /*  Users's current stack frame pointer is source  */
+        movl  %edx,%esi
+
+        /*  Determine system service table to use  */
+        cmpl  $0x0fff, %eax
+        ja    new_useShadowTable
+
+        /*  Check to see if EAX is valid/inrange  */
+        cmpl  %es:_KeServiceDescriptorTable + 8, %eax
+        jbe   new_serviceInRange
+        movl  $STATUS_INVALID_SYSTEM_SERVICE, %eax
+        movl  %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME-&gt;Eax */
+        jmp   KeReturnFromSystemCall
</pre><pre class="diff" id="context"> 
 new_serviceInRange:
 
 #ifdef DBG
</pre><pre class="diff" id="removed">-           /* GDB thinks the function starts here and
-              wants a standard prolog, so let's give it */
-           pushl %ebp
-           movl  %esp,%ebp
-           popl  %ebp
</pre><pre class="diff" id="added">+        /* GDB thinks the function starts here and
+           wants a standard prolog, so let's give it */
+        pushl %ebp
+        movl  %esp,%ebp
+        popl  %ebp
</pre><pre class="diff" id="context"> #endif
 
</pre><pre class="diff" id="removed">-           /*  Allocate room for argument list from kernel stack  */
-           movl  %es:_KeServiceDescriptorTable + 12, %ecx
-           movb  %es:(%ecx, %eax), %cl
-           movzx %cl, %ecx
-           subl  %ecx, %esp
-
-           /*  Copy the arguments from the user stack to the kernel stack  */
-           movl %esp,%edi
-           cld
-           rep  movsb
-
-           /*  DS is now also kernel segment  */
-           movw %bx, %ds
-           
-           /* Call system call hook */
-           pushl %eax
-           call _KiSystemCallHook
-           popl %eax
-
-           /*  Make the system service call  */
-           movl  %es:_KeServiceDescriptorTable, %ecx
-           movl  %es:(%ecx, %eax, 4), %eax
-           call  *%eax
</pre><pre class="diff" id="added">+        /*  Allocate room for argument list from kernel stack  */
+        movl  %es:_KeServiceDescriptorTable + 12, %ecx
+        movb  %es:(%ecx, %eax), %cl
+        movzx %cl, %ecx
+        subl  %ecx, %esp
+
+        /*  Copy the arguments from the user stack to the kernel stack  */
+        movl  %esp,%edi
+        cld
+        rep   movsb
+
+        /*  DS is now also kernel segment  */
+        movw  %bx, %ds
+
+        /* Call system call hook */
+        pushl %eax
+        call  _KiSystemCallHook
+        popl  %eax
+
+        /*  Make the system service call  */
+        movl  %es:_KeServiceDescriptorTable, %ecx
+        movl  %es:(%ecx, %eax, 4), %eax
+        call  *%eax
+        movl  %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME-&gt;Eax */
</pre><pre class="diff" id="context"> 
 #if CHECKED
</pre><pre class="diff" id="removed">-<span id="removedchars">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>/*  Bump Service Counter  */
</pre><pre class="diff" id="added">+<span id="addedchars">        </span>/*  Bump Service Counter  */
</pre><pre class="diff" id="context"> #endif
 
</pre><pre class="diff" id="removed">-           /*  Deallocate the kernel stack frame  */
-           movl %ebp,%esp
-
-           /* Call the post system call hook and deliver any pending APCs */
-           pushl %ebp
-           pushl %eax
-           call _KiAfterSystemCallHook
-           addl $8,%esp
-
-           jmp  KeReturnFromSystemCall
</pre><pre class="diff" id="added">+        jmp   KeDeallocateStackAndReturnFromSystemCallWithHook
</pre><pre class="diff" id="context"> 
 new_useShadowTable:
 
</pre><pre class="diff" id="removed">-           subl  $0x1000, %eax
</pre><pre class="diff" id="added">+        subl  $0x1000, %eax
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-           /*  Check to see if EAX is valid/inrange  */
-           cmpl  %es:_KeServiceDescriptorTableShadow + 24, %eax
-           jbe   new_shadowServiceInRange
-           movl  $STATUS_INVALID_SYSTEM_SERVICE, %eax
-           jmp   KeReturnFromSystemCall
</pre><pre class="diff" id="added">+        /*  Check to see if EAX is valid/inrange  */
+        cmpl  %es:_KeServiceDescriptorTableShadow + 24, %eax
+        jbe   new_shadowServiceInRange
+        movl  $STATUS_INVALID_SYSTEM_SERVICE, %eax
+        movl  %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME-&gt;Eax */
+        jmp   KeReturnFromSystemCall
</pre><pre class="diff" id="context"> 
 new_shadowServiceInRange:
 
 #ifdef DBG
</pre><pre class="diff" id="removed">-           /* GDB thinks the function starts here and
-              wants a standard prolog, so let's give it */
-           pushl %ebp
-           movl  %esp,%ebp
-           popl  %ebp
</pre><pre class="diff" id="added">+        /* GDB thinks the function starts here and
+           wants a standard prolog, so let's give it */
+        pushl %ebp
+        movl  %esp,%ebp
+        popl  %ebp
</pre><pre class="diff" id="context"> #endif
 
</pre><pre class="diff" id="removed">-           /*  Allocate room for argument list from kernel stack  */
-           movl  %es:_KeServiceDescriptorTableShadow + 28, %ecx
-           movb  %es:(%ecx, %eax), %cl
-           movzx %cl, %ecx
-           subl  %ecx, %esp
-
-           /*  Copy the arguments from the user stack to the kernel stack  */
-           movl %esp,%edi
-           cld
-           rep movsb
-
-           /*  DS is now also kernel segment  */
-           movw %bx,%ds
-
-           /* Call system call hook */
-//           pushl %eax
-//           call _KiSystemCallHook
-//           popl %eax
-
-           /* Call service check routine */
-           pushl %eax
-           call _KiServiceCheck
-           popl %eax

-           /*  Make the system service call  */
-           movl  %es:_KeServiceDescriptorTableShadow + 16, %ecx
-           movl  %es:(%ecx, %eax, 4), %eax
-           call  *%eax
</pre><pre class="diff" id="added">+        /*  Allocate room for argument list from kernel stack  */
+        movl  %es:_KeServiceDescriptorTableShadow + 28, %ecx
+        movb  %es:(%ecx, %eax), %cl
+        movzx %cl, %ecx
+        subl  %ecx, %esp
+
+        /*  Copy the arguments from the user stack to the kernel stack  */
+        movl  %esp,%edi
+        cld
+        rep   movsb
+
+        /*  DS is now also kernel segment  */
+        movw  %bx,%ds
+
+        /* Call system call hook */
+//        pushl %eax
+//        call  _KiSystemCallHook
+//        popl  %eax
+
+        /* Call service check routine */
+        pushl %eax
+        call  _KiServiceCheck
+        popl  %eax
+
+        /*  Make the system service call  */
+        movl  %es:_KeServiceDescriptorTableShadow + 16, %ecx
+        movl  %es:(%ecx, %eax, 4), %eax
+        call  *%eax
+        movl  %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME-&gt;Eax */
</pre><pre class="diff" id="context"> 
 #if CHECKED
</pre><pre class="diff" id="removed">-           /*  Bump Service Counter  */
</pre><pre class="diff" id="added">+        /* Bump Service Counter  */
</pre><pre class="diff" id="context"> #endif
 
</pre><pre class="diff" id="removed">-           /*  Deallocate the kernel stack frame  */
-           movl %ebp,%esp
-
-KeReturnFromSystemCallWithHook:        
-           /* Call the post system call hook and deliver any pending APCs */
-           pushl %esp
-           pushl %eax
-           call _KiAfterSystemCallHook
-           addl $8,%esp
</pre><pre class="diff" id="added">+KeDeallocateStackAndReturnFromSystemCallWithHook:
+        /* Deallocate the kernel stack frame  */
+        movl %ebp,%esp
+
+KeReturnFromSystemCallWithHook:
+        /* Call the post system call hook and deliver any pending APCs */
+        pushl %esp
+        call  _KiAfterSystemCallHook
+        addl  $4,%esp
</pre><pre class="diff" id="context"> 
 KeReturnFromSystemCall:
</pre><pre class="diff" id="removed">-        
-           /* Restore the user context */
-           /* Get a pointer to the current thread */
-           movl %fs:0x124, %esi
-        
-           /* Restore the old trap frame pointer */
-           movl 0x3c(%esp), %ebx
-           movl %ebx, KTHREAD_TRAP_FRAME(%esi)
-        
-           /* Skip debug information and unsaved registers */
-           addl        $0x30, %esp
-           popl %gs
-           popl %es
-           popl %ds
-           popl %edx
-           popl %ecx
-           addl $0x4, %esp   /* Don't restore eax */
-
-           /* Restore the old previous mode */
-           popl %ebx
-           movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi)
-
-           /* 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
</pre><pre class="diff" id="added">+
+        /* Restore the user context */
+        /* Get a pointer to the current thread */
+        movl  %fs:0x124, %esi
+
+        /* Restore the old trap frame pointer */
+        movl  KTRAP_FRAME_EDX(%esp), %ebx
+        movl  %ebx, KTHREAD_TRAP_FRAME(%esi)
+
+KiRosTrapReturn:
+        /* Skip debug information and unsaved registers */
+        addl  $0x30, %esp
+        popl  %gs
+        popl  %es
+        popl  %ds
+        popl  %edx
+        popl  %ecx
+        popl  %eax
+
+        /* Restore the old previous mode */
+        popl  %ebx
+        movb  %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi)
+
+        /* 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
+
+/* R3: NOTE: This is part of my in-progress attempt at correcting NtContinue
+ *           It is not being called, yet...
+ */
+.globl @KeRosTrapReturn@8
+@KeRosTrapReturn@8:
+        /* Call the post system call hook and deliver any pending APCs */
+        pushl %esp
+        call  _KiAfterSystemCallHook
+        addl  $4,%esp
+
+        /* Restore the user context */
+        /* Get a pointer to the current thread */
+        movl  %fs:0x124, %esi
+        /* Restore the old trap frame pointer */
+        movl  %edx, KTHREAD_TRAP_FRAME(%esi)
+
+        /* point %esp to the trap frame to restore */
+        movl  %ecx, %esp
+        jmp   KiRosTrapReturn;
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos">reactos</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl">ntoskrnl</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke">ke</a>/<a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386">i386</a><br /></span>
<div class="fileheader"><big><b>usercall.c</b></big> <small id="info"><a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c?rev=1.26&amp;content-type=text/x-cvsweb-markup">1.26</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c.diff?r1=text&amp;tr1=1.26&amp;r2=text&amp;tr2=1.27&amp;f=h">-&gt;</a> <a href="http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/i386/usercall.c?rev=1.27&amp;content-type=text/x-cvsweb-markup">1.27</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.26 -r1.27
--- usercall.c        23 Jun 2004 22:32:24 -0000        1.26
+++ usercall.c        1 Jul 2004 01:52:37 -0000        1.27
@@ -1,4 +1,4 @@
</small></pre><pre class="diff" id="removed">-/* $Id: usercall.c,v 1.26 2004/06/23 22:32:24 ion Exp $
</pre><pre class="diff" id="added">+/* $Id: usercall.c,v 1.27 2004/07/01 01:52:37 royce Exp $
</pre><pre class="diff" id="context">  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
</pre><pre class="diff"><small id="info">@@ -26,7 +26,8 @@
</small></pre><pre class="diff" id="context"> 
 /* FUNCTIONS *****************************************************************/
 
</pre><pre class="diff" id="removed">-VOID KiSystemCallHook(ULONG Nr, ...)
</pre><pre class="diff" id="added">+VOID
+KiSystemCallHook(ULONG Nr, ...)
</pre><pre class="diff" id="context"> {
 #if 0
    va_list ap;
</pre><pre class="diff"><small id="info">@@ -46,7 +47,8 @@
</small></pre><pre class="diff" id="context"> #endif
 }
 
</pre><pre class="diff" id="removed">-ULONG KiAfterSystemCallHook(ULONG NtStatus, PKTRAP_FRAME TrapFrame)
</pre><pre class="diff" id="added">+VOID
+KiAfterSystemCallHook(PKTRAP_FRAME TrapFrame)
</pre><pre class="diff" id="context"> {
   if (KeGetCurrentThread()-&gt;Alerted[1] != 0 &amp;&amp; TrapFrame-&gt;Cs != KERNEL_CS)
     {
</pre><pre class="diff"><small id="info">@@ -56,11 +58,11 @@
</small></pre><pre class="diff" id="context">     {
       KiDeliverUserApc(TrapFrame);
     }
</pre><pre class="diff" id="removed">-  return(NtStatus);
</pre><pre class="diff" id="context"> }
 
 
</pre><pre class="diff" id="removed">-VOID KiServiceCheck (ULONG Nr)
</pre><pre class="diff" id="added">+VOID
+KiServiceCheck (ULONG Nr)
</pre><pre class="diff" id="context"> {
   PETHREAD Thread;
 
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.8</small></center>
</body></html>