[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.