From patchwork Thu Apr 17 13:10:04 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: 881858 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp306960wrs; Thu, 17 Apr 2025 06:12:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUkGMXIsPFTUOnxixPbGw1pFD2L9vgBli/j6FO9sgIk01GDieo5dTiHU4N2JxynjUN78EtEJw==@linaro.org X-Google-Smtp-Source: AGHT+IHJS3paKjp0bcne7FloobWu7AhPO6rQvjhzwcb1KV0oGq1UFV83/RMsgiyjAcjVL4XB8AJo X-Received: by 2002:a05:620a:469f:b0:7c3:c869:1aff with SMTP id af79cd13be357-7c918fed554mr680395285a.16.1744895524822; Thu, 17 Apr 2025 06:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744895524; cv=none; d=google.com; s=arc-20240605; b=aSEBsTeyOvc9amqfQ0lMAuPAqBkjQkR1zxet9EP9B7zq302oQOgEGylv/MHWF4wqim ADVsrx/d9r22qLg0srXL+2Zwh00ictuRKEgbm5ad0aqOovKkp5wtPEB16YDCacZlnX6F 26g3jL6oUmo/iWV11MTiugfDt4AwVcClYlfj76/BLN9aoijKXDTc4sCmorPAfGFG3VaZ /cs4duHwOS6/vuFiKqes/ghcPNp+fjvc4bmCnUAiGGmq8M2lMhlBYgjqi20GbNuKaID4 OnfDueR5kMIo1fkxjbvsXb5TxN8cY25XbsOOHvzPLsrVUN6UXpc/J/d9ufAL/qrEMJA6 ENlQ== 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=+KjVHOR8bZyQPFDZiY73GKKuG9sQW4JTgljoEvbnw6g=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=K3zuA4M/pbSh8CIVLz3We/qivtKDblBkaqoodKHdX6OKiph1ArWSqqM374JAsXjaOI odmrl8T43ZpVHPq+5+Iy1X9hKwE4y3govMHROty4eMvGoHBBUFSa+G+7kJh3oVcGgJLz rXL6YzX8lLPTU/pr2WHaQJ0luH4IUSsUmMb7ccs2abA/nOPA6VDuYJOwB8KbplH5vPHS f3hg553ymcAPl/lANR8BBGy6C4UJMZ/AlgxUyCa7GuhxUoA8UGMpvkANSPadklOBTqYZ Y6ah89A5OPk/yuug8kyXVVon7pTzBSYErxWoLnrHNzRFV2emy80ztJtqxjEiDyllFP3N mxQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vaa4SuHc; 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-7c7a8a0d030si1571422685a.409.2025.04.17.06.12.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Apr 2025 06:12:04 -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=vaa4SuHc; 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 1u5P1o-0006W0-99; Thu, 17 Apr 2025 09:11:40 -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 1u5P0y-0005iX-KX for qemu-devel@nongnu.org; Thu, 17 Apr 2025 09:10:53 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u5P0w-0007yb-Py for qemu-devel@nongnu.org; Thu, 17 Apr 2025 09:10:48 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-391342fc0b5so626045f8f.3 for ; Thu, 17 Apr 2025 06:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744895443; x=1745500243; 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=+KjVHOR8bZyQPFDZiY73GKKuG9sQW4JTgljoEvbnw6g=; b=vaa4SuHcDYBPhWZ3HyLa9xrar1Buj5AijrlhM74tpVl0BDunM27hgD1VShEM0U8qpZ Dnz1RVzldi7i0mPMLeJW1EMmRQib3UPW5Vu0TgFT6ra1YJzT/xeX4n8gU8uJMTzsw++f Ew/1sc4XWmjMmKOLX4sbXGND2sTAPCdWF+ZwIEE/o05cvw9PnyvdME2ywUCFMMik1604 l9uEwMLI1HxB3YPFXRUrptt9i4jD1ZATXCNQ5L8Emhh5Kd51K4HNtZwSgnz2aEfW9U6P B5xauOlugD+2fY2M4gzh9czCrvkOPT/o5HxTZoHjh7q3TR5CbX2PhANyjuNGf4H3bLix Y3fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744895443; x=1745500243; 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=+KjVHOR8bZyQPFDZiY73GKKuG9sQW4JTgljoEvbnw6g=; b=HYkGQVp5SabK5roCBh6inkLO80H2VjplIAr4gPo61JRrgitkdLSWpD3wU2iNI6+4W+ z/vuUzXel06CJuo5WChbKg67DpKoEgKhXKDIdEzPpujE2KbWi7DBBihpxgGb7Pmu6AQo 26DQuAd+JeZqaOevfYgw0uoQ4bjjsOURYZsQctody5kI1kli081VLRv0O8fBbsV6ToE4 LyCo0XQhfC3+pLMKM2nmVT5uWkKOQPBErvRm+FIGZS2TtrYHLd4H/286TD2AHDuq++qd Oo0fLI9P3nEx7SKlaqL3gfWYvAALep7LwXZ47688egPgWb44a9QfVk4D/P3ZA22fcC+e ICkA== X-Gm-Message-State: AOJu0YxM6NLAVOIsexaOhke+AMhOh7Tz6Ufch5AFVJikGuFZugWYJOyW dCHPvMpp3a+v9l0QMuV1J5/N5W6v5vZx94i5imv8cwRTFns3MMDqD+nHWsbqFTsA3Zor+w8NZZ7 k X-Gm-Gg: ASbGncsG7vw+Vm6GbglfM9ja105b8tAQhRjuPLFaSCVkxRtEUjStj+j762YSuPRoQpP gJEqbCYUkI6rxnISj7uDGHcjMgavbCqjLGfQYJ8pQlet/tPDbeNbWNzfjihhYY2DjtZMUlg/7fU T7QJMKvTMnO7nV86mHzWQOTl+D7JN9f+Z3LnaJBYXpqBBJ98RO50JMUfH6ckLcG9G7WBaGHcm92 x4Pe9Y5TOAyq2GXnoROhT2dJf6FMazwBfL7PtahGhplyleQ2zKJ3D9FIbSViDUv39M9NiTEncka xyQYb6Kk+SjusjfVp7oGYUwiySu6WezF1+Ue9Ssqz9fkbohTNDRmRrY85gQsFs5+T20YOXbqToq Haps0a6bgSC4bwm4= X-Received: by 2002:a5d:588b:0:b0:39e:db6a:4744 with SMTP id ffacd0b85a97d-39ee5b36643mr4900202f8f.32.1744895443530; Thu, 17 Apr 2025 06:10:43 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44043529fdbsm50566085e9.1.2025.04.17.06.10.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 17 Apr 2025 06:10:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH 8/8] gdbstub/helpers: Evaluate TARGET_BIG_ENDIAN at compile time Date: Thu, 17 Apr 2025 15:10:04 +0200 Message-ID: <20250417131004.47205-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250417131004.47205-1-philmd@linaro.org> References: <20250417131004.47205-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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 Rather than evaluating TARGET_BIG_ENDIAN at preprocessing time via #ifdef'ry, do it in C at compile time Signed-off-by: Philippe Mathieu-Daudé Acked-by: Alex Bennée --- include/gdbstub/helpers.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h index 6f7cc48adcb..c33d5dfca3e 100644 --- a/include/gdbstub/helpers.h +++ b/include/gdbstub/helpers.h @@ -56,17 +56,10 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi, uint64_t val_lo) { uint64_t to_quad; -#if TARGET_BIG_ENDIAN - to_quad = tswap64(val_hi); + to_quad = tswap64(TARGET_BIG_ENDIAN ? val_hi : val_lo); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad = tswap64(val_lo); + to_quad = tswap64(TARGET_BIG_ENDIAN ? val_lo : val_hi); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#else - to_quad = tswap64(val_lo); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); - to_quad = tswap64(val_hi); - g_byte_array_append(buf, (uint8_t *) &to_quad, 8); -#endif return 16; }