From patchwork Mon May 27 00:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 799197 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1658364wrw; Sun, 26 May 2024 17:54:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXMTxCicCnKw52vUemZYvaKjQ2pQ3IanUZ0k+v0Ay55g0weV858oZtJPJibH55Lkq9crxmCP8/B+5oyZEcWVUpw X-Google-Smtp-Source: AGHT+IG2Yuvedxb/3i3UfR/VepoJAlnPFsBRe7pF2V/DIzZlyXZxFtTOF0ToY5Ox0Ptm3e/ElYSz X-Received: by 2002:ae9:f44b:0:b0:792:e8e4:71f4 with SMTP id af79cd13be357-794ab0f6f11mr888957085a.58.1716771256772; Sun, 26 May 2024 17:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716771256; cv=none; d=google.com; s=arc-20160816; b=zQLRZTTBFh2Fg0d/d3oV67fmUflJ0m5iBwrPIWKPJYwlqIF8s5nhWRuak5Zw/wxIYd 0MwV/otzY9u1f0Y7hcuCXQsyTcf95YfvoVgwF2bgrfdIjtfWMsANV9fFO1A/rxCd/B5p 1AOCbAc9tffl3l7WYR42L+7iZvy3hOzxHmMN+sFF3IbFiMsTB9rv7H0Bv9MgEpxIPUPm W+5ED3faVyfCMVLaMb4+AYaMuTt4N1vkbe8pCUFfPSh9Mgceoz/BD32le+lJt7l0oJsW 9uowcY2YVurxd5qzM0iWNzgBpd+TgGT9y4vgCzSszyEYrgLc4gKdQCpT0s1L5tp2Y2Yp H/pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pTjFqZGfIgyyuZashU0miJrDlkwdhgdcBxd/4Tmn0sc=; fh=OTkfrEnbNDInppsfj4HB8z6V33zCj7LOct256XBfW6M=; b=bVYBvXWY/3LUhOscNgBsMO0ky7XgaLpUQErv5yDjTVPHJP9BrP6D05tojSFCnqGl/J Ta++VjwrV5+L4+cFo/TmMdiIZvnoorIiEZv9yvlSlJlSfiKQ0UD/LLMG0O2uCeVFzXlP onO3s0uDNARoIUJkTkvLi4bVvW+luvu89nmm3PF/MzPGZV7CR/y4plrxy42YegANbE/s AiwE2D36KtKuM5J/BYrRdW2lK10GPd2fLLbZULlJtqhwbYVnUtzZixuj/SXawqM8yvyl 2s1rCqSAGg1O62oupe/JE+5w+sEpsiBSSMdeNk7x/XJVmLp01i+l6dlc0X0LJdA0+Vb0 TSNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DFfQv3UL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-794abcabd97si682283585a.105.2024.05.26.17.54.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 May 2024 17:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DFfQv3UL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBOZL-0007GS-Mu; Sun, 26 May 2024 20:50:31 -0400 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 1sBOZ8-000775-S3 for qemu-devel@nongnu.org; Sun, 26 May 2024 20:50:18 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBOZ2-0003a2-Tb for qemu-devel@nongnu.org; Sun, 26 May 2024 20:50:18 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6fbbd937719so1507274b3a.0 for ; Sun, 26 May 2024 17:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716771006; x=1717375806; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pTjFqZGfIgyyuZashU0miJrDlkwdhgdcBxd/4Tmn0sc=; b=DFfQv3ULFmGnf3HpQd7rFKZEXnkEE4BCJ1cp0knxse7w4IImx2KqRVT/pw6tbGiF9P 1lm/seR62w2ZwDD2PP2+c6AEiSISJS0oGewVLlNxYzxRb0dRi4o0AWK4KDkts/shBW7y zOtyTiCtprm9N1GYaXsud9B+s6tDiQ5z7BgHCyKqEDIgxnUT7nnSQ1ZgTecTpNaN7bzm 4QdU6Wu6FiNKXj5WM3DCpkjnwd9L3AYT3tOH6+Zxg9iro1PYQEy63GcWtvTlfc2OUpAe n2o94DIHKsqGFBQBIvm1cNwFrNQ6eHEhAXXS2TF0AchHTrFzB1x0iVUM2didqxUd3wBW kzdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716771006; x=1717375806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pTjFqZGfIgyyuZashU0miJrDlkwdhgdcBxd/4Tmn0sc=; b=uLAOH6mO+f8TJX93rKQelSJptlGzp8q5+rW5OwiXeHReG8CNRuGhEABrhwTaxBYRc2 pc+JCc/7zTV/xEgsdqsv0IGSuKkGS3hLR5J/+TCOkorCTGb+sMwzd9eoDo/elvc+rUU9 WBtQNzQ1qdhZnDLMCaiJFbcH4AfqAWjO6oRl2CEAq40Uvtw+tG7A4h+BHFo5kno7mnO/ WBDXp1oAc79EC1HEJlHlL9iatYk9jYtgzsU7omJenSq/aJ2eexyu74H4JHlLNwlzj/pq DpIRR3rXrQ3186hp4qJMrVwNMgd1Oi0wa9XKkHEUIy71ZYrNuHHKLfDrmsYEIlmAj/Q3 9XmQ== X-Gm-Message-State: AOJu0YyGnLo490BnTAV/taxH/ufl4r1fusjWDJzTavGebeV+vfrVZSCx z9I8qTU2BsS5CvPN+2Wm3GLYD516Yu2SggapPqcSB0aeZ+mjTikv8NhuG3Ghop6pSkMt+MJJAxe H X-Received: by 2002:a05:6a00:808c:b0:6f4:5531:7ce4 with SMTP id d2e1a72fcca58-6f8f41b2d8fmr8568683b3a.33.1716771006316; Sun, 26 May 2024 17:50:06 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd6d7598sm3942958b3a.220.2024.05.26.17.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 17:50:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL 05/28] target/i386: Convert do_fstenv to X86Access Date: Sun, 26 May 2024 17:49:38 -0700 Message-Id: <20240527005001.642825-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527005001.642825-1-richard.henderson@linaro.org> References: <20240527005001.642825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Paolo Bonzini Signed-off-by: Richard Henderson --- target/i386/tcg/fpu_helper.c | 45 +++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 5ad6e04639..01e9a1fbbf 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -2373,9 +2373,9 @@ void helper_fxam_ST0(CPUX86State *env) } } -static void do_fstenv(CPUX86State *env, target_ulong ptr, int data32, - uintptr_t retaddr) +static void do_fstenv(X86Access *ac, target_ulong ptr, int data32) { + CPUX86State *env = ac->env; int fpus, fptag, exp, i; uint64_t mant; CPU_LDoubleU tmp; @@ -2402,28 +2402,31 @@ static void do_fstenv(CPUX86State *env, target_ulong ptr, int data32, } if (data32) { /* 32 bit */ - cpu_stl_data_ra(env, ptr, env->fpuc, retaddr); - cpu_stl_data_ra(env, ptr + 4, fpus, retaddr); - cpu_stl_data_ra(env, ptr + 8, fptag, retaddr); - cpu_stl_data_ra(env, ptr + 12, env->fpip, retaddr); /* fpip */ - cpu_stl_data_ra(env, ptr + 16, env->fpcs, retaddr); /* fpcs */ - cpu_stl_data_ra(env, ptr + 20, env->fpdp, retaddr); /* fpoo */ - cpu_stl_data_ra(env, ptr + 24, env->fpds, retaddr); /* fpos */ + access_stl(ac, ptr, env->fpuc); + access_stl(ac, ptr + 4, fpus); + access_stl(ac, ptr + 8, fptag); + access_stl(ac, ptr + 12, env->fpip); /* fpip */ + access_stl(ac, ptr + 16, env->fpcs); /* fpcs */ + access_stl(ac, ptr + 20, env->fpdp); /* fpoo */ + access_stl(ac, ptr + 24, env->fpds); /* fpos */ } else { /* 16 bit */ - cpu_stw_data_ra(env, ptr, env->fpuc, retaddr); - cpu_stw_data_ra(env, ptr + 2, fpus, retaddr); - cpu_stw_data_ra(env, ptr + 4, fptag, retaddr); - cpu_stw_data_ra(env, ptr + 6, env->fpip, retaddr); - cpu_stw_data_ra(env, ptr + 8, env->fpcs, retaddr); - cpu_stw_data_ra(env, ptr + 10, env->fpdp, retaddr); - cpu_stw_data_ra(env, ptr + 12, env->fpds, retaddr); + access_stw(ac, ptr, env->fpuc); + access_stw(ac, ptr + 2, fpus); + access_stw(ac, ptr + 4, fptag); + access_stw(ac, ptr + 6, env->fpip); + access_stw(ac, ptr + 8, env->fpcs); + access_stw(ac, ptr + 10, env->fpdp); + access_stw(ac, ptr + 12, env->fpds); } } void helper_fstenv(CPUX86State *env, target_ulong ptr, int data32) { - do_fstenv(env, ptr, data32, GETPC()); + X86Access ac; + + access_prepare(&ac, env, ptr, 14 << data32, MMU_DATA_STORE, GETPC()); + do_fstenv(&ac, ptr, data32); } static void cpu_set_fpus(CPUX86State *env, uint16_t fpus) @@ -2471,12 +2474,12 @@ static void do_fsave(CPUX86State *env, target_ulong ptr, int data32, { X86Access ac; floatx80 tmp; - int i; + int i, envsize = 14 << data32; - do_fstenv(env, ptr, data32, retaddr); + access_prepare(&ac, env, ptr, envsize + 80, MMU_DATA_STORE, retaddr); - ptr += (target_ulong)14 << data32; - access_prepare(&ac, env, ptr, 80, MMU_DATA_STORE, retaddr); + do_fstenv(&ac, ptr, data32); + ptr += envsize; for (i = 0; i < 8; i++) { tmp = ST(i);