From 6067dbb3ab5ed12f704750e5910fe5108cb3933a Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 27 May 2024 12:07:30 +0900 Subject: [PATCH] NuttX: Fix a dbus-related crash on esp32s3 (#3470) Although I don't know what exactly the esp32s3 rom version of memset is, it seems that the current code crashes only with a small "len". I guess it changes the logic depending on the size. Anyway, it's safer to use dbus here. --- core/shared/platform/nuttx/nuttx_platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/shared/platform/nuttx/nuttx_platform.c b/core/shared/platform/nuttx/nuttx_platform.c index f14d49e2..dcefb7e8 100644 --- a/core/shared/platform/nuttx/nuttx_platform.c +++ b/core/shared/platform/nuttx/nuttx_platform.c @@ -53,7 +53,13 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) if ((prot & MMAP_PROT_EXEC) != 0) { p = up_textheap_memalign(sizeof(void *), size); if (p) { +#if (WASM_MEM_DUAL_BUS_MIRROR != 0) + void *dp = os_get_dbus_mirror(p); + memset(dp, 0, size); + os_dcache_flush(); +#else memset(p, 0, size); +#endif } return p; }