Skip to content

Commit 5d8fe5d

Browse files
authored
platform/nuttx: Flush icache/dcache properly (#4147)
Enhance the os_dcache_flush and os_icache_flush functions to ensure proper cache invalidation, improving memory management efficiency. * Added cache invalidation for data cache * Implemented cache invalidation for instruction cache Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
1 parent 3e20194 commit 5d8fe5d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/shared/platform/nuttx/nuttx_platform.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <nuttx/arch.h>
1111
#endif
1212

13+
#include <nuttx/cache.h>
14+
1315
int
1416
bh_platform_init()
1517
{
@@ -115,11 +117,14 @@ os_dcache_flush()
115117
&& defined(CONFIG_ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS)
116118
up_textheap_data_sync();
117119
#endif
120+
up_invalidate_dcache_all();
118121
}
119122

120123
void
121124
os_icache_flush(void *start, size_t len)
122-
{}
125+
{
126+
up_invalidate_icache((uintptr_t)start, (uintptr_t)start + len);
127+
}
123128

124129
#if (WASM_MEM_DUAL_BUS_MIRROR != 0)
125130
void *

0 commit comments

Comments
 (0)