| 1 |
#include <stdlib.h> |
| 2 |
#include "cpuid.h" |
| 3 |
#ifdef DEBUG |
| 4 |
#include <stdio.h> |
| 5 |
#endif |
| 6 |
|
| 7 |
static void sha_test (void); |
| 8 |
|
| 9 |
static void |
| 10 |
__attribute__ ((noinline)) |
| 11 |
do_test (void) |
| 12 |
{ |
| 13 |
sha_test (); |
| 14 |
} |
| 15 |
|
| 16 |
int |
| 17 |
main () |
| 18 |
{ |
| 19 |
unsigned int eax, ebx, ecx, edx; |
| 20 |
|
| 21 |
if (!__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx)) |
| 22 |
return 0; |
| 23 |
|
| 24 |
/* Run SHA test only if host has SHA support. */ |
| 25 |
if (ebx & bit_SHA) |
| 26 |
{ |
| 27 |
do_test (); |
| 28 |
#ifdef DEBUG |
| 29 |
printf ("PASSED\n"); |
| 30 |
#endif |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
#ifdef DEBUG |
| 35 |
printf ("SKIPPED\n"); |
| 36 |
#endif |
| 37 |
return 0; |
| 38 |
} |