From patchwork Sat Nov 11 01:32:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 743074 Delivered-To: patch@linaro.org Received: by 2002:a5d:67cf:0:b0:32d:baff:b0ca with SMTP id n15csp541169wrw; Fri, 10 Nov 2023 17:32:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIxxt4kK+PrsxgxNHNSAdYqw7vQTeTsSMcsaVQ81orchlol7aNKh/Uh8TVpS2gXb7k0pYy X-Received: by 2002:a05:622a:109:b0:3f9:aa80:b48a with SMTP id u9-20020a05622a010900b003f9aa80b48amr1194927qtw.8.1699666373572; Fri, 10 Nov 2023 17:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699666373; cv=none; d=google.com; s=arc-20160816; b=xKA39vId3vFAp6cCv81riamegVVChLMwze1zBd8UCGRE3P1vafAeP1/NK41qM4t2rq 6Y08degCo9DLh4imiM6oF9DDRlO+/BSLd5JbcFZqkQ56wz07vFDCA5AleeuFevaqAr4N 4A+PwGbtfRgiPQgRR8zwSjLuLDjpLHczs/Cw4r5cCp7+KYMU2cjEMjgpTWih/QaBOGsa vhz7+vkpFjKAbqARlaDTD72MW5CTImKnjkvElSjiwGRt7xXdqwac2Cqaww3nCGDC+cRa mYluPnzlj+o2pZO7ewB5c9Pke1sdc+IptQioPKUL7sJSaHhjZB/HYKRE90XW5AUJbcKH EPHA== 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=Yoygu1nJdDoN9VfRDXSQCv3IzXcMHrs0/BGmVO3uAho=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=qtQ5j7yeFX1CNEqrIyUx5vKU0CWezE6UjgT23kkAL9ObkjT1vDPj2ZHyV3yAibhhMC h0zuKcAtyEpovL27xfk198TMK3veOPD/3xXQdTVqIZEPV0HPpDJoEaAh22wi2fCzEBtw x7lUApbBoHbv13iFHLZmL3gXzATzFkd2nCu5s6QnDTmgykQGe69JCbTU9rrt3P9hog9O SqJcfH/7CyctwmxS0XyG4GrRh5fwo0N5J+2n8ZT/+i2NgYkQ6O2iX/8s6850UGwrU4RZ lnZhSOQBd5gzohgwrHeX8UJswuqQjoTlARtTk03oE7q/xqDWhbZ4o9tpG+BjkruQ6B4P xVGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WbOlaaQ2; 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 a2-20020a05622a02c200b004196b9a23bfsi605649qtx.613.2023.11.10.17.32.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2023 17:32:53 -0800 (PST) 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=WbOlaaQ2; 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 1r1crH-00023V-TA; Fri, 10 Nov 2023 20:32:23 -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 1r1crG-00023J-G1 for qemu-devel@nongnu.org; Fri, 10 Nov 2023 20:32:22 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1crE-0001aW-Oi for qemu-devel@nongnu.org; Fri, 10 Nov 2023 20:32:22 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso2116381b3a.1 for ; Fri, 10 Nov 2023 17:32:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699666339; x=1700271139; 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=Yoygu1nJdDoN9VfRDXSQCv3IzXcMHrs0/BGmVO3uAho=; b=WbOlaaQ2Ck9KgQykR2kal1Z/KODnN/MixKpiH/N/dh8SuAoZzclDxaMeOFBb7s89i5 YdFeu6exl6MWdZ/g6tLXJp6yaLV5beupLmSjLtTIckCpzqgjcLHo518ufqmWn8GqSTQO 2aP3Y4izvxF8Gxvq1tzTiutBxAqNZ/+xra39hyeMWRWNLtgH9pDaMg1vywknm6QHLtjF FhX5pmWhIXNs+FH1pxFD9QGEPtKDZJX47IAcu8dYgG5LVDycz4bC2MtiOaAPe4scgc5G kvYXwsGsXrhmRcY5Scin6OZrw3yF921NbtL9R1ZvPQdvjXc9IN803L+b/R4UZoxjbVFk CjwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699666339; x=1700271139; 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=Yoygu1nJdDoN9VfRDXSQCv3IzXcMHrs0/BGmVO3uAho=; b=i6WMJ97spVintTzS13y1MxZ7FYRRIP0zjsnDneiAjlPiskRMdEtMAyvJXiBxJPB9Kl lyOOOhmgstzSwdrKL1tqv1OslD5YhPOKkvg+MGkDTfX/lh4IsR3oPDR4SkHmpMaeapIS 5Ll4iHXfs8a8v+REp77QNheMbaGYQeLKvgQ1i6zXEZIa51qIU2XfRgtXbNMsL36g5pMf GtWhJlsP6o8BN2pU79UsJxQ13l5YWmoe25eLY0Bn4JHyBjr5qCHi+T0f0veAAeEsF4Ut c3TDDjA/hEYjYnPt469CEewNMHkGaaJGaqufBsh8zRUukcAuiG9mG4yzgQr9Zs0UKPxP BSGA== X-Gm-Message-State: AOJu0YylE/1HX6UMLsU8TkYO1LbO5tQRgmrpfYLej4r72QJ8LzYmyu/X hivK3Z2nEmji4bVjEEUkaomBnNtcRQFF5v4zgkY= X-Received: by 2002:aa7:8892:0:b0:6be:c6f7:f9fd with SMTP id z18-20020aa78892000000b006bec6f7f9fdmr8078712pfe.11.1699666339443; Fri, 10 Nov 2023 17:32:19 -0800 (PST) Received: from stoup.hsd1.or.comcast.net ([2601:1c0:5e02:2a20:a99c:45a6:14e9:ea6]) by smtp.gmail.com with ESMTPSA id m11-20020a62f20b000000b006c1221bc58bsm333502pfh.115.2023.11.10.17.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 17:32:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 03/11] target/hppa: Mask reserved PSW bits in expand_sm_imm Date: Fri, 10 Nov 2023 17:32:04 -0800 Message-Id: <20231111013212.229673-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231111013212.229673-1-richard.henderson@linaro.org> References: <20231111013212.229673-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 From: Helge Deller The system mask is a restricted subset of the psw, with only a couple of reserved bits. It is better to handle this up front in the translator than require helper_swap_system_mask to use cpu_hppa_get_psw and cpu_hppa_put_psw. Signed-off-by: Helge Deller [rth: Handle this in expand_sm_imm not helper_swap_system_mask.] Signed-off-by: Richard Henderson --- target/hppa/translate.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index bcce65d587..f3b17ba16d 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -77,11 +77,14 @@ typedef struct DisasContext { /* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */ static int expand_sm_imm(DisasContext *ctx, int val) { - if (val & PSW_SM_E) { - val = (val & ~PSW_SM_E) | PSW_E; - } - if (val & PSW_SM_W) { - val = (val & ~PSW_SM_W) | PSW_W; + /* Keep unimplemented bits disabled -- see cpu_hppa_put_psw. */ + if (ctx->is_pa20) { + if (val & PSW_SM_W) { + val |= PSW_W; + } + val &= ~(PSW_SM_W | PSW_SM_E | PSW_G); + } else { + val &= ~(PSW_SM_W | PSW_SM_E | PSW_O); } return val; }