From nobody Wed Nov 27 19:03:16 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=1728597075; cv=none; d=zohomail.com; s=zohoarc; b=bDTWf9YXo+I15wzPCzv41/H8DCDqOmkflrfmm8BKCRWNAjeAaT3XD5kjQEePkmbswL6OSMhX7prgqL4ysy7BllgJXpsDm8IoksX7SdaEcWq2631YE7tGXpCvUfG6RVL0ad+cOGD+dOUrCdimJrBye4monL8qvKEuH+h1dMFSePM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728597075; 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=eKyDYgcDRvOCa3U0P656gHylFIpPG3mMrqsMWsAm0J8=; b=RhaPfK2bgeuS/Apy5R7Jh+j7XtogLCw+Id0K+ehxh6VgnpaU5JFJANscv0U6BVX8+dEjmOIHf4n17hQWi7dhti0mtW//qLlcPwnbyj26RdKFSH/yGK1OFck43Q45Q8d4jPhFZSRAahKQKVdv+PsHXiNH47vrNZe8zlVXIUkgjYI= 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 1728597074999783.1650112032663; Thu, 10 Oct 2024 14:51:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sz13L-0007Hn-Sz; Thu, 10 Oct 2024 17:50:35 -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 1sz13H-0007Fz-3s for qemu-devel@nongnu.org; Thu, 10 Oct 2024 17:50:33 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sz13F-0004dF-32 for qemu-devel@nongnu.org; Thu, 10 Oct 2024 17:50:30 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2e2e050b1c3so649239a91.0 for ; Thu, 10 Oct 2024 14:50:28 -0700 (PDT) Received: from localhost.localdomain ([45.176.89.169]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2a571a2ecsm4137373a91.33.2024.10.10.14.50.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 10 Oct 2024 14:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728597027; x=1729201827; 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=eKyDYgcDRvOCa3U0P656gHylFIpPG3mMrqsMWsAm0J8=; b=ACjVhsF0sy7wWSdgEWipskpRikcs1M0fDpTyeGzNFlrhQEff1NesOyX4K0BSQnCg1/ Er2Ix97Qy9hYkOZILp9IQxIXn0xuovyyMyo/Vvm4HNchBM/INQyrfO8rvLWf1qkDVrYG Wvqgj3OjQne39fe7WZYMe6GjlpnScfkq94u9TfeWoYCt4UyBj8S2yDUKyhjS/JYtEHwm YzHcnRyAI5+8/II9tM7H+pIjf5+dFEk41OMm1W6TC8upH68KCiiBAV7Resa3WuI2zCXH XPDZi6ddsWsYI1KX6i5NoAAXQW54Kn4Vis3F3DhH0uQ7Ohub1VEW88HWYK1KqPyN0n17 +dLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728597027; x=1729201827; 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=eKyDYgcDRvOCa3U0P656gHylFIpPG3mMrqsMWsAm0J8=; b=u5zuBgWfyQ5Oh4cDj9FhxlZ5VKYAU7JoItlju6ExInwY83te/+RLswSlXISCfx5Ryt TVRx1s3qPxa8LzVCTYDqHMUEqzbFZfHl+99rQe2LvPdaJ7xUYCOyDp8wcqCe6yjtyVYp Ckts6R3uatyXCPwe6k9mk4lr8Xep2kpLNnyhkqAM9Itz9IKDI4htMAwXu/CRQh730emr ejGmFrMxC6ZAj7iiwrlAmY6V5BlS2iYyx7VvR2mxjYG7NAl1Zbod1YLnOWF8zPVhadUK 7Xhf/D1mvDKyyQoip6P1QK9NIDXaRtMfnkQEdddhNgwsxfOKOy9kb/JlCsdDIkTOOuo5 8lCQ== X-Gm-Message-State: AOJu0Yxztq+KKxbyG35ipsa9cLxI2F8zzDy7ahx2CJPZ4F6jgpJrHUdR v0W2Yn90g5ZPNCTpMiQWKEAxH707gQzK8icLePPqcpqNC3xIe4ZjEnSb3Sk7c7q1KaJBPfW3JFc q X-Google-Smtp-Source: AGHT+IHvsbb5Pg3ami1xHz0C5e8j7MnZBD5Sbb7uK3Z5L7SziYzBA9Yc94VltHeA7CbuGHWwj1+Odw== X-Received: by 2002:a17:90a:c2c6:b0:2e2:a5fd:7e4c with SMTP id 98e67ed59e1d1-2e2f0aa8b36mr936591a91.8.1728597027291; Thu, 10 Oct 2024 14:50:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , Aurelien Jarno Subject: [PATCH v2 01/16] target/mips: Declare mips_env_is_bigendian() in 'internal.h' Date: Thu, 10 Oct 2024 18:49:59 -0300 Message-ID: <20241010215015.44326-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010215015.44326-1-philmd@linaro.org> References: <20241010215015.44326-1-philmd@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::1031; envelope-from=philmd@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 1728597076062116600 In order to re-use cpu_is_bigendian(), declare it on "internal.h" after renaming it as mips_env_is_bigendian(). Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20241004162118.84570-6-philmd@linaro.org> Reviewed-by: Richard Henderson --- target/mips/internal.h | 5 +++++ target/mips/tcg/ldst_helper.c | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/mips/internal.h b/target/mips/internal.h index a9a22ea00ec..84c8e5e1ae7 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -225,6 +225,11 @@ static inline void mips_env_set_pc(CPUMIPSState *env, = target_ulong value) } } =20 +static inline bool mips_env_is_bigendian(CPUMIPSState *env) +{ + return extract32(env->CP0_Config0, CP0C0_BE, 1); +} + static inline void restore_pamask(CPUMIPSState *env) { if (env->hflags & MIPS_HFLAG_ELPA) { diff --git a/target/mips/tcg/ldst_helper.c b/target/mips/tcg/ldst_helper.c index 97056d00a27..f92a923d7ad 100644 --- a/target/mips/tcg/ldst_helper.c +++ b/target/mips/tcg/ldst_helper.c @@ -53,11 +53,6 @@ HELPER_LD_ATOMIC(lld, ldq, 0x7, (target_ulong)) =20 #endif /* !CONFIG_USER_ONLY */ =20 -static inline bool cpu_is_bigendian(CPUMIPSState *env) -{ - return extract32(env->CP0_Config0, CP0C0_BE, 1); -} - static inline target_ulong get_lmask(CPUMIPSState *env, target_ulong value, unsigned bits) { @@ -65,7 +60,7 @@ static inline target_ulong get_lmask(CPUMIPSState *env, =20 value &=3D mask; =20 - if (!cpu_is_bigendian(env)) { + if (!mips_env_is_bigendian(env)) { value ^=3D mask; } =20 @@ -76,7 +71,7 @@ void helper_swl(CPUMIPSState *env, target_ulong arg1, tar= get_ulong arg2, int mem_idx) { target_ulong lmask =3D get_lmask(env, arg2, 32); - int dir =3D cpu_is_bigendian(env) ? 1 : -1; + int dir =3D mips_env_is_bigendian(env) ? 1 : -1; =20 cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 24), mem_idx, GETPC()); =20 @@ -100,7 +95,7 @@ void helper_swr(CPUMIPSState *env, target_ulong arg1, ta= rget_ulong arg2, int mem_idx) { target_ulong lmask =3D get_lmask(env, arg2, 32); - int dir =3D cpu_is_bigendian(env) ? 1 : -1; + int dir =3D mips_env_is_bigendian(env) ? 1 : -1; =20 cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC()); =20 @@ -130,7 +125,7 @@ void helper_sdl(CPUMIPSState *env, target_ulong arg1, t= arget_ulong arg2, int mem_idx) { target_ulong lmask =3D get_lmask(env, arg2, 64); - int dir =3D cpu_is_bigendian(env) ? 1 : -1; + int dir =3D mips_env_is_bigendian(env) ? 1 : -1; =20 cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 56), mem_idx, GETPC()); =20 @@ -174,7 +169,7 @@ void helper_sdr(CPUMIPSState *env, target_ulong arg1, t= arget_ulong arg2, int mem_idx) { target_ulong lmask =3D get_lmask(env, arg2, 64); - int dir =3D cpu_is_bigendian(env) ? 1 : -1; + int dir =3D mips_env_is_bigendian(env) ? 1 : -1; =20 cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC()); =20 --=20 2.45.2