Changeset 54799 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Mar 16, 2015 9:23:03 PM (10 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r54763 r54799 109 109 ifdef VBOX_WITH_VMM_R0_SWITCH_STACK 110 110 VBoxVMM_DEFS += VMM_R0_SWITCH_STACK 111 endif 112 if "$(KBUILD_TYPE)" == "debug" && "$(USERNAME)" == "bird" 113 VBoxVMM_DEFS += RTMEM_WRAP_TO_EF_APIS 111 114 endif 112 115 VBoxVMM_DEFS.darwin = VMM_R0_SWITCH_STACK -
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r54797 r54799 679 679 680 680 /** 681 * Checks that we've updated the CPUID leaves array correctly. 682 * 683 * This is a no-op in non-strict builds. 684 * 685 * @param paLeaves The leaves array. 686 * @param cLeaves The number of leaves. 687 */ 688 static void cpumR3CpuIdAssertOrder(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves) 689 { 690 #ifdef VBOX_STRICT 691 for (uint32_t i = 1; i < cLeaves; i++) 692 if (paLeaves[i].uLeaf != paLeaves[i - 1].uLeaf) 693 AssertMsg(paLeaves[i].uLeaf > paLeaves[i - 1].uLeaf, ("%#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i - 1].uLeaf)); 694 else 695 { 696 AssertMsg(paLeaves[i].uSubLeaf > paLeaves[i - 1].uSubLeaf, 697 ("%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i - 1].uSubLeaf)); 698 AssertMsg(paLeaves[i].fSubLeafMask == paLeaves[i - 1].fSubLeafMask, 699 ("%#x/%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i].fSubLeafMask, paLeaves[i - 1].fSubLeafMask)); 700 AssertMsg(paLeaves[i].fFlags == paLeaves[i - 1].fFlags, 701 ("%#x/%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i].fFlags, paLeaves[i - 1].fFlags)); 702 } 703 #else 704 NOREF(paLeaves); 705 NOREF(cLeaves); 706 #endif 707 } 708 709 710 /** 681 711 * Inserts a CPU ID leaf, replacing any existing ones. 682 712 * … … 782 812 783 813 paLeaves[i] = *pNewLeaf; 814 cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves); 784 815 return VINF_SUCCESS; 785 816 } … … 787 818 /* Find sub-leaf insertion point. */ 788 819 while ( i < cLeaves 789 && paLeaves[i].uSubLeaf < pNewLeaf->uSubLeaf) 820 && paLeaves[i].uSubLeaf < pNewLeaf->uSubLeaf 821 && paLeaves[i].uLeaf == pNewLeaf->uLeaf) 790 822 i++; 791 823 … … 793 825 * If we've got an exactly matching leaf, replace it. 794 826 */ 795 if ( paLeaves[i].uLeaf == pNewLeaf->uLeaf 827 if ( i < cLeaves 828 && paLeaves[i].uLeaf == pNewLeaf->uLeaf 796 829 && paLeaves[i].uSubLeaf == pNewLeaf->uSubLeaf) 797 830 { 798 831 paLeaves[i] = *pNewLeaf; 832 cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves); 799 833 return VINF_SUCCESS; 800 834 } … … 813 847 *pcLeaves += 1; 814 848 paLeaves[i] = *pNewLeaf; 849 850 cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves); 815 851 return VINF_SUCCESS; 816 852 } … … 858 894 *pcLeaves = cLeaves -= (iEnd - iFirst); 859 895 } 896 897 cpumR3CpuIdAssertOrder(paLeaves, *pcLeaves); 860 898 } 861 899 … … 1191 1229 } 1192 1230 1231 cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves); 1193 1232 return VINF_SUCCESS; 1194 1233 } … … 1859 1898 static int cpumR3CpuIdInstallAndExplodeLeaves(PVM pVM, PCPUM pCpum, PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves) 1860 1899 { 1900 cpumR3CpuIdAssertOrder(paLeaves, cLeaves); 1901 1861 1902 /* 1862 1903 * Install the CPUID information. … … 1866 1907 1867 1908 AssertLogRelRCReturn(rc, rc); 1868 1869 1909 pCpum->GuestInfo.cCpuIdLeaves = cLeaves; 1870 1910 pCpum->GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, pCpum->GuestInfo.paCpuIdLeavesR3); 1871 1911 pCpum->GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, pCpum->GuestInfo.paCpuIdLeavesR3); … … 3471 3511 /* 3472 3512 * Load the leaves one by one. 3513 * 3514 * The uPrev stuff is a kludge for working around a week worth of bad saved 3515 * states during the CPUID revamp in March 2015. We saved too many leaves 3516 * due to a bug in cpumR3CpuIdInstallAndExplodeLeaves, thus ending up with 3517 * garbage entires at the end of the array when restoring. We also had 3518 * a subleaf insertion bug that triggered with the leaf 4 stuff below, 3519 * this kludge doesn't deal correctly with that, but who cares... 3473 3520 */ 3521 uint32_t uPrev = 0; 3474 3522 for (uint32_t i = 0; i < cLeaves && RT_SUCCESS(rc); i++) 3475 3523 { … … 3477 3525 rc = SSMR3GetMem(pSSM, &Leaf, sizeof(Leaf)); 3478 3526 if (RT_SUCCESS(rc)) 3479 rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf); 3527 { 3528 if ( uVersion != CPUM_SAVED_STATE_VERSION_BAD_CPUID_COUNT 3529 || Leaf.uLeaf >= uPrev) 3530 { 3531 rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf); 3532 uPrev = Leaf.uLeaf; 3533 } 3534 else 3535 uPrev = UINT32_MAX; 3536 } 3480 3537 } 3481 3538 } -
trunk/src/VBox/VMM/include/CPUMInternal.h
r54737 r54799 123 123 * @{ */ 124 124 /** The current saved state version. */ 125 #define CPUM_SAVED_STATE_VERSION 15 125 #define CPUM_SAVED_STATE_VERSION 16 126 /** CPUID changes with explode forgetting to update the leaf count on 127 * restore, resulting in garbage being saved restoring+saving old states). */ 128 #define CPUM_SAVED_STATE_VERSION_BAD_CPUID_COUNT 15 126 129 /** The saved state version before the CPUIDs changes. */ 127 130 #define CPUM_SAVED_STATE_VERSION_PUT_STRUCT 14
Note:
See TracChangeset
for help on using the changeset viewer.