From patchwork Thu Jan 23 21:55:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859395 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp494645wrq; Thu, 23 Jan 2025 13:58:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWxMAJaponzVkcjjikNpPtpd7rAK7hdRXdwgPqFLGIUvW7reI4Jgyxprk7qySPeHXeM6MK+4Q==@linaro.org X-Google-Smtp-Source: AGHT+IHKg3f+k230zHTtI3zuxiSBqz7FhdUutJ9HzciOKS0DpBDOlAS2C1bLLo4yUJwlNzvh0IKf X-Received: by 2002:ac8:7f4b:0:b0:466:b382:a789 with SMTP id d75a77b69052e-46e12a2d0a2mr434768711cf.4.1737669492585; Thu, 23 Jan 2025 13:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737669492; cv=none; d=google.com; s=arc-20240605; b=gO2LC9VIIyShy1LjZVi6St0/gSQsU3X0t5wst8SxS/CMCziGkwzxACAWp4JhJa/hD7 otLuiuaFYdXOOvzj1l3wyBzb8Np4F5BCa3DdxrUO1cNuzzKEehUi2sezlqXvUCQvU7YG HtucwWeb9rSTw0LBz1fkY5sc2ZLdt6yEAYF9Ev9G+6UGRS2Ii/gYn1X9jJNzDDpst7fB 6LnF2ffoahDVUpaqXa6GNZS5DWNGIduCxeZceAe0XjgxkVWkBX/VRybXci8FBPUj99BJ BH8mWp4bbHhstDZ3e54YpEzzu74pHt6umickwwwKt7GIOrB0vquqRLUSYpXsMpJdpVJb QWEg== 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=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; fh=f6VbfoskI6VsEtYPQBX0qo8ZjRYhBMT+vpdrU6ZtLU4=; b=RR9NEY6NhajrU6VD4sUvUdCa0QKRxSP1wKKO+2XY8KeclJaaw1mqz3ZqOQfhEwqZ/q SHpM8h4IKwqdd8ShM/pz5Dc3Ql6G9ytDkdpYoffnKk+jdjvMGWXbQ6Y7mgk3aaknVqZx 2c00fYELWqcfAS4mNUC6dpqiWgflVNPEe6GB2fYLArDt2PJhyAevjga+E+WHheFU+vzK epD7FI3epzkHDcR4difBg1coPGp0Ky5KUXqwRn9YLazTyck0U7vWgTJx2BRVX6ccU267 oDM7h1wReJi2LmMfEZ3FE9FQ4l+nz/SjNJzoi794GFEZ6MA/+IZusF86eGTCYtz91Px7 7Zgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OEoezC6I; 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 d75a77b69052e-46e66b67da2si8031491cf.290.2025.01.23.13.58.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2025 13:58:12 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OEoezC6I; 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 1tb5Bp-0004wc-Sr; Thu, 23 Jan 2025 16:56:41 -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 1tb5Bo-0004vl-CM for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:40 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tb5Bm-0002ln-WE for qemu-devel@nongnu.org; Thu, 23 Jan 2025 16:56:40 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-385eed29d17so786539f8f.0 for ; Thu, 23 Jan 2025 13:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737669397; x=1738274197; 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=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; b=OEoezC6IxlWhLgUHahXWKu7697MUp+HoIsGJszv2rGoNiW/Tb+mU3Mk4X3nkTFaUZ5 6Zrm4JL0aRNC/szn+z25mZsCe9GU3EQAZOf1TfhbZc+tb4V3LkCVAgf4twXq/nRXAIyc KtbEECX0dl5fYumHDPbc7EIAeSyMEju7Fim5KnvICQDi3GohOQ9s6pTJMmytst7/xUne l13fhvrYdvLy5/AaMT6NcnSbNojjZSmuNapFnAFWDyj8ut+Rq2VLuquXIZqxdYfzqUnq OYLhPBSGy+IjiIOp0KSQ3gqO7G08BEhJRCVy9tTJw6ziPGIzLPvaJ5LI4aErKpP9noRd eRyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737669397; x=1738274197; 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=1BMW+C7jqPLrnYT1UisfzzT75nHHylLVxw3pRQiBjgM=; b=hL+RMnua1K+QaadeZD2xF10k/OKUI/KZcdFljMwG+1328prHXfRcNaZyNV6QcWKYLg 6ppMxzpd5yH2jQlNmDtgLocmD+Oid06lWuvvGajnEE/m5ZBEjYCgYzyw3eKTK7Ya1ZRQ ALAZOaBiiqME2FOdZpv1zVq9OWz2wCHeyF3fUHYGP/z5/ETIdgn1t7nkDFMYDfq5RgfW hhzFGYHWEnbUfLzUUrJelLJR+h2yHArMysIMTbLSEqb7OYCpm8iKYKx9uPUyHG3TR3ow q4eOAzSk6iz7UjaWT0wMziDzjRpDS1R1QienilhAkriuw8MovJF7w5+75CGWTxnPORZA cXMA== X-Gm-Message-State: AOJu0Yx8d/PmS9nL/LWgs1+5wdfULC7t6nxpSHIKePCRp+plWznMuChj csdGJXD9TGuzGUIkSgm+221zWreEja8W1/KrWGtV8T+l8Kenr6z1B6fqF3cNeevEw3gwqEenBvF DFIU= X-Gm-Gg: ASbGncuFtQrhYafqQIOHdrLA+tJ+D4UxCAKngXgBUtvQ95diMSMvJyR7wHEmHuC6xK+ UoeAkg9hCMFKZeNJNOCzhASxsQge/ZZGpoxzRMlWrEyZVF+nw4ZTHzLjRPo1CBMRTKRtFe39WmX XcbPFZp9dLE+wviaLt8fm8cyzDNsraAF6DTVp6iw+SP62IJ/vvbqAzso4LyW3aZVu+OQSJ7ARwM zEKLwufcdp4K4hpEhkZYXNLSpfNIwyPdNp4BaYVgbTICVfFJIizSrcDix18oG2/TP1q4j8hR+yX 0O0kAbuT1q9wdEUAvZ0X77161lk6r3Q3emDZ77oDivnbg+B5+MdLjok= X-Received: by 2002:a05:6000:178e:b0:38a:a043:eacc with SMTP id ffacd0b85a97d-38bf5655a55mr23265382f8f.1.1737669397200; Thu, 23 Jan 2025 13:56:37 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bbd93sm779002f8f.76.2025.01.23.13.56.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Jan 2025 13:56:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Harsh Prateek Bora , Richard Henderson , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c Date: Thu, 23 Jan 2025 22:55:59 +0100 Message-ID: <20250123215609.30432-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123215609.30432-1-philmd@linaro.org> References: <20250123215609.30432-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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=unavailable 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 Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/excp_helper.c | 21 --------------------- target/ppc/tcg-excp_helper.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b05eb7f5aec..8956466db1d 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -136,27 +136,6 @@ static void dump_hcall(CPUPPCState *env) env->nip); } -#ifdef CONFIG_TCG -/* Return true iff byteswap is needed to load instruction */ -static inline bool insn_need_byteswap(CPUArchState *env) -{ - /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */ - return !!(env->msr & ((target_ulong)1 << MSR_LE)); -} - -uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) -{ - uint32_t insn = cpu_ldl_code(env, addr); - - if (insn_need_byteswap(env)) { - insn = bswap32(insn); - } - - return insn; -} - -#endif - static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp) { const char *es; diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c index 3402dbe05ee..6950b78774d 100644 --- a/target/ppc/tcg-excp_helper.c +++ b/target/ppc/tcg-excp_helper.c @@ -199,4 +199,22 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) return false; } +/* Return true iff byteswap is needed to load instruction */ +static inline bool insn_need_byteswap(CPUArchState *env) +{ + /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */ + return !!(env->msr & ((target_ulong)1 << MSR_LE)); +} + +uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr) +{ + uint32_t insn = cpu_ldl_code(env, addr); + + if (insn_need_byteswap(env)) { + insn = bswap32(insn); + } + + return insn; +} + #endif /* !CONFIG_USER_ONLY */