iPXE
msr.h
Go to the documentation of this file.
00001 #ifndef _IPXE_MSR_H
00002 #define _IPXE_MSR_H
00003 
00004 /** @file
00005  *
00006  * Model-specific registers
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 /**
00013  * Read model-specific register
00014  *
00015  * @v msr               Model-specific register
00016  * @ret value           Value
00017  */
00018 static inline __attribute__ (( always_inline )) uint64_t
00019 rdmsr ( unsigned int msr ) {
00020         uint64_t value;
00021 
00022         __asm__ __volatile__ ( "rdmsr" : "=A" ( value ) : "c" ( msr ) );
00023         return value;
00024 }
00025 
00026 /**
00027  * Write model-specific register
00028  *
00029  * @v msr               Model-specific register
00030  * @v value             Value
00031  */
00032 static inline __attribute__ (( always_inline )) void
00033 wrmsr ( unsigned int msr, uint64_t value ) {
00034 
00035         __asm__ __volatile__ ( "wrmsr" : : "c" ( msr ), "A" ( value ) );
00036 }
00037 
00038 #endif /* _IPXE_MSR_H */