From d6b3af6e67cf1bea4adfdeb845a0f128e55881b1 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 26 Feb 2026 20:51:41 +0000 Subject: [PATCH] toolchain: ifc: update mpc api usage --- toolchain/ifc/backend/c-mpc/backend.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/toolchain/ifc/backend/c-mpc/backend.c b/toolchain/ifc/backend/c-mpc/backend.c index cc5844f..dc2ec80 100644 --- a/toolchain/ifc/backend/c-mpc/backend.c +++ b/toolchain/ifc/backend/c-mpc/backend.c @@ -86,8 +86,7 @@ static int emit_header_lib_impl(struct emit_ctx *ctx) /* clang-format off */ emit(ctx, "struct iovec iov = IOVEC(out_hdr, sizeof *out_hdr);\n" - "struct msg kmsg = MSG(&iov, 1, NULL, 0);\n" - "kern_status_t status = msg_recv(channel, 0, out_id, &kmsg);\n" + "kern_status_t status = msg_recv(channel, out_id, &iov, 1);\n" "if (status != KERN_OK) return status;\n" "if (out_hdr->hdr_magic != MSG_MAGIC) return KERN_INVALID_ARGUMENT;\n" "return KERN_OK;\n"); @@ -146,8 +145,7 @@ static int emit_header_lib_impl(struct emit_ctx *ctx) emit(ctx, "struct iovec iov = IOVEC(&resp_data, sizeof resp_data);\n" - "struct msg resp = MSG(&iov, 1, NULL, 0);\n" - "return msg_reply(channel, 0, id, &resp);\n"); + "return msg_reply(channel, id, &iov, 1);\n"); /* clang-format on */ emit_unindent(ctx); @@ -524,12 +522,7 @@ static int emit_interface_msg_function_send_impl( emit_unindent(ctx); emit(ctx, "};\n\n"); - emit(ctx, "struct msg req = MSG(req_iov, %zu, NULL, 0);\n", nr_req_iov); - emit(ctx, - "struct msg resp = MSG(resp_iov, %zu, NULL, 0);\n", - nr_resp_iov); - - emit(ctx, "kern_status_t status = msg_send(port, 0, &req, &resp);\n"); + emit(ctx, "kern_status_t status = msg_send(port, req_iov, %zu, resp_iov, %zu);\n", nr_req_iov, nr_resp_iov); emit(ctx, "if (status != KERN_OK) return status;\n\n"); entry = b_queue_first(&msg->msg_results); @@ -735,8 +728,7 @@ static int emit_interface_msg_function_reply_impl( emit_unindent(ctx); emit(ctx, "};\n\n"); - emit(ctx, "struct msg reply = MSG(iov, %zu, NULL, 0);\n", nr_iov); - emit(ctx, "return msg_reply(channel, 0, id, &reply);\n"); + emit(ctx, "return msg_reply(channel, id, iov, %zu);\n", nr_iov); return 0; }