ReactOS
0.4.16-dev-1067-ge98bba2
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
context.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS Kernel
3
* LICENSE: BSD - See COPYING.ARM in the top level directory
4
* FILE: ntoskrnl/ke/i386/context.c
5
* PURPOSE: Context Switching Related Code
6
* PROGRAMMERS: ReactOS Portable Systems Group
7
*/
8
9
/* INCLUDES *******************************************************************/
10
11
#include <ntoskrnl.h>
12
#define NDEBUG
13
#include <debug.h>
14
15
/* GLOBALS ********************************************************************/
16
17
/* FUNCTIONS ******************************************************************/
18
19
VOID
20
NTAPI
21
KiSwapProcess
(
IN
PKPROCESS
NewProcess,
22
IN
PKPROCESS
OldProcess)
23
{
24
PKIPCR
Pcr = (
PKIPCR
)
KeGetPcr
();
25
#ifdef CONFIG_SMP
26
LONG
SetMember;
27
28
/* Update active processor mask */
29
SetMember = (
LONG
)Pcr->
SetMember
;
30
InterlockedXor
((
PLONG
)&NewProcess->ActiveProcessors, SetMember);
31
InterlockedXor
((
PLONG
)&OldProcess->ActiveProcessors, SetMember);
32
#endif
33
34
/* Check for new LDT */
35
if
(NewProcess->LdtDescriptor.LimitLow != OldProcess->LdtDescriptor.LimitLow)
36
{
37
if
(NewProcess->LdtDescriptor.LimitLow)
38
{
39
KeSetGdtSelector
(
KGDT_LDT
,
40
((
PULONG
)&NewProcess->LdtDescriptor)[0],
41
((
PULONG
)&NewProcess->LdtDescriptor)[1]);
42
Ke386SetLocalDescriptorTable(
KGDT_LDT
);
43
}
44
else
45
{
46
Ke386SetLocalDescriptorTable(0);
47
}
48
}
49
50
/* Update CR3 */
51
__writecr3
(NewProcess->DirectoryTableBase[0]);
52
53
/* Clear GS */
54
Ke386SetGs(0);
55
56
/* Update IOPM offset */
57
Pcr->
TSS
->IoMapBase = NewProcess->IopmOffset;
58
}
59
void
Definition:
nsiface.idl:2307
InterlockedXor
#define InterlockedXor
Definition:
interlocked.h:266
__writecr3
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition:
intrin_x86.h:1808
KeSetGdtSelector
VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2)
Definition:
ldt.c:107
PKIPCR
struct _KIPCR * PKIPCR
KeGetPcr
#define KeGetPcr()
Definition:
ketypes.h:81
KGDT_LDT
#define KGDT_LDT
Definition:
ketypes.h:131
KiSwapProcess
VOID NTAPI KiSwapProcess(IN PKPROCESS NewProcess, IN PKPROCESS OldProcess)
Definition:
context.c:21
LONG
long LONG
Definition:
pedump.c:60
_KIPCR
Definition:
ketypes.h:953
_KIPCR::SetMember
KAFFINITY SetMember
Definition:
ketypes.h:823
_KIPCR::TSS
struct _KTSS * TSS
Definition:
ketypes.h:820
_KPROCESS
Definition:
ketypes.h:2083
PULONG
uint32_t * PULONG
Definition:
typedefs.h:59
NTAPI
#define NTAPI
Definition:
typedefs.h:36
IN
#define IN
Definition:
typedefs.h:39
PLONG
int32_t * PLONG
Definition:
typedefs.h:58
ntoskrnl
ke
i386
context.c
Generated on Fri May 2 2025 06:16:55 for ReactOS by
1.9.6