VirtualBox

Changeset 44169 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Dec 19, 2012 5:56:44 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82879
Message:

asm-amd64-x86.h: Added ASMIsViaCentaurCpuEx, ASMIsViaCentaurCpu, ASMIsValidStdRange and ASMIsValidExtRange.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-amd64-x86.h

    r39993 r44169  
    980980
    981981/**
    982  * Tests if it a authentic AMD CPU based on the ASMCpuId(0) output.
     982 * Tests if it an authentic AMD CPU based on the ASMCpuId(0) output.
    983983 *
    984984 * @returns true/false.
     
    10061006    ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
    10071007    return ASMIsAmdCpuEx(uEBX, uECX, uEDX);
     1008}
     1009
     1010
     1011/**
     1012 * Tests if it a centaur hauling VIA CPU based on the ASMCpuId(0) output.
     1013 *
     1014 * @returns true/false.
     1015 * @param   uEBX    EBX return from ASMCpuId(0).
     1016 * @param   uECX    ECX return from ASMCpuId(0).
     1017 * @param   uEDX    EDX return from ASMCpuId(0).
     1018 */
     1019DECLINLINE(bool) ASMIsViaCentaurCpuEx(uint32_t uEBX, uint32_t uECX, uint32_t uEDX)
     1020{
     1021    return uEBX == UINT32_C(0x746e6543)
     1022        && uECX == UINT32_C(0x736c7561)
     1023        && uEDX == UINT32_C(0x48727561);
     1024}
     1025
     1026
     1027/**
     1028 * Tests if this is a centaur hauling VIA CPU.
     1029 *
     1030 * @returns true/false.
     1031 * @remarks ASSUMES that cpuid is supported by the CPU.
     1032 */
     1033DECLINLINE(bool) ASMIsViaCentaurCpu(void)
     1034{
     1035    uint32_t uEAX, uEBX, uECX, uEDX;
     1036    ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
     1037    return ASMIsAmdCpuEx(uEBX, uECX, uEDX);
     1038}
     1039
     1040
     1041/**
     1042 * Checks whether ASMCpuId_EAX(0x00000000) indicates a valid range.
     1043 *
     1044 *
     1045 * @returns true/false.
     1046 * @param   uEAX    The EAX value of CPUID leaf 0x00000000.
     1047 *
     1048 * @note    This only succeeds if there are at least two leaves in the range.
     1049 * @remarks The upper range limit is just some half reasonable value we've
     1050 *          picked out of thin air.
     1051 */
     1052DECLINLINE(bool) ASMIsValidStdRange(uint32_t uEAX)
     1053{
     1054    return uEAX >= UINT32_C(0x00000001) && uEAX <= UINT32_C(0x000fffff);
     1055}
     1056
     1057
     1058/**
     1059 * Checks whether ASMCpuId_EAX(0x80000000) indicates a valid range.
     1060 *
     1061 * This only succeeds if there are at least two leaves in the range.
     1062 *
     1063 * @returns true/false.
     1064 * @param   uEAX    The EAX value of CPUID leaf 0x80000000.
     1065 *
     1066 * @note    This only succeeds if there are at least two leaves in the range.
     1067 * @remarks The upper range limit is just some half reasonable value we've
     1068 *          picked out of thin air.
     1069 */
     1070DECLINLINE(bool) ASMIsValidExtRange(uint32_t uEAX)
     1071{
     1072    return uEAX >= UINT32_C(0x80000001) && uEAX <= UINT32_C(0x800fffff);
    10081073}
    10091074
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette