[NTOS:KE] Add function comments
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 12 Jul 2018 13:36:11 +0000 (15:36 +0200)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 5 Mar 2019 23:39:25 +0000 (00:39 +0100)
ntoskrnl/ke/i386/ctxswitch.S

index bbeb462..1151a02 100644 (file)
@@ -23,6 +23,27 @@ EXTERN _KeI386FxsrPresent:DWORD
 /* FUNCTIONS ****************************************************************/
 .code
 
 /* FUNCTIONS ****************************************************************/
 .code
 
+/*++
+ * KiSwapContextInternal
+ *
+ * \brief
+ *     The KiSwapContextInternal routine switches context to another thread.
+ *
+ * BOOLEAN USERCALL KiSwapContextInternal();
+ *
+ * Params:
+ *     ESI - Pointer to the KTHREAD to which the caller wishes to
+ *           switch to.
+ *     EDI - Pointer to the KTHREAD to which the caller wishes to
+ *           switch from.
+ *
+ * \returns
+ *     APC state.
+ *
+ * \remarks
+ *     Absolutely all registers except ESP can be trampled here for maximum code flexibility.
+ *
+ *--*/
 PUBLIC @KiSwapContextInternal@0
 @KiSwapContextInternal@0:
     /* Build switch frame */
 PUBLIC @KiSwapContextInternal@0
 @KiSwapContextInternal@0:
     /* Build switch frame */
@@ -31,6 +52,33 @@ PUBLIC @KiSwapContextInternal@0
     jmp @KiSwapContextEntry@8
 
 
     jmp @KiSwapContextEntry@8
 
 
+/**
+ * KiSwapContext
+ *
+ * \brief
+ *     The KiSwapContext routine switches context to another thread.
+ *
+ * BOOLEAN FASTCALL
+ * KiSwapContext(PKTHREAD CurrentThread, PKTHREAD TargetThread);
+ *
+ * \param CurrentThread
+ *     Pointer to the KTHREAD of the current thread.
+ *                    
+ * \param TargetThread
+ *     Pointer to the KTHREAD to which the caller wishes to switch to.
+ *
+ * \returns
+ *     The WaitStatus of the Target Thread.
+ *
+ * \remarks
+ *     This is a wrapper around KiSwapContextInternal which will save all the
+ *     non-volatile registers so that the Internal function can use all of
+ *     them. It will also save the old current thread and set the new one.
+ *
+ *     The calling thread does not return after KiSwapContextInternal until 
+ *     another thread switches to IT.
+ *
+ *--*/
 PUBLIC @KiSwapContext@8
 @KiSwapContext@8:
     /* Save 4 registers */
 PUBLIC @KiSwapContext@8
 @KiSwapContext@8:
     /* Save 4 registers */