Changeset 105606 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 6, 2024 2:14:55 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r105593 r105606 777 777 778 778 /** @todo graduate this to cdefs.h or asm-mem.h. */ 779 # ifdef RT_ARCH_ARM64 /** @todo RT_CACHELINE_SIZE is wrong for M1 */ 780 # undef RT_CACHELINE_SIZE 781 # define RT_CACHELINE_SIZE 128 782 # endif 783 779 784 # if defined(_MM_HINT_T0) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) 780 # define MY_PREFETCH(a_pvAddr) _mm_prefetch((const char *)(a_pvAddr), _MM_HINT_T0) ;785 # define MY_PREFETCH(a_pvAddr) _mm_prefetch((const char *)(a_pvAddr), _MM_HINT_T0) 781 786 # elif defined(_MSC_VER) && (defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) 782 # define MY_PREFETCH(a_pvAddr) __prefetch((a_pvAddr)) ;787 # define MY_PREFETCH(a_pvAddr) __prefetch((a_pvAddr)) 783 788 # elif defined(__GNUC__) || RT_CLANG_HAS_FEATURE(__builtin_prefetch) 784 789 # define MY_PREFETCH(a_pvAddr) __builtin_prefetch((a_pvAddr), 0 /*rw*/, 3 /*locality*/) 785 790 # else 786 791 # define MY_PREFETCH(a_pvAddr) ((void)0) 792 # endif 793 # if 0 794 # undef MY_PREFETCH 795 # define MY_PREFETCH(a_pvAddr) ((void)0) 796 # endif 797 798 /** @def MY_PREFETCH_64 799 * 64 byte prefetch hint, could be more depending on cache line size. */ 800 /** @def MY_PREFETCH_128 801 * 128 byte prefetch hint. */ 802 /** @def MY_PREFETCH_256 803 * 256 byte prefetch hint. */ 804 # if RT_CACHELINE_SIZE >= 128 805 /* 128 byte cache lines */ 806 # define MY_PREFETCH_64(a_pvAddr) MY_PREFETCH(a_pvAddr) 807 # define MY_PREFETCH_128(a_pvAddr) MY_PREFETCH(a_pvAddr) 808 # define MY_PREFETCH_256(a_pvAddr) do { \ 809 MY_PREFETCH(a_pvAddr); \ 810 MY_PREFETCH((uint8_t const *)a_pvAddr + 128); \ 811 } while (0) 812 # else 813 /* 64 byte cache lines */ 814 # define MY_PREFETCH_64(a_pvAddr) MY_PREFETCH(a_pvAddr) 815 # define MY_PREFETCH_128(a_pvAddr) do { \ 816 MY_PREFETCH(a_pvAddr); \ 817 MY_PREFETCH((uint8_t const *)a_pvAddr + 64); \ 818 } while (0) 819 # define MY_PREFETCH_256(a_pvAddr) do { \ 820 MY_PREFETCH(a_pvAddr); \ 821 MY_PREFETCH((uint8_t const *)a_pvAddr + 64); \ 822 MY_PREFETCH((uint8_t const *)a_pvAddr + 128); \ 823 MY_PREFETCH((uint8_t const *)a_pvAddr + 192); \ 824 } while (0) 787 825 # endif 788 826 … … 809 847 /** @todo benchmark this code from the guest side. */ 810 848 bool const fPartialScan = IEMTLB_ENTRY_COUNT > (a_f2MbLargePage ? 512 : 1024); 811 uintptr_t idxEven = fPartialScan ? IEMTLB_TAG_TO_EVEN_INDEX(GCPtrTag) : 0; 812 MY_PREFETCH(&pTlb->aEntries[0 + !a_fNonGlobal]); 813 MY_PREFETCH(&pTlb->aEntries[2 + !a_fNonGlobal]); 814 MY_PREFETCH(&pTlb->aEntries[4 + !a_fNonGlobal]); 815 MY_PREFETCH(&pTlb->aEntries[6 + !a_fNonGlobal]); 849 uintptr_t idxEven = fPartialScan ? IEMTLB_TAG_TO_EVEN_INDEX(GCPtrTag) : 0; 850 MY_PREFETCH_256(&pTlb->aEntries[0 + !a_fNonGlobal]); 816 851 uintptr_t const idxEvenEnd = fPartialScan ? idxEven + ((a_f2MbLargePage ? 512 : 1024) * 2) : IEMTLB_ENTRY_COUNT * 2; 817 852 RTGCPTR const GCPtrTagMask = fPartialScan ? ~(RTGCPTR)0 … … 863 898 GCPtrTagGlob++; \ 864 899 } 865 if (idxEven < idxEvenEnd - 8) 866 { 867 MY_PREFETCH(&pTlb->aEntries[idxEven + 8 + !a_fNonGlobal]); 868 MY_PREFETCH(&pTlb->aEntries[idxEven + 10 + !a_fNonGlobal]); 869 MY_PREFETCH(&pTlb->aEntries[idxEven + 12 + !a_fNonGlobal]); 870 MY_PREFETCH(&pTlb->aEntries[idxEven + 14 + !a_fNonGlobal]); 871 } 900 if (idxEven < idxEvenEnd - 4) 901 MY_PREFETCH_256(&pTlb->aEntries[idxEven + 8 + !a_fNonGlobal]); 872 902 ONE_ITERATION(idxEven) 873 903 ONE_ITERATION(idxEven + 2)
Note:
See TracChangeset
for help on using the changeset viewer.