From patchwork Sat Nov 9 12:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 842086 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp2114228wru; Sat, 9 Nov 2024 04:11:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVBtD2y3ObW8mrXDQ4mkQUbG1N0mIGlDhufFfd7TnkXMhK5oPFVbGXJqddIz5AdCicVgMh5Hw==@linaro.org X-Google-Smtp-Source: AGHT+IEwlJcPMRpxY5m7dSqBgd40B0bol0Z3TADwlAlwd0wy7hlYYCjYM9p08+LuS1MyaNrItH8W X-Received: by 2002:a05:622a:1dc7:b0:461:4002:4d1c with SMTP id d75a77b69052e-463094316demr97304271cf.50.1731154267279; Sat, 09 Nov 2024 04:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731154267; cv=none; d=google.com; s=arc-20240605; b=RGChYdbAYba2/Asdvt8/haqMffhOZy6POex76n4aO+4+ah8WcazYaymDMiRyJ1MkU+ WoL0nXxXI2e2U5B1+aH4WE4SejjTT8vzAZ2LQNe2vzdoXVW/Y7zIpuPo21ryTdiAg7Hd X47qgBszFSOQ5GmOCHaGaDNohi2Jb4wfTrKgGTG+KHkYHYG3o29MFGQc5jGJxVKSpUWE zGt+dFjF9qtcWvG4+OQFm9crYKTHjGxyCgdgh2NhmV0nPjGe73SUYPScXKkgbql5drMj teZvWGANXg7icG2uWvvOxiQ+vWeOS9cTeDAMEorV25QQgGAD02kqBk4/W4KA387X//U0 poeg== 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=w18YhpTl5cfYnU874bC9ONnA6Rk3LclqNNR80bM8QDY=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=Pir0319UL7qW2e7Ehueo3xZuaHMFXMKKUnInb1+bRzIGa3ar2uB+QzJYzUjwkpj1Sb q3skkqaHC+BU0OP9JDbQWrsE6feCt9dc9eLq8nj2QoMhB58Ko4huaVyv17qaapvE+Ggm FCTu1GMJXs+Jf2OL+YfgKAEK7N5APoi7ISJVZ3P9rsUCgcw+JVD7KoHNM6v8Gl3OhS7w vlCGqIfAUo4tOmGU27whqNcxu6YoV/d3bwnJ5FKf5SUPFOQyO/tI2WZkgVoHj3NoMctD O3Fp0q5ygoHMQl80ej2werXS398TwFAqVfwDEpIXLslbOJRSDarL2XCeMv+EGGtY78Yk BCcw==; 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-462ff62655csi63794941cf.450.2024.11.09.04.11.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Nov 2024 04:11:07 -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; 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 1t9kGv-0000Vr-B3; Sat, 09 Nov 2024 07:08:57 -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 1t9kGs-0000TB-Tr; Sat, 09 Nov 2024 07:08:55 -0500 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 1t9kGr-0003vQ-4m; Sat, 09 Nov 2024 07:08:54 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 82E7EA15F7; Sat, 9 Nov 2024 15:07:07 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 4A60B167F85; Sat, 9 Nov 2024 15:08:02 +0300 (MSK) Received: (nullmailer pid 3295295 invoked by uid 1000); Sat, 09 Nov 2024 12:08:01 -0000 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.0.4 15/57] target/m68k: Always return a temporary from gen_lea_mode Date: Sat, 9 Nov 2024 15:07:17 +0300 Message-Id: <20241109120801.3295120-15-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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 8a194f2f21..f2420b92e1 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -722,7 +722,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; @@ -749,20 +751,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;