From patchwork Sat Nov 9 10:14:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 842072 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp2081613wru; Sat, 9 Nov 2024 02:17:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUncVhNwDO26sB95D31J5mLBWOHp68v4Fnxp4XbebhqKB3Xbts5ylbo05v2WOw6N3KTHls8QQ==@linaro.org X-Google-Smtp-Source: AGHT+IEHSS+dk4QsK50BtquPiCpaIvBqWAj83SiHZ1xRlrmjbd9CZGCX2P0c4SNVR1TaLJcCiNGX X-Received: by 2002:a05:622a:1b1e:b0:461:1393:fd8b with SMTP id d75a77b69052e-463093471b3mr92079771cf.15.1731147427266; Sat, 09 Nov 2024 02:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731147427; cv=none; d=google.com; s=arc-20240605; b=c1wlBbWa10CCj3vHxn8OHJQcWe7kIILk5WwQ3unKJzguMWI0YPQQKg69lhKe5RLrOm spTVK6YMSSNffC1soGOQ11SOyp3PnAm+rMFtQJHDMfPcnVQ/HihYYL1Ai9vZI3swgpnw A1WiDSXpAXijBjMTyvZthskgdoBepvXAhBJE0E0jHa+fki7UVVzC6FPj2ehXhy2+JV+j QBPjJWAEaDuWhIYoRQ3oJHRwgFWBjSm+A2UDOHc7N31Iqvxjmt0eKQG1gkaNI+8IOQb0 O9+F3gM/orYIw1PdKNx86DCnQgWJ5n4YwhvoMugAfUPL7aIhffc9LgPVZwS/8IUCeGWR A6kA== 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=zWdAhrJoX6HrLUn5/YrOuN94CCEdyYtPkJDTqFT74UI=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=P7r3M9wTgB/vQJJAFqJq5zqJTUDfuzctPRXUnm2QSpOqOS0jb/2EnWCgFHlUdYBn/n T4VqzALGrjZdUfDN+gBHFcjbQxQW3RO+7HB2LHrP0Jn2M7f0I+4bMOaNOqNoA+yVzdLI XeqFVl2b/L61o0rdl2kIAaxm1Y4u5ajIm7wDoi+Xy6LoPwauRT7hbCQVMDJ4FAVnzWHf 7iV60Etsj3IJLL52DClgAnVmNaNZ490rBB3YzzFoGEzvOPMuaqFavHDM9BDh9s+l2/C3 tpDboTzrct98vyYvNzkZRL07vBWE5LFAE3Vf0EYUj+fh72yquXzE0D5iISSqOKFjO2qL Qz3w==; 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-462ff40f411si58046821cf.2.2024.11.09.02.17.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Nov 2024 02:17: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 1t9iWC-0005tS-Kw; Sat, 09 Nov 2024 05:16:40 -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 1t9iV8-0004dW-OW; Sat, 09 Nov 2024 05:15:33 -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 1t9iV5-0007nH-TT; Sat, 09 Nov 2024 05:15:29 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B961FA13F1; Sat, 9 Nov 2024 13:13:49 +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 64C28167EDD; Sat, 9 Nov 2024 13:14:44 +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-8.2.8 13/49] target/m68k: Always return a temporary from gen_lea_mode Date: Sat, 9 Nov 2024 13:14:04 +0300 Message-Id: <20241109101443.312701-13-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 f8eeb70379..a5145e4cf4 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;