Fix compilation errors on zephyr platform (#3255)

Refer to https://github.com/bytecodealliance/wasm-micro-runtime/issues/3252.
This commit is contained in:
Wenyong Huang 2024-03-26 17:55:53 +08:00 committed by GitHub
parent 498eb5d54a
commit 89f4982123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -51,9 +51,7 @@
#endif /* end of KERNEL_VERSION_NUMBER < 0x030200 */
#if KERNEL_VERSION_NUMBER >= 0x030300 /* version 3.3.0 */
#if defined(CONFIG_CPU_CORTEX_M7) && defined(CONFIG_ARM_MPU)
#include <zephyr/cache.h>
#endif
#endif /* end of KERNEL_VERSION_NUMBER > 0x030300 */
#ifdef CONFIG_ARM_MPU
@ -177,4 +175,15 @@ os_get_invalid_handle()
return -1;
}
static inline int
os_getpagesize()
{
#ifdef CONFIG_MMU
return CONFIG_MMU_PAGE_SIZE;
#else
/* Return a default page size if the MMU is not enabled */
return 4096; /* 4KB */
#endif
}
#endif

View File

@ -25,9 +25,11 @@ disable_mpu_rasr_xn(void)
would most likely be set at index 2. */
for (index = 0U; index < 8; index++) {
MPU->RNR = index;
#ifdef MPU_RASR_XN_Msk
if (MPU->RASR & MPU_RASR_XN_Msk) {
MPU->RASR |= ~MPU_RASR_XN_Msk;
}
#endif
}
}
#endif /* end of CONFIG_ARM_MPU */
@ -185,6 +187,12 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
return BH_MALLOC(size);
}
void *
os_mremap(void *old_addr, size_t old_size, size_t new_size)
{
return os_mremap_slow(old_addr, old_size, new_size);
}
void
os_munmap(void *addr, size_t size)
{