VirtualBox

Changeset 81605 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Oct 31, 2019 2:29:46 PM (5 years ago)
Author:
vboxsync
Message:

VMM (and related changes): Add support for Hygon Dhyana CPUs. Modified and improved contribution by Hongyong Zang submitted under MIT license. Thank you!

Location:
trunk/include/iprt
Files:
3 edited

Legend:

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

    r81076 r81605  
    15871587
    15881588/**
     1589 * Tests if it a genuine Hygon CPU based on the ASMCpuId(0) output.
     1590 *
     1591 * @returns true/false.
     1592 * @param   uEBX    EBX return from ASMCpuId(0)
     1593 * @param   uECX    ECX return from ASMCpuId(0)
     1594 * @param   uEDX    EDX return from ASMCpuId(0)
     1595 */
     1596DECLINLINE(bool) ASMIsHygonCpuEx(uint32_t uEBX, uint32_t uECX, uint32_t uEDX)
     1597{
     1598    return uEBX == UINT32_C(0x6f677948)
     1599        && uECX == UINT32_C(0x656e6975)
     1600        && uEDX == UINT32_C(0x6e65476e);
     1601}
     1602
     1603
     1604/**
     1605 * Tests if this is a genuine Hygon CPU.
     1606 *
     1607 * @returns true/false.
     1608 * @remarks ASSUMES that cpuid is supported by the CPU.
     1609 */
     1610DECLINLINE(bool) ASMIsHygonCpu(void)
     1611{
     1612    uint32_t uEAX, uEBX, uECX, uEDX;
     1613    ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
     1614    return ASMIsHygonCpuEx(uEBX, uECX, uEDX);
     1615}
     1616
     1617
     1618/**
    15891619 * Checks whether ASMCpuId_EAX(0x00000000) indicates a valid range.
    15901620 *
  • trunk/include/iprt/x86.h

    r81602 r81605  
    401401#define X86_CPUID_VENDOR_SHANGHAI_ECX   0x20206961      /* ai   */
    402402#define X86_CPUID_VENDOR_SHANGHAI_EDX   0x68676e61      /* angh */
     403
     404#define X86_CPUID_VENDOR_HYGON_EBX      0x6f677948      /* Hygo */
     405#define X86_CPUID_VENDOR_HYGON_ECX      0x656e6975      /* uine */
     406#define X86_CPUID_VENDOR_HYGON_EDX      0x6e65476e      /* nGen */
    403407/** @} */
    404408
  • trunk/include/iprt/x86.mac

    r76886 r81605  
    9191%define X86_CPUID_VENDOR_SHANGHAI_ECX   0x20206961
    9292%define X86_CPUID_VENDOR_SHANGHAI_EDX   0x68676e61
     93%define X86_CPUID_VENDOR_HYGON_EBX      0x6f677948
     94%define X86_CPUID_VENDOR_HYGON_ECX      0x656e6975
     95%define X86_CPUID_VENDOR_HYGON_EDX      0x6e65476e
    9396%define X86_CPUID_FEATURE_ECX_SSE3      RT_BIT_32(0)
    9497%define X86_CPUID_FEATURE_ECX_PCLMUL    RT_BIT_32(1)
Note: See TracChangeset for help on using the changeset viewer.

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