1
1
/*********************************************************
2
* Copyright (C) 1998 VMware, Inc. All rights reserved.
2
* Copyright (C) 1998-2008 VMware, Inc. All rights reserved.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of the GNU Lesser General Public License as published
66
65
CPUIDRegs id88, id8a;
70
*----------------------------------------------------------------------
72
* CPUIDSummary_RegsFromCpuid0 --
74
* Fills in the given CPUIDRegs struct with the values from the CPUID0 struct.
77
* Returns the CPUIDRegs pointer passed in.
82
*----------------------------------------------------------------------
84
static INLINE CPUIDRegs*
85
CPUIDSummary_RegsFromCpuid0(CPUID0* id0In,
88
id0Out->eax = id0In->numEntries;
89
id0Out->ebx = *(uint32 *) (id0In->name + 0);
90
id0Out->edx = *(uint32 *) (id0In->name + 4);
91
id0Out->ecx = *(uint32 *) (id0In->name + 8);
97
*----------------------------------------------------------------------
99
* CPUIDSummary_SafeToUseMC0_CTL --
101
* Determines whether it is safe to write to the MCE control
103
* Known safe: P4, Nahalem, All AMD.
104
* Known not safe: P6, Core, Core2, Penryn
108
* True iff it is known to be safe.
113
*----------------------------------------------------------------------
116
CPUIDSummary_SafeToUseMC0_CTL(CPUIDSummary* cpuidSummary)
120
CPUIDSummary_RegsFromCpuid0(&cpuidSummary->id0, &id0);
121
return CPUID_IsVendorAMD(&id0) ||
122
(CPUID_IsVendorIntel(&id0) &&
123
(CPUID_FAMILY_IS_PENTIUM4(id0.eax) ||
124
CPUID_UARCH_IS_NEHALEM(cpuidSummary->id1.version)));
69
128
/* The following two functions return the number of cores per package
70
129
and set *numThreadsPerCore to the number of hardware threads per core. */
71
130
static INLINE uint32