ReactOS
0.4.16-dev-470-g91b8923
KeFloatPointState.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS kernel-mode tests
3
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4
* PURPOSE: Kernel mode tests for Save/Restore FPU state API kernel support
5
* COPYRIGHT: Copyright 2022 George Bișoc <george.bisoc@reactos.org>
6
*/
7
8
#include <
kmt_test.h
>
9
10
START_TEST
(KeFloatPointState)
11
{
12
NTSTATUS
Status
;
13
KFLOATING_SAVE
FloatSave;
14
KIRQL
Irql
;
15
16
/* Save the state under normal conditions */
17
Status
=
KeSaveFloatingPointState
(&FloatSave);
18
ok_irql(
PASSIVE_LEVEL
);
19
ok_eq_hex
(
Status
,
STATUS_SUCCESS
);
20
21
/* Restore the FPU state back */
22
KeRestoreFloatingPointState
(&FloatSave);
23
24
/* Try to raise the IRQL to APC and do some operations again */
25
KeRaiseIrql
(
APC_LEVEL
, &
Irql
);
26
27
/* Save the state under APC_LEVEL interrupt */
28
Status
=
KeSaveFloatingPointState
(&FloatSave);
29
ok_irql(
APC_LEVEL
);
30
ok_eq_hex
(
Status
,
STATUS_SUCCESS
);
31
32
/* Restore the FPU state back */
33
KeRestoreFloatingPointState
(&FloatSave);
34
35
/* Try to raise the IRQL to dispatch this time */
36
KeLowerIrql
(
Irql
);
37
KeRaiseIrql
(
DISPATCH_LEVEL
, &
Irql
);
38
39
/* Save the state under DISPATCH_LEVEL interrupt */
40
Status
=
KeSaveFloatingPointState
(&FloatSave);
41
ok_irql(
DISPATCH_LEVEL
);
42
ok_eq_hex
(
Status
,
STATUS_SUCCESS
);
43
44
/* We're done */
45
KeRestoreFloatingPointState
(&FloatSave);
46
KeLowerIrql
(
Irql
);
47
}
ok_eq_hex
#define ok_eq_hex(value, expected)
Definition:
apitest.h:77
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
NTSTATUS
LONG NTSTATUS
Definition:
precomp.h:26
Irql
_Out_ PKIRQL Irql
Definition:
csq.h:179
PASSIVE_LEVEL
#define PASSIVE_LEVEL
Definition:
env_spec_w32.h:693
KIRQL
UCHAR KIRQL
Definition:
env_spec_w32.h:591
KeRaiseIrql
#define KeRaiseIrql(irql, oldIrql)
Definition:
env_spec_w32.h:597
APC_LEVEL
#define APC_LEVEL
Definition:
env_spec_w32.h:695
KeLowerIrql
#define KeLowerIrql(oldIrql)
Definition:
env_spec_w32.h:602
DISPATCH_LEVEL
#define DISPATCH_LEVEL
Definition:
env_spec_w32.h:696
Status
Status
Definition:
gdiplustypes.h:25
KeSaveFloatingPointState
#define KeSaveFloatingPointState(x)
Definition:
kmixer.h:32
KeRestoreFloatingPointState
#define KeRestoreFloatingPointState(x)
Definition:
kmixer.h:33
kmt_test.h
STATUS_SUCCESS
#define STATUS_SUCCESS
Definition:
shellext.h:65
_KFLOATING_SAVE
Definition:
ke.h:28
modules
rostests
kmtests
ntos_ke
KeFloatPointState.c
Generated on Wed Jan 15 2025 06:08:32 for ReactOS by
1.9.6