2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ke/i386/ctxswitch.S
5 * PURPOSE: Thread Context Switching
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 * Gregor Anich (FPU Code)
11 /* INCLUDES ******************************************************************/
14 .intel_syntax noprefix
16 /* FUNCTIONS ****************************************************************/
18 .globl @KiSwapContextInternal@0
19 .func @KiSwapContextInternal@0, @KiSwapContextInternal@0
20 @KiSwapContextInternal@0:
21 /* Build switch frame */
24 jmp @KiSwapContextEntry@8
27 .globl @KiSwapContext@8
28 .func @KiSwapContext@8, @KiSwapContext@8
30 /* Save 4 registers */
33 /* Save all the non-volatile ones */
39 /* Get the wait IRQL */
42 /* Do the swap with the registers correctly setup */
43 call @KiSwapContextInternal@0
45 /* Return the registers */
56 .globl @KiSwitchThreads@8
57 .func @KiSwitchThreads@8, @KiSwitchThreads@8
59 /* Load the new kernel stack and switch OS to new thread */
61 call @KiSwapContextExit@8
63 /* Now we're on the new thread. Return to the caller to restore registers */
68 .globl @KiRetireDpcListInDpcStack@8
69 .func @KiRetireDpcListInDpcStack@8, @KiRetireDpcListInDpcStack@8
70 @KiRetireDpcListInDpcStack@8:
71 /* Switch stacks and retire DPCs */
75 call @KiRetireDpcList@4
77 /* Return on original stack */
82 /* FIXFIX: Move to C code ****/
83 .globl _Ki386SetupAndExitToV86Mode@4
84 .func Ki386SetupAndExitToV86Mode@4
85 _Ki386SetupAndExitToV86Mode@4:
87 /* Enter V8086 mode */
89 sub esp, (12 + KTRAP_FRAME_LENGTH + NPX_FRAME_LENGTH)
91 call @KiEnterV86Mode@4
95 .globl @Ki386BiosCallReturnAddress@4
96 @Ki386BiosCallReturnAddress@4:
101 add esp, (12 + KTRAP_FRAME_LENGTH + NPX_FRAME_LENGTH)