]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
Add cpuid_e[abcd]x() helper wrappers
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 May 2016 10:22:49 +0000 (11:22 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 May 2016 10:23:08 +0000 (11:23 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/lib.h

index a99cd15e765bf2b439938a3079649fbebf5ff6aa..2427a217518616b235b33401a8251ad7431042cd 100644 (file)
@@ -29,6 +29,42 @@ static inline void cpuid(uint32_t leaf,
                   : "0" (leaf));
 }
 
+static inline uint32_t cpuid_eax(uint32_t leaf)
+{
+    uint32_t eax, tmp;
+
+    cpuid(leaf, &eax, &tmp, &tmp, &tmp);
+
+    return eax;
+}
+
+static inline uint32_t cpuid_ebx(uint32_t leaf)
+{
+    uint32_t ebx, tmp;
+
+    cpuid(leaf, &tmp, &ebx, &tmp, &tmp);
+
+    return ebx;
+}
+
+static inline uint32_t cpuid_ecx(uint32_t leaf)
+{
+    uint32_t ecx, tmp;
+
+    cpuid(leaf, &tmp, &tmp, &ecx, &tmp);
+
+    return ecx;
+}
+
+static inline uint32_t cpuid_edx(uint32_t leaf)
+{
+    uint32_t edx, tmp;
+
+    cpuid(leaf, &tmp, &tmp, &tmp, &edx);
+
+    return edx;
+}
+
 static inline void pv_cpuid(uint32_t leaf,
                             uint32_t *eax, uint32_t *ebx,
                             uint32_t *ecx, uint32_t *edx)