Exercises all existing regression tests
| 92 | |
| 93 | // Exercises all existing regression tests |
| 94 | static void test() |
| 95 | { |
| 96 | KFLOATING_SAVE float_save; |
| 97 | NTSTATUS status; |
| 98 | |
| 99 | // Any of Capstone APIs cannot be called at IRQL higher than DISPATCH_LEVEL |
| 100 | // since our malloc implementation using ExAllocatePoolWithTag() is able to |
| 101 | // allocate memory only up to the DISPATCH_LEVEL level. |
| 102 | NT_ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL); |
| 103 | |
| 104 | // On a 32bit driver, KeSaveFloatingPointState() is required before using any |
| 105 | // Capstone function because Capstone can access to the MMX/x87 registers and |
| 106 | // 32bit Windows requires drivers to use KeSaveFloatingPointState() before and |
| 107 | // KeRestoreFloatingPointState() after accessing them. See "Using Floating |
| 108 | // Point or MMX in a WDM Driver" on MSDN for more details. |
| 109 | status = KeSaveFloatingPointState(&float_save); |
| 110 | if (!NT_SUCCESS(status)) { |
| 111 | printf("ERROR: Failed to save floating point state!\n"); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | basic::test(); |
| 116 | detail::test(); |
| 117 | skipdata::test(); |
| 118 | iter::test(); |
| 119 | customized_mnem_::test(); |
| 120 | arm::test(); |
| 121 | arm64::test(); |
| 122 | mips::test(); |
| 123 | m68k::test(); |
| 124 | ppc::test(); |
| 125 | sparc::test(); |
| 126 | systemz::test(); |
| 127 | x86::test(); |
| 128 | xcore::test(); |
| 129 | |
| 130 | // Restores the nonvolatile floating-point context. |
| 131 | KeRestoreFloatingPointState(&float_save); |
| 132 | } |
| 133 | |
| 134 | // Functional test for cs_winkernel_vsnprintf() |
| 135 | static void cs_winkernel_vsnprintf_test() |
no test coverage detected
searching dependent graphs…