l2size, ecx & 0xFF);
}
-int get_cpu_vendor(const char v[], enum get_cpu_vendor mode)
+int get_cpu_vendor(uint32_t b, uint32_t c, uint32_t d, enum get_cpu_vendor mode)
{
int i;
static int printed;
for (i = 0; i < X86_VENDOR_NUM; i++) {
if (cpu_devs[i]) {
- if (!strcmp(v,cpu_devs[i]->c_ident[0]) ||
- (cpu_devs[i]->c_ident[1] &&
- !strcmp(v,cpu_devs[i]->c_ident[1]))) {
+ if (cpu_devs[i]->b == b && cpu_devs[i]->c == c &&
+ cpu_devs[i]->d == d) {
if (mode == gcv_host)
this_cpu = cpu_devs[i];
return i;
c->x86_cache_alignment = 32;
/* Get vendor name */
- cpuid(0x00000000, &c->cpuid_level,
- (int *)&c->x86_vendor_id[0],
- (int *)&c->x86_vendor_id[8],
- (int *)&c->x86_vendor_id[4]);
+ cpuid(0x00000000, &c->cpuid_level, &ebx, &ecx, &edx);
+ *(u32 *)&c->x86_vendor_id[0] = ebx;
+ *(u32 *)&c->x86_vendor_id[8] = ecx;
+ *(u32 *)&c->x86_vendor_id[4] = edx;
- c->x86_vendor = get_cpu_vendor(c->x86_vendor_id, gcv_host);
+ c->x86_vendor = get_cpu_vendor(ebx, ecx, edx, gcv_host);
cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
c->x86 = get_cpu_family(eax, &c->x86_model, &c->x86_mask);
u32 eax, ebx, ecx, edx, tmp;
/* Get vendor name */
- cpuid(0x00000000, &c->cpuid_level,
- (int *)&c->x86_vendor_id[0],
- (int *)&c->x86_vendor_id[8],
- (int *)&c->x86_vendor_id[4]);
+ cpuid(0x00000000, &c->cpuid_level, &ebx, &ecx, &edx);
+ *(u32 *)&c->x86_vendor_id[0] = ebx;
+ *(u32 *)&c->x86_vendor_id[8] = ecx;
+ *(u32 *)&c->x86_vendor_id[4] = edx;
- c->x86_vendor = get_cpu_vendor(c->x86_vendor_id, gcv_host);
+ c->x86_vendor = get_cpu_vendor(ebx, ecx, edx, gcv_host);
/* Initialize the standard set of capabilities */
/* Note that the vendor-specific code below might override */
switch ( ctl->input[0] )
{
case 0: {
- union {
- typeof(boot_cpu_data.x86_vendor_id) str;
- struct {
- uint32_t ebx, edx, ecx;
- } reg;
- } vendor_id = {
- .reg = {
- .ebx = ctl->ebx,
- .edx = ctl->edx,
- .ecx = ctl->ecx
- }
- };
int old_vendor = d->arch.x86_vendor;
- d->arch.x86_vendor = get_cpu_vendor(vendor_id.str, gcv_guest);
+ d->arch.x86_vendor = get_cpu_vendor(
+ ctl->ebx, ctl->ecx, ctl->edx, gcv_guest);
if ( is_hvm_domain(d) && (d->arch.x86_vendor != old_vendor) )
{