[libcpu/aarch64] fix cache invalidate operation (#7363)

This commit is contained in:
Shell 2023-04-26 17:17:42 +08:00 committed by GitHub
parent c34608b4a9
commit 6e7c5d9bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -679,7 +679,7 @@ static void _install_page(rt_page_t mpr_head, rt_region_t region, void *insert_h
shadow.start = region.start & ~shadow_mask; shadow.start = region.start & ~shadow_mask;
shadow.end = FLOOR(region.end, shadow_mask + 1); shadow.end = FLOOR(region.end, shadow_mask + 1);
if (shadow.end > UINT32_MAX) if (shadow.end + PV_OFFSET > UINT32_MAX)
_high_page_configured = 1; _high_page_configured = 1;
rt_page_t shad_head = addr_to_page(mpr_head, (void *)shadow.start); rt_page_t shad_head = addr_to_page(mpr_head, (void *)shadow.start);

View File

@ -23,9 +23,13 @@ void rt_hw_cpu_dcache_invalidate(void *start_addr, unsigned long size);
static inline void rt_hw_icache_invalidate_all(void) static inline void rt_hw_icache_invalidate_all(void)
{ {
/* wait for any modification complete */ /* wait for previous modification to complete */
__asm__ volatile ("dsb ishst"); __asm__ volatile ("dsb ishst");
__asm__ volatile ("ic iallu");
__asm__ volatile ("ic ialluis");
/* wait for ic to retire */
__asm__ volatile ("dsb nsh");
/* flush instruction pipeline */
__asm__ volatile ("isb"); __asm__ volatile ("isb");
} }