mirror of
https://github.com/ipxe/ipxe
synced 2026-01-13 09:29:04 +03:00
[cpuid] Provide cpuid_supported() to test for supported functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define ERRFILE_gdbmach ( ERRFILE_ARCH | ERRFILE_CORE | 0x000e0000 )
|
||||
#define ERRFILE_rtc_entropy ( ERRFILE_ARCH | ERRFILE_CORE | 0x000f0000 )
|
||||
#define ERRFILE_acpipwr ( ERRFILE_ARCH | ERRFILE_CORE | 0x00100000 )
|
||||
#define ERRFILE_cpuid ( ERRFILE_ARCH | ERRFILE_CORE | 0x00110000 )
|
||||
|
||||
#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
|
||||
#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
|
||||
|
||||
@@ -60,22 +60,22 @@ struct x86_features {
|
||||
/**
|
||||
* Issue CPUID instruction
|
||||
*
|
||||
* @v operation CPUID operation
|
||||
* @v function CPUID function
|
||||
* @v eax Output via %eax
|
||||
* @v ebx Output via %ebx
|
||||
* @v ecx Output via %ecx
|
||||
* @v edx Output via %edx
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
cpuid ( uint32_t operation, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
|
||||
cpuid ( uint32_t function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
|
||||
uint32_t *edx ) {
|
||||
|
||||
__asm__ ( "cpuid"
|
||||
: "=a" ( *eax ), "=b" ( *ebx ), "=c" ( *ecx ), "=d" ( *edx )
|
||||
: "0" ( operation ) );
|
||||
: "0" ( function ) );
|
||||
}
|
||||
|
||||
extern int cpuid_is_supported ( void );
|
||||
extern int cpuid_supported ( uint32_t function );
|
||||
extern void x86_features ( struct x86_features *features );
|
||||
|
||||
#endif /* _IPXE_CPUID_H */
|
||||
|
||||
Reference in New Issue
Block a user