comparison src/os/windows/vm/os_windows.cpp @ 12018:98aa538fd97e

8022452: Hotspot needs to know about Windows 8.1 and Windows Server 2012 R2 Summary: Add support for recognizing Windows 8.1 and Server 2012 R2 and minor cleanup Reviewed-by: coleenp, dsamersoff
author mikael
date Fri, 09 Aug 2013 09:51:21 -0700
parents af21010d1062
children 3cce976666d9 4c84d351cca9 f92b82d454fa
comparison
equal deleted inserted replaced
12017:6222a021d582 12018:98aa538fd97e
1640 os::win32::print_windows_version(st); 1640 os::win32::print_windows_version(st);
1641 } 1641 }
1642 1642
1643 void os::win32::print_windows_version(outputStream* st) { 1643 void os::win32::print_windows_version(outputStream* st) {
1644 OSVERSIONINFOEX osvi; 1644 OSVERSIONINFOEX osvi;
1645 SYSTEM_INFO si;
1646
1645 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); 1647 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1646 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 1648 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1647 1649
1648 if (!GetVersionEx((OSVERSIONINFO *)&osvi)) { 1650 if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
1649 st->print_cr("N/A"); 1651 st->print_cr("N/A");
1650 return; 1652 return;
1651 } 1653 }
1652 1654
1653 int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion; 1655 int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion;
1656
1657 ZeroMemory(&si, sizeof(SYSTEM_INFO));
1658 if (os_vers >= 5002) {
1659 // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
1660 // find out whether we are running on 64 bit processor or not.
1661 if (os::Kernel32Dll::GetNativeSystemInfoAvailable()) {
1662 os::Kernel32Dll::GetNativeSystemInfo(&si);
1663 } else {
1664 GetSystemInfo(&si);
1665 }
1666 }
1667
1654 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { 1668 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1655 switch (os_vers) { 1669 switch (os_vers) {
1656 case 3051: st->print(" Windows NT 3.51"); break; 1670 case 3051: st->print(" Windows NT 3.51"); break;
1657 case 4000: st->print(" Windows NT 4.0"); break; 1671 case 4000: st->print(" Windows NT 4.0"); break;
1658 case 5000: st->print(" Windows 2000"); break; 1672 case 5000: st->print(" Windows 2000"); break;
1659 case 5001: st->print(" Windows XP"); break; 1673 case 5001: st->print(" Windows XP"); break;
1660 case 5002: 1674 case 5002:
1661 case 6000: 1675 if (osvi.wProductType == VER_NT_WORKSTATION &&
1662 case 6001: 1676 si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
1663 case 6002: { 1677 st->print(" Windows XP x64 Edition");
1664 // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
1665 // find out whether we are running on 64 bit processor or not.
1666 SYSTEM_INFO si;
1667 ZeroMemory(&si, sizeof(SYSTEM_INFO));
1668 if (!os::Kernel32Dll::GetNativeSystemInfoAvailable()){
1669 GetSystemInfo(&si);
1670 } else { 1678 } else {
1671 os::Kernel32Dll::GetNativeSystemInfo(&si); 1679 st->print(" Windows Server 2003 family");
1672 }
1673 if (os_vers == 5002) {
1674 if (osvi.wProductType == VER_NT_WORKSTATION &&
1675 si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
1676 st->print(" Windows XP x64 Edition");
1677 else
1678 st->print(" Windows Server 2003 family");
1679 } else if (os_vers == 6000) {
1680 if (osvi.wProductType == VER_NT_WORKSTATION)
1681 st->print(" Windows Vista");
1682 else
1683 st->print(" Windows Server 2008");
1684 if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
1685 st->print(" , 64 bit");
1686 } else if (os_vers == 6001) {
1687 if (osvi.wProductType == VER_NT_WORKSTATION) {
1688 st->print(" Windows 7");
1689 } else {
1690 // Unrecognized windows, print out its major and minor versions
1691 st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
1692 }
1693 if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
1694 st->print(" , 64 bit");
1695 } else if (os_vers == 6002) {
1696 if (osvi.wProductType == VER_NT_WORKSTATION) {
1697 st->print(" Windows 8");
1698 } else {
1699 st->print(" Windows Server 2012");
1700 }
1701 if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
1702 st->print(" , 64 bit");
1703 } else { // future os
1704 // Unrecognized windows, print out its major and minor versions
1705 st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
1706 if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
1707 st->print(" , 64 bit");
1708 } 1680 }
1709 break; 1681 break;
1710 } 1682
1711 default: // future windows, print out its major and minor versions 1683 case 6000:
1684 if (osvi.wProductType == VER_NT_WORKSTATION) {
1685 st->print(" Windows Vista");
1686 } else {
1687 st->print(" Windows Server 2008");
1688 }
1689 break;
1690
1691 case 6001:
1692 if (osvi.wProductType == VER_NT_WORKSTATION) {
1693 st->print(" Windows 7");
1694 } else {
1695 st->print(" Windows Server 2008 R2");
1696 }
1697 break;
1698
1699 case 6002:
1700 if (osvi.wProductType == VER_NT_WORKSTATION) {
1701 st->print(" Windows 8");
1702 } else {
1703 st->print(" Windows Server 2012");
1704 }
1705 break;
1706
1707 case 6003:
1708 if (osvi.wProductType == VER_NT_WORKSTATION) {
1709 st->print(" Windows 8.1");
1710 } else {
1711 st->print(" Windows Server 2012 R2");
1712 }
1713 break;
1714
1715 default: // future os
1716 // Unrecognized windows, print out its major and minor versions
1712 st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); 1717 st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
1713 } 1718 }
1714 } else { 1719 } else {
1715 switch (os_vers) { 1720 switch (os_vers) {
1716 case 4000: st->print(" Windows 95"); break; 1721 case 4000: st->print(" Windows 95"); break;
1718 case 4090: st->print(" Windows Me"); break; 1723 case 4090: st->print(" Windows Me"); break;
1719 default: // future windows, print out its major and minor versions 1724 default: // future windows, print out its major and minor versions
1720 st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); 1725 st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
1721 } 1726 }
1722 } 1727 }
1728
1729 if (os_vers >= 6000 && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
1730 st->print(" , 64 bit");
1731 }
1732
1723 st->print(" Build %d", osvi.dwBuildNumber); 1733 st->print(" Build %d", osvi.dwBuildNumber);
1724 st->print(" %s", osvi.szCSDVersion); // service pack 1734 st->print(" %s", osvi.szCSDVersion); // service pack
1725 st->cr(); 1735 st->cr();
1726 } 1736 }
1727 1737