Skip to contentSkip to conversation

x86/cpuid: propagate further CPUID leafs when -cpu host

PATCH New Andre Przywara 1 participant 1 message Apr 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: propagate further CPUID leafs when -cpu host

-cpu host currently only propagates the CPU's family/model/stepping, the brand name and the feature bits.
Add a whitelist of safe CPUID leafs to let the guest see the actual CPU's cache details and other things. A list of affected leafs is contained in the comments.

---
 target-i386/cpu.h   |    6 +++++-
 target-i386/cpuid.c |   45 +++++++++++++++++++++++++++++++++++++--------
 2 files changed, 42 insertions(+), 9 deletions(-)
target-i386/cpu.h +5 -1
index 548ab80..77cbbdb 100644
@@ -581,6 +581,10 @@ typedef struct {
 
 #define NB_MMU_MODES 2
 
+#define CPUID_FLAGS_BUILTIN          (1 << 0)
+#define CPUID_FLAGS_VENDOR_OVERRIDE  (1 << 1)
+#define CPUID_FLAGS_HOST             (1 << 2) 
+
 typedef struct CPUX86State {
     /* standard registers */
     target_ulong regs[CPU_NB_REGS];
@@ -685,7 +689,7 @@ typedef struct CPUX86State {
     uint32_t cpuid_ext2_features;
     uint32_t cpuid_ext3_features;
     uint32_t cpuid_apic_id;
-    int cpuid_vendor_override;
+    uint32_t cpuid_flags;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
target-i386/cpuid.c +37 -8

101 lines not on this page · raw message

Signature · 1 line
1.6.4