From patchwork Tue Oct 15 15:44:26 2024 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: 835488 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c8f:0:b0:37d:45d0:187 with SMTP id z15csp306439wrs; Tue, 15 Oct 2024 08:50:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXDU2tQoCsYytQbLravS5SIO5L4SjJyfR4s01puWPE6x2KuBHswsFBlPfrxOBzoH6WdU1Z21g==@linaro.org X-Google-Smtp-Source: AGHT+IGzBwK+BtAqx+J3wsNZ6tYiFNTkVg4S87XAta8lPtJO2OfbHNsXWAO0UoDzE3XsERbpmZEy X-Received: by 2002:a05:6808:1151:b0:3e5:df57:41ac with SMTP id 5614622812f47-3e5df5741femr5358043b6e.0.1729007417136; Tue, 15 Oct 2024 08:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729007417; cv=none; d=google.com; s=arc-20240605; b=gFqWZnmytiQW6/FtbxLgpDvTWPNR48kQfs09X3oDg6O8VYyvK1IPaw4bHcYSWPEbwB mkv9w9WIQy+nHsdIYlt+FkPwZBFWFRl6wiIrG4O9jF/veGQQF8wdwYo6Jeip5RQE7bR5 4frLcUEIDC2cSIKjn3Sz9xcP3W+kL1w5sU2pd3hJnhILxSU7EK0wT6Ix/MFR8f8TAcm/ LSTW5WCpQKQS8cprHX5gjolgI/E72KR2s0LC9xceW8ifPnoW1B695tXVSe6q3WmM1imI wTdmqvdecpYJHWJCIiEq1jEMycbwixxPvI2dsT0BAjD9YW84uYFx13vDdL0Z0oKImJ7G cJ2Q== 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=eW4qiUY1SBbVKJJvqRXRWIOZdgv3cj76vj7S3dJPHUU=; fh=SzTnMTPXrdaCZVdWTuiKXuPYOAOj6ON+qUjQKQ1ToGA=; b=R8+uwMuTKAg05/RuFDW6xugQ9U0MXC6xo1iwbo8VIkMyskFTMAJSVTH5hIQIVdar8E 81i+i0Xlfwbu5p5rZJwZ9k5LQ6N2ngcibgCiev/Kcn/1nO3oXh8yklX2zi5BHER+WBJL yE9/KS0fUCKgZVZgm9UiD3ah3g2ceeX9tovjn2gXzLhtIYJSSAM1LhXs7nOT+Np01kli NgEhGSPpFOTTTlzv+hdvsCH+jnk+GzIja6tM+0mMIgSS9JSKQFOiyhO6+F/A1YuZh0iy 3IIMGj7nUyvP69bb+BZiRPlTg6jqDQJ0Ltw94/2mUq1qYlASGduCP9tZvTf5fRyEPHAe qOGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MkUPYbYi; 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 6a1803df08f44-6cc22b95947si16686466d6.536.2024.10.15.08.50.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 08:50:17 -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=MkUPYbYi; 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 1t0jlD-0002f4-BP; Tue, 15 Oct 2024 11:46:59 -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 1t0jl5-00028o-4j for qemu-devel@nongnu.org; Tue, 15 Oct 2024 11:46:52 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0jl2-0000ub-H2 for qemu-devel@nongnu.org; Tue, 15 Oct 2024 11:46:49 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20cbcd71012so31043135ad.3 for ; Tue, 15 Oct 2024 08:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729007207; x=1729612007; 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=eW4qiUY1SBbVKJJvqRXRWIOZdgv3cj76vj7S3dJPHUU=; b=MkUPYbYiRO1+j0D/uoQzMgNIuVqMLCuuZAfmt1MVBDgE5oLfyBsXgz249klmlwdcGV gFTmETx7ruYM5FLiyk7mbKmjZQ9FGNqhMSQiGrjRY0a74uuhPNqqeqEAybM5KKmglb+w uc4eI4lDIzD8bGeN2W6/TwxV71GjUET0bp7f2jE4htSKQ3bbpKwyuKZ/SF/pZBlVZD4g VIGAkneB8ZivHzBZsMOsTK2dbogeORIwRyPlDTdkGc3YnaocTF5qdH666jHVa19SQ+ex ZraBSf8pYRYL+D19esUAuqAuucyWCKVTStUe/7egtaRPIVqIkKxXSf7uJlfoEOE9I6uS JLww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729007207; x=1729612007; 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=eW4qiUY1SBbVKJJvqRXRWIOZdgv3cj76vj7S3dJPHUU=; b=MRJvxPZgbsW+z8ZpJLTOrxquFc1CFSYxd3oUuBhBmdQU9L9hCfQ7KloTFELj+L52Gc g/1j0zxUeDFn/+Nc6tYOO6Pze/1d/QkpYW28DJoj8Z90P6iPH2nuL2vsp1TOBPTta/wA iflm1WkavY9VnKASPsCtyHobfIEhpvaBSzQem6OPRTugaQWczbGjSjECQDu0rwYIvvO/ ieqZy9Ruz8OdNg9RDXiR+c5MoSKqgOkqjOKpF49BiFrGgbZHyOXVKZbwFMoKdvg0susn MNmb2fONR8SS/F/ntH94iGWqY7Q9pFKEIfPy7+T/6NHuh26pyJHDf4j7bp2dgf71eu4A 8mfw== X-Gm-Message-State: AOJu0YwfhuJvMTLG0AW8Nqhbx82Y9Zp02/OrBDZc6CngARD6Nt8ExsoJ N2i4y7UQ75fV7vQr/zxaPOBCnQQhqnCYKCgLV1bbMNDrlOEKjnBOVuzzi5BLUd1M+Z5DSR7V0i6 P X-Received: by 2002:a17:902:e749:b0:20c:716c:5c2 with SMTP id d9443c01a7336-20cbb1bb0f5mr141110715ad.13.1729007206847; Tue, 15 Oct 2024 08:46:46 -0700 (PDT) Received: from localhost.localdomain ([45.176.88.167]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20d1806c713sm13409135ad.303.2024.10.15.08.46.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Oct 2024 08:46:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang , Richard Henderson Subject: [PULL 17/33] target/mips: Declare mips_env_is_bigendian() in 'internal.h' Date: Tue, 15 Oct 2024 12:44:26 -0300 Message-ID: <20241015154443.71763-18-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241015154443.71763-1-philmd@linaro.org> References: <20241015154443.71763-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-pl1-x635.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Richard Henderson Message-Id: <20241010215015.44326-2-philmd@linaro.org> --- 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) } } +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)) #endif /* !CONFIG_USER_ONLY */ -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, value &= mask; - if (!cpu_is_bigendian(env)) { + if (!mips_env_is_bigendian(env)) { value ^= mask; } @@ -76,7 +71,7 @@ void helper_swl(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 32); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 24), mem_idx, GETPC()); @@ -100,7 +95,7 @@ void helper_swr(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 32); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC()); @@ -130,7 +125,7 @@ void helper_sdl(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 64); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 56), mem_idx, GETPC()); @@ -174,7 +169,7 @@ void helper_sdr(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 64); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC());