1 #ifndef _X86INTRIN_H_INCLUDED 2 #error "Never use <pconfigintrin.h> directly; include <x86intrin.h> instead." 3 #endif 4 5 #ifndef _PCONFIGINTRIN_H_INCLUDED 6 #define _PCONFIGINTRIN_H_INCLUDED 7 8 #ifndef __PCONFIG__ 9 #pragma GCC push_options 10 #pragma GCC target("pconfig") 11 #define __DISABLE_PCONFIG__ 12 #endif /* __PCONFIG__ */ 13 14 #define __pconfig_b(leaf, b, retval) \ 15 __asm__ __volatile__ ("pconfig\n\t" \ 16 : "=a" (retval) \ 17 : "a" (leaf), "b" (b) \ 18 : "cc") 19 20 #define __pconfig_generic(leaf, b, c, d, retval) \ 21 __asm__ __volatile__ ("pconfig\n\t" \ 22 : "=a" (retval), "=b" (b), "=c" (c), "=d" (d) \ 23 : "a" (leaf), "b" (b), "c" (c), "d" (d) \ 24 : "cc") 25 26 extern __inline unsigned int 27 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 28 _pconfig_u32 (const unsigned int __L, size_t __D[]) 29 { 30 enum __pconfig_type 31 { 32 __PCONFIG_KEY_PROGRAM = 0x01, 33 }; 34 35 unsigned int __R = 0; 36 37 if (!__builtin_constant_p (__L)) 38 __pconfig_generic (__L, __D[0], __D[1], __D[2], __R); 39 else switch (__L) 40 { 41 case __PCONFIG_KEY_PROGRAM: 42 __pconfig_b (__L, __D[0], __R); 43 break; 44 default: 45 __pconfig_generic (__L, __D[0], __D[1], __D[2], __R); 46 } 47 return __R; 48 } 49 50 #ifdef __DISABLE_PCONFIG__ 51 #undef __DISABLE_PCONFIG__ 52 #pragma GCC pop_options 53 #endif /* __DISABLE_PCONFIG__ */ 54 55 #endif /* _PCONFIGINTRIN_H_INCLUDED */ 56