~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201207201942

« back to all changes in this revision

Viewing changes to modules/freebsd/vmhgfs/x86cpuid.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-23 15:32:00 UTC
  • mfrom: (1.1.2 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081023153200-gc1bfx89hj35c799
Tags: 2008.10.10-123053-2
* Correcting typo in dh_installinit call.
* Downgrading depends on module-assistant to recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*********************************************************
2
 
 * Copyright (C) 1998 VMware, Inc. All rights reserved.
 
2
 * Copyright (C) 1998-2008 VMware, Inc. All rights reserved.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License as published by the
162
162
#define CPUID_INTEL_VENDOR_STRING       "GenuntelineI"
163
163
#define CPUID_AMD_VENDOR_STRING         "AuthcAMDenti"
164
164
#define CPUID_CYRIX_VENDOR_STRING       "CyriteadxIns"
 
165
#define CPUID_HYPERV_HYPERVISOR_VENDOR_STRING  "Microsoft Hv"
165
166
#define CPUID_INTEL_VENDOR_STRING_FIXED "GenuineIntel"
166
167
#define CPUID_AMD_VENDOR_STRING_FIXED   "AuthenticAMD"
167
168
#define CPUID_CYRIX_VENDOR_STRING_FIXED "CyrixInstead"
440
441
FIELDDEFA(88, EAX, COMMON,  0,  8, PHYSBITS,            NA,  IGNORE, 0, FALSE, PHYS_BITS) \
441
442
FIELDDEFA(88, EAX, COMMON,  8,  8, VIRTBITS,            NA,  IGNORE, 0, FALSE, VIRT_BITS) \
442
443
FIELDDEFA(88, ECX, AMD,     0,  8, CORE_COUNT,          NA,  IGNORE, 0, FALSE, AMD_CORE_COUNT) \
443
 
FIELDDEF( 88, ECX, AMD,    12,  4, APICID_COREID_SIZE,  NA,  IGNORE, 0, FALSE)            \
 
444
FIELDDEFA(88, ECX, AMD,    12,  4, APICID_COREID_SIZE,  NA,  IGNORE, 0, FALSE, AMD_APICID_COREID_SIZE) \
444
445
FIELDDEFA(8A, EAX, AMD,     0,  8, SVM_REVISION,        NO,  MASK,   0, FALSE, SVM_REVISION) \
445
446
FLAGDEF(  8A, EAX, AMD,     8,  1, SVM_HYPERVISOR,      NO,  MASK,   0, FALSE)            \
446
447
FIELDDEF( 8A, EAX, AMD,     9, 23, SVMEAX_RSVD,         NO,  MASK,   0, FALSE)            \
640
641
#define CPUID_MODEL_PIII_08    8
641
642
#define CPUID_MODEL_PIII_0A    10
642
643
 
 
644
/*
 
645
 *----------------------------------------------------------------------
 
646
 *
 
647
 * CPUID_IsVendor{AMD,Intel} --
 
648
 *
 
649
 *      Determines if the vendor string in cpuid id0 is from {AMD,Intel}.
 
650
 *
 
651
 * Results:
 
652
 *      True iff vendor string is CPUID_{AMD,INTEL}_VENDOR_STRING
 
653
 *
 
654
 * Side effects:
 
655
 *      None.
 
656
 *
 
657
 *----------------------------------------------------------------------
 
658
 */
 
659
static INLINE Bool
 
660
CPUID_IsRawVendor(CPUIDRegs *id0, const char* vendor)
 
661
{
 
662
   // hard to get strcmp() in some environments, so do it in the raw
 
663
   return (id0->ebx == *(const uint32 *) (vendor + 0) &&
 
664
           id0->ecx == *(const uint32 *) (vendor + 4) &&
 
665
           id0->edx == *(const uint32 *) (vendor + 8));   
 
666
}
 
667
 
 
668
static INLINE Bool
 
669
CPUID_IsVendorAMD(CPUIDRegs *id0)
 
670
{
 
671
   return CPUID_IsRawVendor(id0, CPUID_AMD_VENDOR_STRING);
 
672
}
 
673
 
 
674
static INLINE Bool
 
675
CPUID_IsVendorIntel(CPUIDRegs *id0)
 
676
{
 
677
   return CPUID_IsRawVendor(id0, CPUID_INTEL_VENDOR_STRING);
 
678
}
 
679
 
 
680
 
643
681
static INLINE uint32
644
682
CPUID_EFFECTIVE_FAMILY(uint32 v) /* %eax from CPUID with %eax=1. */
645
683
{
837
875
   if (id0->eax == 0) {
838
876
      return FALSE;
839
877
   }
840
 
   // hard to get strcmp() in some environments, so do it in the raw
841
 
   return (id0->ebx == *(uint32 *) (CPUID_AMD_VENDOR_STRING + 0) &&
842
 
           id0->ecx == *(uint32 *) (CPUID_AMD_VENDOR_STRING + 4) &&
843
 
           id0->edx == *(uint32 *) (CPUID_AMD_VENDOR_STRING + 8));
 
878
   return CPUID_IsVendorAMD(id0);
844
879
}
845
880
 
846
881
static INLINE Bool