| 1 | /* |
| 2 | * Copyright (C) 2018 Joseph Benden <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 | */ |
| 18 | |
| 19 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`! |
| 20 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 21 | #endif |
| 22 | |
| 23 | #if defined(__i386__) || defined(__x86_64__cxx . . $ `<built-in>:372:9`!) |
| 24 | #define _X86cxx . . $ `lib/libac/cpu/trampoline_x86.c:24:9`! |
| 25 | #include <cpuid.h> |
| 26 | #else |
| 27 | #error "The wrong CPU architecture file has been included." |
| 28 | #endif |
| 29 | |
| 30 | #include "aircrack-ng/cpu/trampoline.h"cxx . . $ `<file>/include/aircrack-ng/cpu/trampoline.h`/ |
| 31 | |
| 32 | void simd_initcxx . . $ simd_init(49f6e7a06ebc5aa8).(void) {} |
| 33 | |
| 34 | void simd_destroycxx . . $ simd_destroy(49f6e7a06ebc5aa8).(void) {} |
| 35 | |
| 36 | int simd_get_supported_featurescxx . . $ simd_get_supported_features(b126dc7c1de90089).(void) |
| 37 | { |
| 38 | int result = 0; |
| 39 | unsigned eax = 0, ebx = 0, ecx = 0, edx = 0; |
| 40 | unsigned int max_level = __get_cpuid_maxcxx . . $ __get_cpuid_max(a13ea983366c842c).(0, 0); |
| 41 | |
| 42 | __cpuidcxx . . $ `<external>/3640781260184582134/cpuid.h:248:9`!(0, eax, ebx, ecx, edx); |
| 43 | |
| 44 | if (eax >= 1) |
| 45 | { |
| 46 | __cpuidcxx . . $ `<external>/3640781260184582134/cpuid.h:248:9`!(1, eax, ebx, ecx, edx); |
| 47 | } |
| 48 | |
| 49 | if (edx & (1 << 23)) //-V525 |
| 50 | { |
| 51 | result |= SIMD_SUPPORTS_MMXcxx . . $ `include/aircrack-ng/cpu/trampoline.h:27:9`!; |
| 52 | } |
| 53 | |
| 54 | if (edx & (1 << 26)) |
| 55 | { |
| 56 | result |= SIMD_SUPPORTS_SSE2cxx . . $ `include/aircrack-ng/cpu/trampoline.h:28:9`!; |
| 57 | } |
| 58 | |
| 59 | if (ecx & (1 << 28)) |
| 60 | { |
| 61 | result |= SIMD_SUPPORTS_AVXcxx . . $ `include/aircrack-ng/cpu/trampoline.h:29:9`!; |
| 62 | } |
| 63 | |
| 64 | if (max_level >= 7) |
| 65 | { |
| 66 | __cpuid_countcxx . . $ `<external>/3640781260184582134/cpuid.h:254:9`!(7, 0, eax, ebx, ecx, edx); |
| 67 | |
| 68 | if (ebx & (1 << 16)) |
| 69 | { |
| 70 | result |= SIMD_SUPPORTS_AVX512Fcxx . . $ `include/aircrack-ng/cpu/trampoline.h:35:9`!; |
| 71 | } |
| 72 | |
| 73 | if (ebx & (1 << 5)) |
| 74 | { |
| 75 | result |= SIMD_SUPPORTS_AVX2cxx . . $ `include/aircrack-ng/cpu/trampoline.h:30:9`!; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | return (result); |
| 80 | } |