]>
Commit | Line | Data |
---|---|---|
bd3239d2 MF |
1 | __attribute__ ((always_inline)) __attribute__ ((pure)) |
2 | int cpu_has(unsigned short bit) | |
3 | { | |
4 | asm goto ("1: jmp %l[t_no]\n" "2:\n" ".section .altinstructions,\"a\"\n" | |
5 | ".balign 4\n" ".long 1b\n" ".long 0\n" ".word %P0\n" ".byte 2b - 1b\n" ".byte 0\n" | |
6 | ".previous\n"::"i" (bit)::t_no); | |
7 | return 1; | |
8 | t_no:return 0; | |
9 | } | |
10 | ||
11 | union thread_xstate { | |
12 | int swd; | |
13 | int xstate_bv; | |
14 | }; | |
15 | ||
16 | void aes_decrypt(union thread_xstate *state) | |
17 | { | |
18 | if (fpu_usable()) { | |
19 | decrypt(); | |
20 | return; | |
21 | } | |
22 | ||
23 | if (__builtin_constant_p(cpu_has(154)) ? cpu_has(154) : cpu_has(154)) { | |
24 | if (state->xstate_bv) | |
25 | return; | |
26 | } else if (cpu_has(24)) {} | |
27 | ||
28 | if (state->swd) | |
29 | asm volatile ("fnclex"); | |
30 | } | |
31 | ||
32 | void (*funcptr)(void) = aes_decrypt; |