Skip to content

Commit

Permalink
Fix compilation errors on zephyr platform (bytecodealliance#3255)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyongh authored Mar 26, 2024
1 parent 2f9e05d commit e9d792d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/shared/platform/zephyr/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
8 changes: 8 additions & 0 deletions core/shared/platform/zephyr/zephyr_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit e9d792d

Please sign in to comment.