From e2c288b9f19bbbd9ebe513fd24864dd7842ef006 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 26 Jul 2024 01:07:36 +0900 Subject: [PATCH] libwasi: use host_func_memory_getptr/host_func_memory_getptr2 --- libwasi/wasi_abi_path.c | 2 +- libwasi/wasi_abi_poll.c | 5 +++-- libwasi/wasi_abi_random.c | 2 +- libwasi/wasi_subr.c | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libwasi/wasi_abi_path.c b/libwasi/wasi_abi_path.c index 6f8de3e5..9c59d799 100644 --- a/libwasi/wasi_abi_path.c +++ b/libwasi/wasi_abi_path.c @@ -268,7 +268,7 @@ wasi_path_readlink(struct exec_context *ctx, struct host_instance *hi, * https://github.com/bytecodealliance/wasmtime/commit/24b607cf751930c51f2b6449cdfbf2e81dce1c31 */ void *p; - host_ret = memory_getptr(ctx, 0, buf, 0, buflen, &p); + host_ret = host_func_memory_getptr(ctx, 0, buf, 0, buflen, &p); if (host_ret != 0) { goto fail; } diff --git a/libwasi/wasi_abi_poll.c b/libwasi/wasi_abi_poll.c index 9699d7b5..ee83273a 100644 --- a/libwasi/wasi_abi_poll.c +++ b/libwasi/wasi_abi_poll.c @@ -51,7 +51,7 @@ wasi_poll_oneoff(struct exec_context *ctx, struct host_instance *hi, if (host_ret != 0) { goto fail; } - host_ret = memory_getptr(ctx, 0, in, 0, insize, &p); + host_ret = host_func_memory_getptr(ctx, 0, in, 0, insize, &p); if (host_ret != 0) { goto fail; } @@ -62,7 +62,8 @@ wasi_poll_oneoff(struct exec_context *ctx, struct host_instance *hi, if (host_ret != 0) { goto fail; } - host_ret = memory_getptr2(ctx, 0, out, 0, outsize, &p, &moved); + host_ret = + host_func_memory_getptr2(ctx, 0, out, 0, outsize, &p, &moved); if (host_ret != 0) { goto fail; } diff --git a/libwasi/wasi_abi_random.c b/libwasi/wasi_abi_random.c index 78104fdc..112a56ef 100644 --- a/libwasi/wasi_abi_random.c +++ b/libwasi/wasi_abi_random.c @@ -30,7 +30,7 @@ wasi_random_get(struct exec_context *ctx, struct host_instance *hi, uint32_t buflen = HOST_FUNC_PARAM(ft, params, 1, i32); int ret = 0; void *p; - int host_ret = memory_getptr(ctx, 0, buf, 0, buflen, &p); + int host_ret = host_func_memory_getptr(ctx, 0, buf, 0, buflen, &p); if (host_ret != 0) { goto fail; } diff --git a/libwasi/wasi_subr.c b/libwasi/wasi_subr.c index 7f8b9b48..41fc4136 100644 --- a/libwasi/wasi_subr.c +++ b/libwasi/wasi_subr.c @@ -81,8 +81,8 @@ wasi_copyin_iovec(struct exec_context *ctx, uint32_t iov_uaddr, if (host_ret != 0) { goto fail; } - host_ret = memory_getptr(ctx, 0, iov_uaddr, 0, - iov_count * sizeof(struct wasi_iov), &p); + host_ret = host_func_memory_getptr( + ctx, 0, iov_uaddr, 0, iov_count * sizeof(struct wasi_iov), &p); if (host_ret != 0) { goto fail; } @@ -94,8 +94,8 @@ wasi_copyin_iovec(struct exec_context *ctx, uint32_t iov_uaddr, uint32_t iov_len = le32_decode(&iov_in_module[i].iov_len); xlog_trace("iov [%" PRIu32 "] base %" PRIx32 " len %" PRIu32, i, iov_base, iov_len); - host_ret = memory_getptr2(ctx, 0, iov_base, 0, iov_len, &p, - &moved); + host_ret = host_func_memory_getptr2(ctx, 0, iov_base, 0, + iov_len, &p, &moved); if (host_ret != 0) { goto fail; }