From patchwork Tue Mar 19 11:21:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Chouteau X-Patchwork-Id: 229008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BAC0B2C00A4 for ; Tue, 19 Mar 2013 22:22:20 +1100 (EST) Received: from localhost ([::1]:36282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHucU-0003py-TA for incoming@patchwork.ozlabs.org; Tue, 19 Mar 2013 07:22:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHubo-0003ZT-Lm for qemu-devel@nongnu.org; Tue, 19 Mar 2013 07:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHubk-0004rt-4l for qemu-devel@nongnu.org; Tue, 19 Mar 2013 07:21:36 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:38034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHubj-0004rK-LJ for qemu-devel@nongnu.org; Tue, 19 Mar 2013 07:21:32 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 380E729005F; Tue, 19 Mar 2013 12:21:31 +0100 (CET) X-Virus-Scanned: amavisd-new at eu.adacore.com Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oDGoE1ACGrky; Tue, 19 Mar 2013 12:21:31 +0100 (CET) Received: from PomPomGalli.act-europe.fr (pompomgalli.act-europe.fr [10.10.1.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 0A525290015; Tue, 19 Mar 2013 12:21:31 +0100 (CET) From: Fabien Chouteau To: qemu-devel@nongnu.org Date: Tue, 19 Mar 2013 12:21:27 +0100 Message-Id: <1363692087-28432-4-git-send-email-chouteau@adacore.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363692087-28432-1-git-send-email-chouteau@adacore.com> References: <1363692087-28432-1-git-send-email-chouteau@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 194.98.77.210 Cc: peter.maydell@linaro.org, paul@codesourcery.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH V2 3/3] target-arm: Fix VFP register byte order in GDB remote X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From GDB Remote Serial Protocol doc: "The bytes with the register are transmitted in target byte order." Signed-off-by: Fabien Chouteau --- target-arm/helper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index e97e1a5..1ba25e1 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -16,18 +16,22 @@ static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) { int nregs; - /* VFP data registers are always little-endian. */ nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - stfq_le_p(buf, env->vfp.regs[reg]); + stfq_p(buf, env->vfp.regs[reg]); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { /* Aliases for Q regs. */ nregs += 16; if (reg < nregs) { - stfq_le_p(buf, env->vfp.regs[(reg - 32) * 2]); - stfq_le_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); +#ifdef TARGET_WORDS_BIGENDIAN + stfq_p(buf, env->vfp.regs[(reg - 32) * 2 + 1]); + stfq_p(buf + 8, env->vfp.regs[(reg - 32) * 2]); +#else + stfq_p(buf, env->vfp.regs[(reg - 32) * 2]); + stfq_p(buf + 8, env->vfp.regs[(reg - 32) * 2 + 1]); +#endif /* TARGET_WORDS_BIGENDIAN */ return 16; } } @@ -45,14 +49,19 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) nregs = arm_feature(env, ARM_FEATURE_VFP3) ? 32 : 16; if (reg < nregs) { - env->vfp.regs[reg] = ldfq_le_p(buf); + env->vfp.regs[reg] = ldfq_p(buf); return 8; } if (arm_feature(env, ARM_FEATURE_NEON)) { nregs += 16; if (reg < nregs) { - env->vfp.regs[(reg - 32) * 2] = ldfq_le_p(buf); - env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_le_p(buf + 8); +#ifdef TARGET_WORDS_BIGENDIAN + env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_p(buf); + env->vfp.regs[(reg - 32) * 2] = ldfq_p(buf + 8); +#else + env->vfp.regs[(reg - 32) * 2] = ldfq_p(buf); + env->vfp.regs[(reg - 32) * 2 + 1] = ldfq_p(buf + 8); +#endif /* TARGET_WORDS_BIGENDIAN */ return 16; } }