VirtualBox

Changeset 104731 in vbox


Ignore:
Timestamp:
May 20, 2024 4:48:55 PM (10 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163292
Message:

VMM/IEM: Some instruction cache flushing code for linux.arm64, bugref:10391

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp

    r104146 r104731  
    670670    /* sys_dcache_flush(pv, cb); - not necessary */
    671671    sys_icache_invalidate(pv, cb);
     672#elif defined(RT_OS_LINUX)
     673    RT_NOREF(pVCpu);
     674
     675    /* There is __builtin___clear_cache() but it flushes both the instruction and data cache, so do it manually. */
     676    static uint32_t s_u32CtrEl0 = 0;
     677    if (!s_u32CtrEl0)
     678        asm volatile ("mrs %0, ctr_el0":"=r" (s_u32CtrEl0));
     679    uintptr_t cbICacheLine = (uintptr_t)4 << (s_u32CtrEl0 & 0xf);
     680
     681    uintptr_t pb = (uintptr_t)pv & ~(cbICacheLine - 1);
     682    for (; pb < (uintptr_t)pv + cb; pb += cbICacheLine)
     683        asm volatile ("ic ivau, %0" : : "r" (pb) : "memory");
     684
     685    asm volatile ("dsb ish\n\t isb\n\t" : : : "memory");
    672686#else
    673687    RT_NOREF(pVCpu, pv, cb);
Note: See TracChangeset for help on using the changeset viewer.

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