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
8 (i386 implementation by Alex Ionescu)
11 /* INCLUDES ******************************************************************/
16 .globl KiSystemService
20 /* Save and modify srr0 */
21 /* Make a place to store the old srr0 and srr1 ... we may fault
22 * getting KiSystemService1 which will clobber them. */
28 /* Load the target address */
29 lis 1,KiSystemService1@ha
30 addi 1,1,KiSystemService1@l
38 .globl KiSystemService
39 .globl KiSystemService1
98 lis 3,KiSystemService@ha
99 addi 3,3,KiSystemService@l
105 /* Return from kernel */
106 lwz 3,32(1) /* Result */
116 .globl KiDecrementerTrapHandler
117 .globl KiDecrementerTrapHandlerEnd
118 .globl KiDecrementerTrap
119 KiDecrementerTrapHandler:
122 /* Save and modify srr0 */
123 /* Make a place to store the old srr0 and srr1 ... we may fault
124 * getting KiSystemService1 which will clobber them. */
132 /* Load the target address */
133 lis 1,KiDecrementerTrapUpper@ha
134 addi 1,1,KiDecrementerTrapUpper@l
139 KiDecrementerTrapHandlerEnd:
142 /* Decrementer needs to restore the full CPU state */
143 .globl KiDecrementerTrapUpper
145 KiDecrementerTrapUpper:
146 lis 1,_kernel_trap_stack@ha
147 addi 1,1,_kernel_trap_stack@l
150 /* Stack handled a bit later */
193 lwz 29,-24(2) // Stack
194 lwz 30,-28(2) // srr1
195 lwz 31,-32(2) // srr0
199 stw 29,0x60(1) // Stack
200 stw 30,0x110(1) // srr1
201 stw 31,0x114(1) // srr0
248 // back out r0 and r1