From nobody Sun Nov 24 09:55:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725902971; cv=none; d=zohomail.com; s=zohoarc; b=RhxCMf5LVHY5HshE6YRm9ip3z89JFuPtwbtLcPGq3hMxwykJsStnWv6KcU36bmDEXHdL+Kkyxfq5qOMB1LDdnE9PbxwSdAzEirLMJ4UdTcsj4y2MsoNV6wT9te3kWoTFhVmNEw/ue4lLGyXjAMczPqigcdN6KLReVQaqyqTMlig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725902971; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=Kr6sgVuZoaPRJUyvWDP7ndftWQyn3xwq7A0FjnODTC05iHE6AwNfo860REvIs6UkcTEYrNiHMcAzRUDbHRTsq+JaHLFd/tigDdpeTH2IIyYY7vIusipdUvwuHS25Zodukv4Gk9ELgJYhxoJ6/DAHIg/l6vQjAmbRLqpb4e2FeGY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725902971498909.5324746700384; Mon, 9 Sep 2024 10:29:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sniBl-000426-HY; Mon, 09 Sep 2024 13:28:33 -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 1sniBi-0003vo-K7 for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:30 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sniBf-00060B-Kd for qemu-devel@nongnu.org; Mon, 09 Sep 2024 13:28:29 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2059204f448so37835715ad.0 for ; Mon, 09 Sep 2024 10:28:27 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e11e02sm36539875ad.14.2024.09.09.10.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 10:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725902906; x=1726507706; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=klznt2Z71KXb3dqIFMYhEihMYsuCsMLQiNjNDWUNvrgPa7O/5RyHx8umZgivHbGezi 5e9XG1dYJAxohcAeRR+0cEMm3iJhmYRmz4gMY7aN9Rty/4ipYXanllchThwjcfsKzpwO wwvUvhKpxoa9c4eA5abgvRXJy6fLET6rYO81/ozBgHhmozgweqWBtbu8azpj3OchZkEm NMZQxlPYRI+Mru2F07fEzq8nVYEPDt0ZllocAswFkRCTr59cyUMlBB/7zfQrTsn4Za7A fDuUJOSDUQcvHnD3RCIpLyASGOd5ZJQSciM4NB7KX/GJA2CVAXbbmciU/bux+BYKKI/j rr4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725902906; x=1726507706; 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=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; b=t3crpngO4H4UTimnjrcP2TcX3yJNBMYkV0WRlPSmsr8MKSb23NP2UAhilrhk5buZ4s 6uO2Twvjr4r08HSt7s15RwjBCb+td51AiJ9UbFHsB123hMwLh4JJbMxt5mPf+jeU1OdD rmipCctbmmF/weKQqvAAtmGjnN9LbmXcJAlC42mndr/fsdqTqRsYhVKvGSflwkpeGSA7 EXTYr76lRxWJRL84pujHpOjXYK8qWPaPId0rddHN/jjb1XYNFDsFaODK2w5ds3aniD64 GDi7S8gav/l5MI6/FxGHpdGVzwsnWCD/kzkmOC0ZBozmc77YQX/hQvI8dKYjnyRnkE70 fJsQ== X-Gm-Message-State: AOJu0YxQRCO58ygwLl1IQQt9PDsQWbdsJyaTvngLdaXC08aUMafrqDpv ZErRpzeWkDJWdsXiPqSCmcFt3YKocbmeCBYUu5iL5n4oHS+VVeSIbJLk5zVrUu9ID449KaC3wsr p X-Google-Smtp-Source: AGHT+IGLhJLMt7eUmLZzk4JHabGBqk9QCHeUhmEWzn5gUOYZNu0OLicrjWerdp34QRZlojIwfkLWgQ== X-Received: by 2002:a17:903:947:b0:1fd:67c2:f975 with SMTP id d9443c01a7336-206f056f059mr169959365ad.29.1725902906018; Mon, 09 Sep 2024 10:28:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, daniel@0x0f.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 01/26] target/m68k: Always return a temporary from gen_lea_mode Date: Mon, 9 Sep 2024 10:27:58 -0700 Message-ID: <20240909172823.649837-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240909172823.649837-1-richard.henderson@linaro.org> References: <20240909172823.649837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725902973412116600 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=C3=A9 --- target/m68k/translate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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, DisasContex= t *s, } /* fallthru */ case 2: /* Indirect register */ - return get_areg(s, reg0); + tmp =3D tcg_temp_new(); + tcg_gen_mov_i32(tmp, get_areg(s, reg0)); + return tmp; case 4: /* Indirect predecrememnt. */ if (opsize =3D=3D OS_UNSIZED) { return NULL_QREG; @@ -747,20 +749,23 @@ static TCGv gen_lea_mode(CPUM68KState *env, DisasCont= ext *s, switch (reg0) { case 0: /* Absolute short. */ offset =3D (int16_t)read_im16(env, s); - return tcg_constant_i32(offset); + break; case 1: /* Absolute long. */ offset =3D read_im32(env, s); - return tcg_constant_i32(offset); + break; case 2: /* pc displacement */ offset =3D s->pc; offset +=3D (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 =3D tcg_temp_new(); + tcg_gen_movi_i32(tmp, offset); + return tmp; } /* Should never happen. */ return NULL_QREG; --=20 2.43.0