From patchwork Tue Apr 9 05:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 787168 Delivered-To: patch@linaro.org Received: by 2002:adf:fdd2:0:b0:346:15ad:a2a with SMTP id i18csp57231wrs; Mon, 8 Apr 2024 22:04:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX3fRfTYylUzO18N7U9zOQAU1KRuiDFClnjBu7BfOUZ1Pjse0XFob/zhJBQXZFKUllFB3dMh1jNWujL+Gdidiqp X-Google-Smtp-Source: AGHT+IGz+YD5Dom88TeSWshBRM9Qw+uAa+LS8CtbCRndKUmpwN42LUuZHD8oeRSynRqM8tmWundV X-Received: by 2002:a05:6214:ccf:b0:699:1b4e:86dd with SMTP id 15-20020a0562140ccf00b006991b4e86ddmr14369300qvx.46.1712639091228; Mon, 08 Apr 2024 22:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712639091; cv=none; d=google.com; s=arc-20160816; b=t9rwl62y72YNoRgJ57wzeQFGJzqz1dOT6LmFu0CnwH8+N7D3ngIY7NtX2lHRl7so/l 8xaspj8vd6dzNkF3fiXUWd77bdTCwJwDVXiXydLIFxox42YDfel4xjSfheYcl7sLsu6H iYoFhobVPrgvZG0smG4hCqXbe17HhKpCxaUI0Teah+YHYL53/dyhTaAkwz33WJZ0kCGB RCdFSpXK6F/QCKLcQw5wlDGj8HSPSkDVtaVDouGg8JZGOz/8zUoxcaE5Ua2Yqx5mFaZW TY6jRlRHJm7/+FF7rw18pSG7Bsj1ymEcNiWpGz4vnbeY1BcyoFygkkjjRzVW6mK1kKLf ueyQ== 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:to:from :dkim-signature; bh=eh7OtO5x8MRpHpQMvxE89QnFoiPmlYi26LFAKoMr5Dg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NyoXkf22ZCKqtX654G1PqnLgbpuWtaODRo09DiczE1ntIJw2eVFClvjTJhPdGFJp7Q fShaMe2XVQtFMGCAp4Ww9K8zs9o1Gw/SF/rxleSsec0T5hZv9DCDqiF5cNcT+i2oy4Ib FJwRE0FB0mvfRPNqKRKfm9FTBNdF1uvXKlPhkqCfjVAIB8pMYCenPqTrOXtVtqWDxwG1 mEOKC2I3dlIb+E6iuEs+3ql+rBhbRTkQKeiVfG3w6/SL3eRYWhc7Q2sgLbQQGIOvFDTo 7ULLw01MZANezosVLH3xzWYfHzuD1z7PdDdrVal7D9U67CZlt3RIWCt2e1/d0zboVqEi p9zA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wzjEoodv; 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 v14-20020a0cf90e000000b0069943127002si8853664qvn.318.2024.04.08.22.04.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 22:04:51 -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=wzjEoodv; 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 1ru3dd-00037r-QU; Tue, 09 Apr 2024 01:03:17 -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 1ru3dc-00037M-B5 for qemu-devel@nongnu.org; Tue, 09 Apr 2024 01:03:16 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ru3da-0005EP-KG for qemu-devel@nongnu.org; Tue, 09 Apr 2024 01:03:16 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6ecf3943040so3483635b3a.0 for ; Mon, 08 Apr 2024 22:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712638993; x=1713243793; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eh7OtO5x8MRpHpQMvxE89QnFoiPmlYi26LFAKoMr5Dg=; b=wzjEoodvMruifXDvp6NWS6chqrAXoBp0rCntuLQtEg2TAcjb2Rsk4j7ALS9yquPucR 53oWQ00OZ4HF3nV7RCd6J+ZXN8hG+2RedrHvOZsqi8Tv2ajvkGLXEKPqAFuov/1kA1ND d2wbwgEOaKaY0wwk0B3JquWWtKpBUSgmy32RfQIOzz8hTYTFj+eFLcjE6k/R2rYCzYKO U0jUVqyqoAPFAGv9n8Jp/KtgHPerqk102fM4/1WhhggnNZiHCnZ2r9y0Mj81unKQN6qQ MwLdGp1E5Y1XS8bX+Z09Nt17N5l/f+tva/TaeYawv22+EOAiyQrTsSfrpXOGr64RX5L8 RY6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712638993; x=1713243793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eh7OtO5x8MRpHpQMvxE89QnFoiPmlYi26LFAKoMr5Dg=; b=tMNZFjozwGhinS1edV/JySNWBDDNPDdnobIVPlntA0F8q1WJxrOUDo3mCk7ykOtBZN PvFrXP03K1p2ENtSq4u68hWDvVq9Vs4w04Ktn4UcPcnx0RLa22psosprEiiYITu0XJ+0 uMNvNyIwUQDFuqY+YyLx4fast9tcNPqgykbpO+mVV+PVsitDnTtj69qovxoxq7elhK5Y /ORvqONkHMci3OH4KbyauztElEFw1r0n6FewDWjSH7MPTedMcXMYXCQsiyIX2f6Bbh88 H7bsiEOs8cSHdTcFh7s1SzRSqU32ChmNkFeD7i2r0LFRoWNk19H1kJmtIH1LexAnoKcj YuDQ== X-Gm-Message-State: AOJu0YxZA/gT1K193Z0B4DAlIhMb7R/WAd2UzFwLFS/YQtb9O4MZ365r wdp9uhsISGkWAmCEwG+I706zWrL4mTRZCoqcBV9BSw1nM1Xp63guGaOGSj8W1X/BJtA6YERmsLQ P X-Received: by 2002:a05:6a20:431c:b0:1a7:a6f3:1822 with SMTP id h28-20020a056a20431c00b001a7a6f31822mr1107931pzk.12.1712638992770; Mon, 08 Apr 2024 22:03:12 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id z26-20020aa785da000000b006e64ddfa71asm7654894pfn.170.2024.04.08.22.03.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 22:03:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/28] target/i386: Convert do_fsave, do_frstor to X86Access Date: Mon, 8 Apr 2024 19:02:40 -1000 Message-Id: <20240409050302.1523277-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409050302.1523277-1-richard.henderson@linaro.org> References: <20240409050302.1523277-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 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 Signed-off-by: Richard Henderson --- target/i386/tcg/fpu_helper.c | 60 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index 25074af0ce..e6fa161aa0 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -2468,21 +2468,16 @@ void helper_fldenv(CPUX86State *env, target_ulong ptr, int data32) do_fldenv(&ac, ptr, data32); } -static void do_fsave(CPUX86State *env, target_ulong ptr, int data32, - uintptr_t retaddr) +static void do_fsave(X86Access *ac, target_ulong ptr, int data32) { - X86Access ac; - floatx80 tmp; - int i, envsize = 14 << data32; + CPUX86State *env = ac->env; - access_prepare(&ac, env, ptr, envsize + 80, MMU_DATA_STORE, GETPC()); + do_fstenv(ac, ptr, data32); + ptr += 14 << data32; - do_fstenv(&ac, ptr, data32); - ptr += envsize; - - for (i = 0; i < 8; i++) { - tmp = ST(i); - do_fstt(&ac, ptr, tmp); + for (int i = 0; i < 8; i++) { + floatx80 tmp = ST(i); + do_fstt(ac, ptr, tmp); ptr += 10; } @@ -2491,23 +2486,22 @@ static void do_fsave(CPUX86State *env, target_ulong ptr, int data32, void helper_fsave(CPUX86State *env, target_ulong ptr, int data32) { - do_fsave(env, ptr, data32, GETPC()); + int size = (14 << data32) + 80; + X86Access ac; + + access_prepare(&ac, env, ptr, size, MMU_DATA_STORE, GETPC()); + do_fsave(&ac, ptr, data32); } -static void do_frstor(CPUX86State *env, target_ulong ptr, int data32, - uintptr_t retaddr) +static void do_frstor(X86Access *ac, target_ulong ptr, int data32) { - X86Access ac; - floatx80 tmp; - int i, envsize = 14 << data32; + CPUX86State *env = ac->env; - access_prepare(&ac, env, ptr, envsize + 80, MMU_DATA_LOAD, retaddr); + do_fldenv(ac, ptr, data32); + ptr += 14 << data32; - do_fldenv(&ac, ptr, data32); - ptr += envsize; - - for (i = 0; i < 8; i++) { - tmp = do_fldt(&ac, ptr); + for (int i = 0; i < 8; i++) { + floatx80 tmp = do_fldt(ac, ptr); ST(i) = tmp; ptr += 10; } @@ -2515,7 +2509,11 @@ static void do_frstor(CPUX86State *env, target_ulong ptr, int data32, void helper_frstor(CPUX86State *env, target_ulong ptr, int data32) { - do_frstor(env, ptr, data32, GETPC()); + int size = (14 << data32) + 80; + X86Access ac; + + access_prepare(&ac, env, ptr, size, MMU_DATA_LOAD, GETPC()); + do_frstor(&ac, ptr, data32); } #define XO(X) offsetof(X86XSaveArea, X) @@ -2971,12 +2969,20 @@ void helper_xrstor(CPUX86State *env, target_ulong ptr, uint64_t rfbm) #if defined(CONFIG_USER_ONLY) void cpu_x86_fsave(CPUX86State *env, target_ulong ptr, int data32) { - do_fsave(env, ptr, data32, 0); + int size = (14 << data32) + 80; + X86Access ac; + + access_prepare(&ac, env, ptr, size, MMU_DATA_STORE, 0); + do_fsave(&ac, ptr, data32); } void cpu_x86_frstor(CPUX86State *env, target_ulong ptr, int data32) { - do_frstor(env, ptr, data32, 0); + int size = (14 << data32) + 80; + X86Access ac; + + access_prepare(&ac, env, ptr, size, MMU_DATA_LOAD, 0); + do_frstor(&ac, ptr, data32); } void cpu_x86_fxsave(CPUX86State *env, target_ulong ptr)