From nobody Fri Apr 4 21:11:18 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1741377401; cv=none; d=zohomail.com; s=zohoarc; b=HiyD5UTv2cv2xI954Z7GKHl9cLC/EK/xkByWcR7gInogfzjYYAyNgC/iddaNlzk9P0REiwFsHBTFCYaItFmhqm0UgdEelQCBuNNG7qFxFw21RZLFakY4a+GE1OcHGMdY2a1IuDwNGZNluxZenWZmtpXcqbnK6rNVrlIYggULyQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741377401; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=emdIj3k5ujCrejeEldBaJ9iIGKoFw1OvrMFlb+8p+lI=; b=F0CN912kpoBdNJOiyLG8BvAWiXHq9MvuXc5fUzVMVs5dhFpgVqMyMLI62VvaOw2DGU/y46AtX+ai7CSGm0mnp9LkTeXSKIDfTdZbB1Chat496Bf9Gqzul4Qesirk5kEJ4onMhsYzoex5dTr+ko7MM0sD3GtAtSKHxVxgCPYVqK0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741377401444513.4625778729312; Fri, 7 Mar 2025 11:56:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqdnz-00086T-M8; Fri, 07 Mar 2025 14:56:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqdnM-0007zQ-9F for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:55:44 -0500 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqdnK-0005ik-HI for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:55:44 -0500 Received: by linux.microsoft.com (Postfix, from userid 1031) id 586132038F40; Fri, 7 Mar 2025 11:55:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 586132038F40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1741377336; bh=emdIj3k5ujCrejeEldBaJ9iIGKoFw1OvrMFlb+8p+lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KS3XKdNsq9Eda3Rp2GVNtwCR5yn++2fvKLkM7wHhDHlj6XiZ2qV+a3KT3sd3MWaqU YmsSZwSTI1FsVwEcDxauSLjUmsDbEie/coh1wF/DTAC00O+nCBrB+1EVlwOw7N4sPg 5IHPjUV1rTs84HlM7BA+FIkfOG4bVueS/LZW/CAs= From: Wei Liu To: qemu-devel@nongnu.org Cc: wei.liu@kernel.org, dirty@apple.com, rbolshakov@ddn.com, phil@philjordan.eu, jinankjain@linux.microsoft.com, liuwe@microsoft.com, muislam@microsoft.com, ziqiaozhou@microsoft.com, mukeshrathor@microsoft.com, magnuskulke@microsoft.com, prapal@microsoft.com, jpiotrowski@microsoft.com, deviv@microsoft.com, Wei Liu Subject: [PATCH v2 06/14] taret/i386/hvf: provide and use write_mem in emul_ops Date: Fri, 7 Mar 2025 11:55:17 -0800 Message-Id: <1741377325-28175-7-git-send-email-liuwe@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1741377325-28175-1-git-send-email-liuwe@linux.microsoft.com> References: <1741377325-28175-1-git-send-email-liuwe@linux.microsoft.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=13.77.154.182; envelope-from=liuwe@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linux.microsoft.com) X-ZM-MESSAGEID: 1741377402437019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 6 ++++++ target/i386/hvf/x86_emu.c | 8 ++++---- target/i386/hvf/x86_emu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 1cecb765952b..e4f48a79fb7c 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -242,8 +242,14 @@ static void hvf_read_mem(CPUState *cpu, void *data, ta= rget_ulong gva, int bytes) vmx_read_mem(cpu, data, gva, bytes); } =20 +static void hvf_write_mem(CPUState *cpu, void *data, target_ulong gva, int= bytes) +{ + vmx_write_mem(cpu, gva, data, bytes); +} + static const struct x86_emul_ops hvf_x86_emul_ops =3D { .read_mem =3D hvf_read_mem, + .write_mem =3D hvf_write_mem, .read_segment_descriptor =3D hvf_read_segment_descriptor, .handle_io =3D hvf_handle_io, }; diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index 7b816b5a1dab..3ff41c35d89a 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -179,7 +179,7 @@ void write_val_ext(CPUX86State *env, target_ulong ptr, = target_ulong val, int siz write_val_to_reg(ptr, val, size); return; } - vmx_write_mem(env_cpu(env), ptr, &val, size); + emul_ops->write_mem(env_cpu(env), &val, ptr, size); } =20 uint8_t *read_mmio(CPUX86State *env, target_ulong ptr, int bytes) @@ -489,8 +489,8 @@ static void exec_ins_single(CPUX86State *env, struct x8= 6_decode *decode) =20 emul_ops->handle_io(env_cpu(env), DX(env), env->emu_mmio_buf, 0, decode->operand_size, 1); - vmx_write_mem(env_cpu(env), addr, env->emu_mmio_buf, - decode->operand_size); + emul_ops->write_mem(env_cpu(env), env->emu_mmio_buf, addr, + decode->operand_size); =20 string_increment_reg(env, R_EDI, decode); } @@ -596,7 +596,7 @@ static void exec_stos_single(CPUX86State *env, struct x= 86_decode *decode) addr =3D linear_addr_size(env_cpu(env), RDI(env), decode->addressing_size, R_ES); val =3D read_reg(env, R_EAX, decode->operand_size); - vmx_write_mem(env_cpu(env), addr, &val, decode->operand_size); + emul_ops->write_mem(env_cpu(env), &val, addr, decode->operand_size); =20 string_increment_reg(env, R_EDI, decode); } diff --git a/target/i386/hvf/x86_emu.h b/target/i386/hvf/x86_emu.h index 40cc786694e1..107c1f1ac866 100644 --- a/target/i386/hvf/x86_emu.h +++ b/target/i386/hvf/x86_emu.h @@ -25,6 +25,7 @@ =20 struct x86_emul_ops { void (*read_mem)(CPUState *cpu, void *data, target_ulong addr, int byt= es); + void (*write_mem)(CPUState *cpu, void *data, target_ulong addr, int by= tes); void (*read_segment_descriptor)(CPUState *cpu, struct x86_segment_desc= riptor *desc, enum X86Seg seg); void (*handle_io)(CPUState *cpu, uint16_t port, void *data, int direct= ion, --=20 2.47.2