Received: by 2002:a17:906:779e:b0:94e:fe67:1757 with SMTP id s30csp2899096ejm; Mon, 24 Apr 2023 08:39:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZjuXbN/sWHr+bYWNmhsaNjr+fToKsEXkFpB1WQIFrsHdUfB/VAeaisYcKx1GzRA8SqkgJx X-Received: by 2002:a67:fe52:0:b0:42e:4cc0:7810 with SMTP id m18-20020a67fe52000000b0042e4cc07810mr5517065vsr.26.1682350790009; Mon, 24 Apr 2023 08:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682350789; cv=none; d=google.com; s=arc-20160816; b=ij0Vwp8vZLzu+dSkIaKkTPU1ljYZkDiJTbrR5iT1SR785Mn3OY6GaUtUmMkfpIOG/X fz8TQVPg8u24uDS01uiIAXofQtmNVEUWFtiwYO22dvaIWSSqD3CF03IorX9n86bZGIzf MUjWzmleYzxnHRajsMsvu9CQA5kbVi9mElO1hPyMxAStI4rzPTzElME5Wg3slJj51MHX XKMgtuvBb8FLZcrgUrXd3V2PHjX+He6OZKgnmenirKjsvwQE5mBpjJ/DP7KCWzZW7SJM 1s11zFmKwWdvZq/Ps0Qh5yaEfsz7loZYfxO5coe2bPge07OQxlbk51w4olS9mw8/7jng sLPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=0jNGQGLAYMBmkguv81DRv0hpSlY3YPxmNo+eS8KRvQc=; b=TbG0jRSmuP/L6ALsjzOr+4ES5/mh/duzqK3sXEHyhDxPNzKKnGI6QudsHy7Lppu6dL qv0KfaYqsv969OzC5Aqj+vNnFNoyMo0BEM9tWIFeVWzOiCWW6tKLqpe30X5A8da8MWBE FU5QXWj1BDjK9qjubWtFbXTM/zMBZoyq7m2Zs5iDdWsFwjo/PrZ5xIhuC6k4Qt6X4y2/ k8C7werWHYh3IFtlXvYxa7dWDFiRlQw6VNbUY/X5TTlciCe3HP8k561Y94XCPBUpoi/I pmmkV5HaDcnJ5gKlPPlhsU0mPFWIoE9tg5m+db/XJqFgViuITxSyXHmABrM/cdLjTNmU fXvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQxjfReV; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w19-20020a05620a445300b0074cdcea5d2dsi7882956qkp.324.2023.04.24.08.39.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 08:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=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=qQxjfReV; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqyHm-00079s-R9; Mon, 24 Apr 2023 11:39:27 -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 1pqyHl-00078N-FS for qemu-arm@nongnu.org; Mon, 24 Apr 2023 11:39:25 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqyHf-0001Tt-Lc for qemu-arm@nongnu.org; Mon, 24 Apr 2023 11:39:21 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-2f625d52275so4433696f8f.3 for ; Mon, 24 Apr 2023 08:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682350751; x=1684942751; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0jNGQGLAYMBmkguv81DRv0hpSlY3YPxmNo+eS8KRvQc=; b=qQxjfReV02y+ZDtGrS52qLOQlzcUTSOuytU2UgEm5ZOu6ldehkX3ApBCWgiVnf9yNt tuaY7841ZbeVJLcpHduEa4NhRHv46yxAcfIJvVx1ntk6VNadXWNPa6IYm1N8fnBpO6zY EPQBdbOBOgIoUi6OtDQVRYhNjRI0DNL0qJr8WGUvwBCLockTFsplvtA3P0znCX80v+8J qAwLumi5gAfVRp/zlv+/LYKgSAd/eIjRlKg2P6ai5lgIhn4xQFL1f+l6q+G3gQtzrdeF Rc0jQyOAhr4pbz2RBQsdXIFMjj39FGiktXAoro2AnoFJm82cvZpX7yHP5Ml3I3DZQ+yt no9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682350751; x=1684942751; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0jNGQGLAYMBmkguv81DRv0hpSlY3YPxmNo+eS8KRvQc=; b=eXa8q6jR7Vq006CfCe7nP+Dz1MEskpPYIb9kqonCokTF1hRcJft63GTMpi6ntceARV ysum1F+FmwAMkSCUEfY0ZngNQP4HZWaEcjaYePuzXRf55YVBdB5R3yT8t0iWpO+y4Q7I 8lu8eVbIVk+4PePPxbOhUrh13kw4UMr/0EHeLmkOE9MktjwrPp616DnWrCqryq9rZIeh N6suKxF0G0ipmzl8Ic3/9IeGeaDnDoc7QhktWTsYZAUt4/EjMSetBRK2K4MdZPXV3Tl6 cPvzLsBVc30n9keTjav4q3z+WncW+/PMPVNsxpWGM/XPKj34p8xdujs/C2mnib/5oRr+ B3xA== X-Gm-Message-State: AAQBX9fSCIS/7OGGI0BoBb/kiW1DkiSVtGGTeGypNQWvU7DogYzhhFwd JkjE2XU+j1lF2Ktiolwy7AZG8Njjg4R8SVZa5qY= X-Received: by 2002:a5d:5246:0:b0:2cf:e517:c138 with SMTP id k6-20020a5d5246000000b002cfe517c138mr9064255wrc.66.1682350751106; Mon, 24 Apr 2023 08:39:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f3-20020adfdb43000000b002efb2d861dasm11041241wrj.77.2023.04.24.08.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 08:39:10 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PATCH 0/2] target/arm: Load correct half of 64-bit fields Date: Mon, 24 Apr 2023 16:39:07 +0100 Message-Id: <20230424153909.1419369-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: eYXyroe01RJe This patchset fixes a bug where on a big-endian 64-bit host the guest would crash immediately when it did an ERET. This happens because when we load the new PC value from CPUARMState::esr_el[2] we do a 32-bit load even though the struct field is 64 bits. So on 64-bit BE we use the wrong half of the register. Patch 1 defines a new macro to load the low 32 bits from a 64-bit field, and uses it in the two places where we got this wrong. Patch 2 adds some compile-time assertions to the existing load_cpu_field() and store_cpu_field() macros that catch inadvertent uses on struct fields of the wrong size. This fix is necessary to be able to run the avocado tests for the orangepi on a 64-bit BE system. thanks -- PMM Peter Maydell (2): target/arm: Define and use new load_cpu_field_low32() target/arm: Add compile time asserts to load/store_cpu_field macros target/arm/translate-a32.h | 24 ++++++++++++++++++++---- target/arm/tcg/translate.c | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) -- 2.34.1