diff options
Diffstat (limited to 'CPP/Windows/SystemInfo.cpp')
-rw-r--r-- | CPP/Windows/SystemInfo.cpp | 125 |
1 files changed, 103 insertions, 22 deletions
diff --git a/CPP/Windows/SystemInfo.cpp b/CPP/Windows/SystemInfo.cpp index cfc6a90..35846e0 100644 --- a/CPP/Windows/SystemInfo.cpp +++ b/CPP/Windows/SystemInfo.cpp | |||
@@ -530,6 +530,28 @@ struct CCpuName | |||
530 | AString Microcode; | 530 | AString Microcode; |
531 | AString LargePages; | 531 | AString LargePages; |
532 | 532 | ||
533 | #ifdef _WIN32 | ||
534 | UInt32 MHz; | ||
535 | |||
536 | #ifdef MY_CPU_ARM64 | ||
537 | #define Z7_SYS_INFO_SHOW_ARM64_REGS | ||
538 | #endif | ||
539 | #ifdef Z7_SYS_INFO_SHOW_ARM64_REGS | ||
540 | bool Arm64_ISAR0_EL1_Defined; | ||
541 | UInt64 Arm64_ISAR0_EL1; | ||
542 | #endif | ||
543 | #endif | ||
544 | |||
545 | #ifdef _WIN32 | ||
546 | CCpuName(): | ||
547 | MHz(0) | ||
548 | #ifdef Z7_SYS_INFO_SHOW_ARM64_REGS | ||
549 | , Arm64_ISAR0_EL1_Defined(false) | ||
550 | , Arm64_ISAR0_EL1(0) | ||
551 | #endif | ||
552 | {} | ||
553 | #endif | ||
554 | |||
533 | void Fill(); | 555 | void Fill(); |
534 | 556 | ||
535 | void Get_Revision_Microcode_LargePages(AString &s) | 557 | void Get_Revision_Microcode_LargePages(AString &s) |
@@ -537,16 +559,46 @@ struct CCpuName | |||
537 | s.Empty(); | 559 | s.Empty(); |
538 | AddBracedString(s, Revision); | 560 | AddBracedString(s, Revision); |
539 | AddBracedString(s, Microcode); | 561 | AddBracedString(s, Microcode); |
540 | s.Add_OptSpaced(LargePages); | 562 | #ifdef _WIN32 |
563 | if (MHz != 0) | ||
564 | { | ||
565 | s.Add_Space_if_NotEmpty(); | ||
566 | s.Add_UInt32(MHz); | ||
567 | s += " MHz"; | ||
568 | } | ||
569 | #endif | ||
570 | if (!LargePages.IsEmpty()) | ||
571 | s.Add_OptSpaced(LargePages); | ||
572 | } | ||
573 | |||
574 | #ifdef Z7_SYS_INFO_SHOW_ARM64_REGS | ||
575 | void Get_Registers(AString &s) | ||
576 | { | ||
577 | if (Arm64_ISAR0_EL1_Defined) | ||
578 | { | ||
579 | // ID_AA64ISAR0_EL1 | ||
580 | s.Add_OptSpaced("cp4030:"); | ||
581 | PrintHex(s, Arm64_ISAR0_EL1); | ||
582 | { | ||
583 | const unsigned sha2 = ((unsigned)(Arm64_ISAR0_EL1 >> 12) & 0xf) - 1; | ||
584 | if (sha2 < 2) | ||
585 | { | ||
586 | s += ":SHA256"; | ||
587 | if (sha2) | ||
588 | s += ":SHA512"; | ||
589 | } | ||
590 | } | ||
591 | } | ||
541 | } | 592 | } |
593 | #endif | ||
542 | }; | 594 | }; |
543 | 595 | ||
544 | void CCpuName::Fill() | 596 | void CCpuName::Fill() |
545 | { | 597 | { |
546 | CpuName.Empty(); | 598 | // CpuName.Empty(); |
547 | Revision.Empty(); | 599 | // Revision.Empty(); |
548 | Microcode.Empty(); | 600 | // Microcode.Empty(); |
549 | LargePages.Empty(); | 601 | // LargePages.Empty(); |
550 | 602 | ||
551 | AString &s = CpuName; | 603 | AString &s = CpuName; |
552 | 604 | ||
@@ -600,21 +652,32 @@ void CCpuName::Fill() | |||
600 | Revision += GetAnsiString(name); | 652 | Revision += GetAnsiString(name); |
601 | } | 653 | } |
602 | } | 654 | } |
655 | #ifdef _WIN32 | ||
656 | key.GetValue_UInt32_IfOk(TEXT("~MHz"), MHz); | ||
657 | #ifdef Z7_SYS_INFO_SHOW_ARM64_REGS | ||
658 | /* | ||
659 | mapping arm64 registers to Windows registry: | ||
660 | CP 4000: MIDR_EL1 | ||
661 | CP 4020: ID_AA64PFR0_EL1 | ||
662 | CP 4021: ID_AA64PFR1_EL1 | ||
663 | CP 4028: ID_AA64DFR0_EL1 | ||
664 | CP 4029: ID_AA64DFR1_EL1 | ||
665 | CP 402C: ID_AA64AFR0_EL1 | ||
666 | CP 402D: ID_AA64AFR1_EL1 | ||
667 | CP 4030: ID_AA64ISAR0_EL1 | ||
668 | CP 4031: ID_AA64ISAR1_EL1 | ||
669 | CP 4038: ID_AA64MMFR0_EL1 | ||
670 | CP 4039: ID_AA64MMFR1_EL1 | ||
671 | CP 403A: ID_AA64MMFR2_EL1 | ||
672 | */ | ||
673 | if (key.GetValue_UInt64_IfOk(TEXT("CP 4030"), Arm64_ISAR0_EL1) == ERROR_SUCCESS) | ||
674 | Arm64_ISAR0_EL1_Defined = true; | ||
675 | #endif | ||
676 | #endif | ||
603 | LONG res[2]; | 677 | LONG res[2]; |
604 | CByteBuffer bufs[2]; | 678 | CByteBuffer bufs[2]; |
605 | { | 679 | res[0] = key.QueryValue_Binary(TEXT("Previous Update Revision"), bufs[0]); |
606 | for (unsigned i = 0; i < 2; i++) | 680 | res[1] = key.QueryValue_Binary(TEXT("Update Revision"), bufs[1]); |
607 | { | ||
608 | UInt32 size = 0; | ||
609 | res[i] = key.QueryValue(i == 0 ? | ||
610 | TEXT("Previous Update Revision") : | ||
611 | TEXT("Update Revision"), | ||
612 | bufs[i], size); | ||
613 | if (res[i] == ERROR_SUCCESS) | ||
614 | if (size != bufs[i].Size()) | ||
615 | res[i] = ERROR_SUCCESS + 1; | ||
616 | } | ||
617 | } | ||
618 | if (res[0] == ERROR_SUCCESS || res[1] == ERROR_SUCCESS) | 681 | if (res[0] == ERROR_SUCCESS || res[1] == ERROR_SUCCESS) |
619 | { | 682 | { |
620 | for (unsigned i = 0; i < 2; i++) | 683 | for (unsigned i = 0; i < 2; i++) |
@@ -747,9 +810,18 @@ void AddCpuFeatures(AString &s) | |||
747 | unsigned long h = MY_getauxval(AT_HWCAP); | 810 | unsigned long h = MY_getauxval(AT_HWCAP); |
748 | PrintHex(s, h); | 811 | PrintHex(s, h); |
749 | #ifdef MY_CPU_ARM64 | 812 | #ifdef MY_CPU_ARM64 |
813 | #ifndef HWCAP_SHA3 | ||
814 | #define HWCAP_SHA3 (1 << 17) | ||
815 | #endif | ||
816 | #ifndef HWCAP_SHA512 | ||
817 | #define HWCAP_SHA512 (1 << 21) | ||
818 | // #pragma message("=== HWCAP_SHA512 define === ") | ||
819 | #endif | ||
750 | if (h & HWCAP_CRC32) s += ":CRC32"; | 820 | if (h & HWCAP_CRC32) s += ":CRC32"; |
751 | if (h & HWCAP_SHA1) s += ":SHA1"; | 821 | if (h & HWCAP_SHA1) s += ":SHA1"; |
752 | if (h & HWCAP_SHA2) s += ":SHA2"; | 822 | if (h & HWCAP_SHA2) s += ":SHA2"; |
823 | if (h & HWCAP_SHA3) s += ":SHA3"; | ||
824 | if (h & HWCAP_SHA512) s += ":SHA512"; | ||
753 | if (h & HWCAP_AES) s += ":AES"; | 825 | if (h & HWCAP_AES) s += ":AES"; |
754 | if (h & HWCAP_ASIMD) s += ":ASIMD"; | 826 | if (h & HWCAP_ASIMD) s += ":ASIMD"; |
755 | #elif defined(MY_CPU_ARM) | 827 | #elif defined(MY_CPU_ARM) |
@@ -908,13 +980,18 @@ void GetSystemInfoText(AString &sRes) | |||
908 | } | 980 | } |
909 | } | 981 | } |
910 | { | 982 | { |
911 | AString s; | 983 | AString s, registers; |
912 | GetCpuName_MultiLine(s); | 984 | GetCpuName_MultiLine(s, registers); |
913 | if (!s.IsEmpty()) | 985 | if (!s.IsEmpty()) |
914 | { | 986 | { |
915 | sRes += s; | 987 | sRes += s; |
916 | sRes.Add_LF(); | 988 | sRes.Add_LF(); |
917 | } | 989 | } |
990 | if (!registers.IsEmpty()) | ||
991 | { | ||
992 | sRes += registers; | ||
993 | sRes.Add_LF(); | ||
994 | } | ||
918 | } | 995 | } |
919 | /* | 996 | /* |
920 | #ifdef MY_CPU_X86_OR_AMD64 | 997 | #ifdef MY_CPU_X86_OR_AMD64 |
@@ -932,8 +1009,8 @@ void GetSystemInfoText(AString &sRes) | |||
932 | } | 1009 | } |
933 | 1010 | ||
934 | 1011 | ||
935 | void GetCpuName_MultiLine(AString &s); | 1012 | void GetCpuName_MultiLine(AString &s, AString ®isters); |
936 | void GetCpuName_MultiLine(AString &s) | 1013 | void GetCpuName_MultiLine(AString &s, AString ®isters) |
937 | { | 1014 | { |
938 | CCpuName cpuName; | 1015 | CCpuName cpuName; |
939 | cpuName.Fill(); | 1016 | cpuName.Fill(); |
@@ -945,6 +1022,10 @@ void GetCpuName_MultiLine(AString &s) | |||
945 | s.Add_LF(); | 1022 | s.Add_LF(); |
946 | s += s2; | 1023 | s += s2; |
947 | } | 1024 | } |
1025 | registers.Empty(); | ||
1026 | #ifdef Z7_SYS_INFO_SHOW_ARM64_REGS | ||
1027 | cpuName.Get_Registers(registers); | ||
1028 | #endif | ||
948 | } | 1029 | } |
949 | 1030 | ||
950 | 1031 | ||