From patchwork Wed Oct 16 20:09:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 835833 Delivered-To: patch@linaro.org Received: by 2002:a5d:6804:0:b0:37d:45d0:187 with SMTP id w4csp617877wru; Wed, 16 Oct 2024 13:11:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWisYCREUK3/FLQoYwyDneWkQqp9Rpaj2FbMJ4my7LEywcYRW50cEbqYkSHXUsEu8fLAigKw==@linaro.org X-Google-Smtp-Source: AGHT+IGKNgnJ3iOZm4aRVSgY1Hbe8uZtoTrOV0J2IQju7gKXOJo0DS8zrbXqUvhyCevxy223Tjz0 X-Received: by 2002:a05:6902:120c:b0:e1d:c3ea:da04 with SMTP id 3f1490d57ef6-e29782decbcmr5666456276.13.1729109482443; Wed, 16 Oct 2024 13:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729109482; cv=none; d=google.com; s=arc-20240605; b=BZOPaTwwqlQpoeTOkyQ0cARjs5GPURWLO40vEc6lCniuzp1RLpUxW5rSKCYq6qpzLv nhDct11OalOrC6HoOBIyFUPACB440e2qnoAUERI0fW/RU3h83jUM+mTpNKClxhyW1PxI 7UjvAd6bMGCU46lAyRrr70erJPNt8vxZU9KmgXn29j0PIBNlClzsn3C6YOMpEwBbkQtq mev/p4O6sBJ/K1DCqLnCuacE1G3ByOU3Btqj482awpP5YhBtidc3ARjVAIUODj+0scDt ULfYeRxQTo7ZtII8SNshsBLYa9bMhrkU4VYKA4QiAsxwD2runTe0zPR3mjYc9kK7JoUz vssg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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; bh=T5JV9itkvMKHg0ojdZt9nD23K79kpzLgfdPFAW/dfiE=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=IkeiUsqJxBboNOPQiCpLI0zKHsv3wZ3dJVyyIwFULTDo5Uk1e4FouL/E/DJXSIEfLN hbQVcnwguhUtXzfbN01iBm148Tf0qI16buZTyB3G5x5279pwPSJAdHMnuvMXEhsliQzf G3C+EiDw9vIKb/Zv011ZkF/NIVFRPeRpPY57okqW3m5USEX0ozp91fGU7jg/v+5YWc3T 2SeO1/xWd1obFwsrWOIcoKnjMG67y71hZ1B6DTmZCxTTsVyQc52nQugLRaidRiGyWalF Ai4ULZh0k7n0ScNDxIpP6+CvCGrZ8ThYKnwhdxUn3izaSd7R616yZdoVKDsIYu+dYORm L8Lg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4608e68f90dsi24161751cf.431.2024.10.16.13.11.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Oct 2024 13:11:22 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1AM5-0004o6-7H; Wed, 16 Oct 2024 16:10:49 -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 1t1AM3-0004nc-Iu; Wed, 16 Oct 2024 16:10:47 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1AM1-0000g9-Ua; Wed, 16 Oct 2024 16:10:47 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D2CC298F97; Wed, 16 Oct 2024 23:10:06 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id BED0C156377; Wed, 16 Oct 2024 23:10:26 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-9.1.1 37/49] target/m68k: Always return a temporary from gen_lea_mode Date: Wed, 16 Oct 2024 23:09:56 +0300 Message-Id: <20241016201025.256294-5-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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 From: Richard Henderson Returning a raw areg does not preserve the value if the areg is subsequently modified. Fixes, e.g. "jsr (sp)", where the return address is pushed before the branch. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2483 Signed-off-by: Richard Henderson Message-Id: <20240813000737.228470-1-richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé (cherry picked from commit 352cc9f300d83ea48b8154bfd2ff985fece887d0) Signed-off-by: Michael Tokarev diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 445966fb6a..ad3ce34501 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -720,7 +720,9 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, } /* fallthru */ case 2: /* Indirect register */ - return get_areg(s, reg0); + tmp = tcg_temp_new(); + tcg_gen_mov_i32(tmp, get_areg(s, reg0)); + return tmp; case 4: /* Indirect predecrememnt. */ if (opsize == OS_UNSIZED) { return NULL_QREG; @@ -747,20 +749,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, switch (reg0) { case 0: /* Absolute short. */ offset = (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 1: /* Absolute long. */ offset = read_im32(env, s); - return tcg_constant_i32(offset); + break; case 2: /* pc displacement */ offset = s->pc; offset += (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 3: /* pc index+displacement. */ return gen_lea_indexed(env, s, NULL_QREG); case 4: /* Immediate. */ default: return NULL_QREG; } + tmp = tcg_temp_new(); + tcg_gen_movi_i32(tmp, offset); + return tmp; } /* Should never happen. */ return NULL_QREG;