From dc21c62431185f7f578c7276ac4e06f91d68e5c4 Mon Sep 17 00:00:00 2001 From: Berthelot Mewen <65554529+bmewen@users.noreply.github.com> Date: Fri, 7 Jun 2024 03:40:35 +0200 Subject: [PATCH] Add missing functions to make RIOT work with the 2.x.x version (#3508) The `os_mremap` and `os_getpagesize` were missing in the `core/shared/platform/riot` and were preventing RIOT from compiling if using WAMR v2.x.x. This PR is adding both functions and should allow RIOT to update WAMR version to v2.x.x. Signed-off-by:: mewen.berthelot --- core/shared/platform/riot/platform_internal.h | 8 ++++++++ core/shared/platform/riot/riot_platform.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/core/shared/platform/riot/platform_internal.h b/core/shared/platform/riot/platform_internal.h index e88b25d4..24a1d6c8 100644 --- a/core/shared/platform/riot/platform_internal.h +++ b/core/shared/platform/riot/platform_internal.h @@ -94,4 +94,12 @@ os_get_invalid_handle() return -1; } +/* There is no MMU in RIOT so the function return 1024 to make the compiler + happy */ +static inline int +os_getpagesize() +{ + return 1024; +} + #endif /* end of _BH_PLATFORM_H */ diff --git a/core/shared/platform/riot/riot_platform.c b/core/shared/platform/riot/riot_platform.c index ad5927e5..9c1fbfa4 100644 --- a/core/shared/platform/riot/riot_platform.c +++ b/core/shared/platform/riot/riot_platform.c @@ -57,6 +57,12 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file) return BH_MALLOC((unsigned)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) {