From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2LrG-0005OF-Ic for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2LrF-0007a0-Ra for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:31:22 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:48007) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2LrF-0007Zi-MW for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:31:21 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1c2LrE-000216-L0 from Julian_Brown@mentor.com for qemu-devel@nongnu.org; Thu, 03 Nov 2016 10:31:20 -0700 From: Julian Brown Date: Thu, 3 Nov 2016 10:30:56 -0700 Message-ID: <1478194258-75276-4-git-send-email-julian@codesourcery.com> In-Reply-To: <1478194258-75276-1-git-send-email-julian@codesourcery.com> References: <1478194258-75276-1-git-send-email-julian@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 3/5] Fix arm_semi_flen_cb for BE32 system mode. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This patch fixes the arm_semi_flen_cb callback so that it doesn't return a byte-swapped size in BE32 system mode. Signed-off-by: Julian Brown --- target-arm/arm-semi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c index a9cf5f2..6c550d0 100644 --- a/target-arm/arm-semi.c +++ b/target-arm/arm-semi.c @@ -188,7 +188,17 @@ static void arm_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err) the value. We assume the size always fit in 32 bits. */ uint32_t size; cpu_memory_rw_debug(cs, arm_flen_buf(cpu) + 32, (uint8_t *)&size, 4, 0); +#ifdef CONFIG_USER_ONLY size = be32_to_cpu(size); +#else + /* If we're running in BE32 system mode, we don't need to do an explicit + * byte swap, because (I think) target memory is already stored in + * byte-swapped format. + */ + if (!arm_sctlr_b(env)) { + size = be32_to_cpu(size); + } +#endif if (is_a64(env)) { env->xregs[0] = size; } else { -- 1.9.1