From patchwork Thu Apr 21 17:31:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564418 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp653467map; Thu, 21 Apr 2022 10:55:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9r/ntHzPQS2ZxTQVfXPO5g2zbz2PQcWTgAw8pL0srHGsANJ3XSoedSQ4HOPv7jlZH6SZz X-Received: by 2002:a81:7455:0:b0:2ec:84:2c83 with SMTP id p82-20020a817455000000b002ec00842c83mr911234ywc.323.1650563750737; Thu, 21 Apr 2022 10:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650563750; cv=none; d=google.com; s=arc-20160816; b=RyGOEA4HyYKPOugz7hdTcq4fez0yhLXQYzYQyQPn7Mv5odyVU8mWg/4amYE1ZkMPoI hAWl6KGnfTZP3QUbSa0K2jinjkTS2bAwpUiizL/Ii7ydguuQgQmrm4wYDPIbTnJ0PNRt 6BrQ6q3dAJ8UL24G85kE6C3jn8lw53uPvllDeuiA/iCiA0reKovKflZgRuF56xAySWkZ 3ytms3AZ6iMwOKM5BpVGfPMTi0Nex1lHFbZZ11Pby06ZIrDuupgByTXhpSchYYFYi/aW LFvQMnvcd0fnfa645EKobB77/i8NQb8S1wfhJZnLK4gl+wyMRCwbRA1iOo4Zkgiej7Cb gOoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=uMjdlRZKRqMc37bzmt8n/trfJ/doq01lE7A/5TWhGjQ=; b=ZDQh/evcVPXVuwdMJOLgicVjsUo5Csbzjnt7ekmWukaY/xSqbHatjMQYq22WPyc1xc xn1Gw0XJJDCb0L9SjpWWE+yU7y6VT4ACDn5Clf0l08UCYFaK1AIb3Us6iqxL4+p85kGL U5ACNn+RrP/ew5YjeBd0QuSiftftjgO8z0UTjkBG+jjVVPuDRyP18uwuV6R6bMMF1ECd kDe1IVXPrTnnrU04kWAaDcRIYW+2f9jueYckzWWcaoBjk+lmbxLBhLrUcqIs0y4xHMjt chplgpGO91G68jMK0Y6SNg8bQtxpRpSVj/Ji7/0BarsJLT46kj8jV/7lvcItv929yv8Z 9Tcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SnsXwAjR; 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 t129-20020a818387000000b002f4dfb82b48si991091ywf.116.2022.04.21.10.55.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 10:55:50 -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=SnsXwAjR; 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]:55072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhb1y-0003Ap-93 for patch@linaro.org; Thu, 21 Apr 2022 13:55:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhaeP-0000Kw-L9 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 13:31:29 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:39769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhaeO-0002w8-4A for qemu-devel@nongnu.org; Thu, 21 Apr 2022 13:31:29 -0400 Received: by mail-pf1-x435.google.com with SMTP id l127so5627933pfl.6 for ; Thu, 21 Apr 2022 10:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uMjdlRZKRqMc37bzmt8n/trfJ/doq01lE7A/5TWhGjQ=; b=SnsXwAjR8po/j1UyFsXKu3Td/TSMDzsa+zsZgQwW8hHzSvBz8Yk/M3HULwcPM/qP0i L0Be0F+386Zp07GW/tRxkhHe9rR7r22t5qrCRRW2mv4A45lIsz+/N/3e0jT3DA9DFte1 1jCWDDFAdw9CTsV00xC1v4B3t3Pfxz+O14J9lATIgatgcxx3cIed19jj3akTgLo+c6Ch YDfHJ9+gQtVTmA+L5vMkuN3JgilEfQGvQruaGZ/jy8QKlP3AVYbmczzzdnpm6kVF48Ab w928ijZlw4U4HwB4jaWjp4cOIWXwzuEI/NLGPtWM6Pk5SxcbOkB9CNWvpfgNcGxTyA3t cyIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uMjdlRZKRqMc37bzmt8n/trfJ/doq01lE7A/5TWhGjQ=; b=J2gtbstrDE6sr5HHcD18SRlg5Uk92J/q4U5ON5OBRLgOWA/jMxQLI12glw76BWBUqk 4gpv6O/zAxxjrRg3Mr5E8svnfJN90ImlGNdSBuPmHhbQtavOn4R9hYv7mA8P/anNbnX7 eHyhjnBpPNioI2kZo/b1yFz4pHoqcWjYfeIBRKwp/X9vRhbAeI843BOnwAMCyAh/9ZOY pKOE6BtqQmo13muS/O22HkQ1SDAVbPR+4P8kfoGbtwMCyArektK25AWJB+pOrnbms+Lu fBX9AA2yUv4CBX2dH5Ktgoqs1g9DiwWzBfANWrUmolZRc4n6sIibP8QHAi0PhiYSFhnG AusQ== X-Gm-Message-State: AOAM533YX01/cViTBxu3JLjnZCw4GPCKvO5ebF1e4Mibc2SkmsLmr2Ym fc6IgwCCOKLpfbPQyz0qR6InaHDz1RSPPzKl X-Received: by 2002:a62:170b:0:b0:50a:6901:b633 with SMTP id 11-20020a62170b000000b0050a6901b633mr729698pfx.34.1650562286785; Thu, 21 Apr 2022 10:31:26 -0700 (PDT) Received: from stoup.. ([2607:fb90:80c1:f8a5:3d1f:84a9:7713:bf09]) by smtp.gmail.com with ESMTPSA id 204-20020a6302d5000000b00385f29b02b2sm23557644pgc.50.2022.04.21.10.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:31:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/7] target/rx: Swap stack pointers on clrpsw/setpsw instruction Date: Thu, 21 Apr 2022 10:31:11 -0700 Message-Id: <20220421173114.48357-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220421173114.48357-1-richard.henderson@linaro.org> References: <20220421173114.48357-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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: , Cc: Tomoaki Kawada , Yoshinori Sato Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We properly perform this swap in helper_set_psw for MVTC, but we missed doing so for the CLRPSW/SETPSW of the U bit. Reported-by: Tomoaki Kawada Signed-off-by: Richard Henderson Reviewed-by: Yoshinori Sato Message-Id: <20220417165130.695085-5-richard.henderson@linaro.org> --- target/rx/translate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/rx/translate.c b/target/rx/translate.c index bd4d110e8b..63c062993e 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -2165,7 +2165,12 @@ static inline void clrsetpsw(DisasContext *ctx, int cb, int val) ctx->base.is_jmp = DISAS_UPDATE; break; case PSW_U: - tcg_gen_movi_i32(cpu_psw_u, val); + if (FIELD_EX32(ctx->tb_flags, PSW, U) != val) { + ctx->tb_flags = FIELD_DP32(ctx->tb_flags, PSW, U, val); + tcg_gen_movi_i32(cpu_psw_u, val); + tcg_gen_mov_i32(val ? cpu_isp : cpu_usp, cpu_sp); + tcg_gen_mov_i32(cpu_sp, val ? cpu_usp : cpu_isp); + } break; default: qemu_log_mask(LOG_GUEST_ERROR, "Invalid distination %d", cb);