ReactOS  0.4.15-dev-5455-g015cd25
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 {
13  KFLOATING_SAVE FloatSave;
14  KIRQL Irql;
15 
16  /* Save the state under normal conditions */
17  Status = KeSaveFloatingPointState(&FloatSave);
18  ok_irql(PASSIVE_LEVEL);
20 
21  /* Restore the FPU state back */
22  KeRestoreFloatingPointState(&FloatSave);
23 
24  /* Try to raise the IRQL to APC and do some operations again */
26 
27  /* Save the state under APC_LEVEL interrupt */
28  Status = KeSaveFloatingPointState(&FloatSave);
29  ok_irql(APC_LEVEL);
31 
32  /* Restore the FPU state back */
33  KeRestoreFloatingPointState(&FloatSave);
34 
35  /* Try to raise the IRQL to dispatch this time */
38 
39  /* Save the state under DISPATCH_LEVEL interrupt */
40  Status = KeSaveFloatingPointState(&FloatSave);
41  ok_irql(DISPATCH_LEVEL);
43 
44  /* We're done */
45  KeRestoreFloatingPointState(&FloatSave);
47 }
LONG NTSTATUS
Definition: precomp.h:26
_Out_ PKIRQL Irql
Definition: csq.h:179
NTSTATUS NTAPI KeRestoreFloatingPointState(_In_ PKFLOATING_SAVE Save)
Restores the original FPU state context that has been saved by a API call of KeSaveFloatingPointState...
Definition: cpu.c:1469
UCHAR KIRQL
Definition: env_spec_w32.h:591
Status
Definition: gdiplustypes.h:24
START_TEST(KeFloatPointState)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
NTSTATUS NTAPI KeSaveFloatingPointState(_Out_ PKFLOATING_SAVE Save)
Saves the current floating point unit state context of the current calling thread.
Definition: cpu.c:1343
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
Definition: spinlock.c:27
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
Definition: spinlock.c:39
#define ok_eq_hex(value, expected)
Definition: NtContinue.c:18
#define APC_LEVEL
Definition: env_spec_w32.h:695