[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 3/6] plat/common: Provide rdmsr amd rdmsrl for x86
Reviewed-by: Gaulthier Gain <gaulthier.gain@xxxxxxxxx> ----- Mail original ----- De: "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx> À: minios-devel@xxxxxxxxxxxxx Cc: "Gaulthier Gain" <gaulthier.gain@xxxxxxxxx>, "Felipe Huici" <felipe.huici@xxxxxxxxx>, "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx> Envoyé: Jeudi 5 Décembre 2019 15:02:19 Objet: [UNIKRAFT PATCH 3/6] plat/common: Provide rdmsr amd rdmsrl for x86 The model-specific registers (MSR) are used for querying and programming some CPU features on x86. `rdmsr` and `rdmsrl` are macros for reading the register values. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- plat/common/include/x86/cpu.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h index 3bec2b58..120eb86d 100644 --- a/plat/common/include/x86/cpu.h +++ b/plat/common/include/x86/cpu.h @@ -175,6 +175,20 @@ static inline void invlpg(unsigned long va) } +static inline void rdmsr(unsigned int msr, __u32 *lo, __u32 *hi) +{ + asm volatile("rdmsr" : "=a"(*lo), "=d"(*hi) + : "c"(msr)); +} + +static inline __u64 rdmsrl(unsigned int msr) +{ + __u32 lo, hi; + + rdmsr(msr, &lo, &hi); + return ((__u64) lo | (__u64) hi << 32); +} + static inline void wrmsr(unsigned int msr, __u32 lo, __u32 hi) { asm volatile("wrmsr" -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |