From patchwork Mon Sep 9 17:27:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 826620 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp2129912wrb; Mon, 9 Sep 2024 10:29:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLKrURnsiStfNJM9WLF9iPb19RfCr95fKnx/rZn1242HJx9UVUd/7aUqvRCkqp8wHrRL/Uvg==@linaro.org X-Google-Smtp-Source: AGHT+IE4z/yDMk0jRdEJLqIRiMK0tUJNXUODVT3N+quLZyvehB/7ccsxIgETmB8/nV+Nrw+5s4O4 X-Received: by 2002:a05:6358:5110:b0:1b8:5186:18c8 with SMTP id e5c5f4694b2df-1b851861bb0mr120464755d.28.1725902971179; Mon, 09 Sep 2024 10:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725902971; cv=none; d=google.com; s=arc-20240605; b=Edr/chzaFrWpotDdMFBy9ETMNFoAFRawnJhK/Flm6y6ivZHCTrFryvpt7JXYdj42i1 twouJwZ/yW/YZlsWryCffwQR/T7DRoj50z4ryMW6b/ZgXcwJvhnGQvJROoOoBYC9TSPK ObG/MjzchWhZcHr1IsQZU6caHoCuqMvbJ4zhLRCeRCEOHM8QxBWWZ2jL8r8WaEe5aIMb ZTsPkXs8SP2vJMWNq6bCEoAU62NXr1unmWD+TSSNYSL4iPhOQ7AASV8tBDx+fLq7H0Lh khdhbWPkQNuSCntdLZBM2xUJEz6WPTpHUYo4qt5WvSuPISzsoZ93SfVLFatGb0wO+ojr a4Vg== 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:dkim-signature; bh=421LbBczhN+7djkIM+80LiuWG1ET4qxsB+bV+/jUDAA=; fh=vcwsOoqbz6OOwV49wjn5grcThaa1ddCD12N2st4CmAI=; b=jWPRB8VAiZHMRPJn0B8X/jCIANzuWeXpWLQx2gAIb+pPv4BBlHQCWkqTYEzxNb8yJB pFNS5si1ItVzJ37TpbdGPqyn+8QPTytwQm6rmxuc9zLs+uLvFudtuuD3HBfCUyA1o9TK aSwHfh6QXhhE1E5+7WYLUIA6zKOJV0AqGJL2GAGw5oGfAgrbjAq+qjEooik4Yr7wpjoC pBvXGHHHzaWa2UhYUFGfk+jOoodTuK6TFlBnkq/ViwXYMjU8sQAqIMhIBsbw3mP2/gSd pVf2wOhiHtJ4uOZVdTN94nOhruagh82vCp5WuNzzb/iq8Wpyjxc3YrDMkleVA015uKl7 RI5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klznt2Z7; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a9a7a36817si582445385a.314.2024.09.09.10.29.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Sep 2024 10:29:31 -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=klznt2Z7; 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; dara=neutral header.i=@linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, daniel@0x0f.com, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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, 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;