From patchwork Thu Dec 5 12:39:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22066 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 476E123FBA for ; Thu, 5 Dec 2013 12:40:21 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf49975946pbb.1 for ; Thu, 05 Dec 2013 04:40:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=7s4Ks9qaun200ISOChv7SMQBSqCAwb5GEU8fxzdvDdc=; b=bUvnn2Xwmb3UUPSFsrDO7+f8FNEFpHdoxgjoTe3QheNv+lOXRuU9HgWbv/E4CuKy6/ 4Ikv+ekS/8owJACWEZpsgmzP2ZRpSRxAIEpRQIETOh3vK5UQ1kRBbVmJ5SOIuiCvq8xr KTWjuLHyOIAGQPlaVNMcZmunXIl/iVkVQb7SGLnSc6PA8x7jCkE5p6E1CKXk7/QDXCYF tvaC4lFWrfOafT2sgtmgyva1jeaiqvaaanqblJw8CmD8OukmgtBT9NHDE29ZqmsyJPO3 +jrkd1DC4+Prw71vJzZyRDU0fqsUNlMEJ6mHk50ae0mwjmHtG97zjSG0bk+Cz7ULpVw0 sPhQ== X-Gm-Message-State: ALoCoQkn8+XMFpvzYv4v/biNo5qn6ci8GY6y04o/AjuWpSBupM2Rr+7IRERThlqJenHt2rhvFbSm X-Received: by 10.66.142.11 with SMTP id rs11mr8510380pab.37.1386247220479; Thu, 05 Dec 2013 04:40:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.199 with SMTP id a7ls784713qes.87.gmail; Thu, 05 Dec 2013 04:40:20 -0800 (PST) X-Received: by 10.58.233.98 with SMTP id tv2mr63141218vec.11.1386247220321; Thu, 05 Dec 2013 04:40:20 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id k10si34399949vca.124.2013.12.05.04.40.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:40:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so13298496veb.8 for ; Thu, 05 Dec 2013 04:40:20 -0800 (PST) X-Received: by 10.58.144.168 with SMTP id sn8mr2361503veb.33.1386247220090; Thu, 05 Dec 2013 04:40:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp11854vcz; Thu, 5 Dec 2013 04:40:19 -0800 (PST) X-Received: by 10.180.219.33 with SMTP id pl1mr11851211wic.49.1386247218169; Thu, 05 Dec 2013 04:40:18 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id lg4si527971wic.29.2013.12.05.04.40.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:40:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VoYDU-000727-Sj; Thu, 05 Dec 2013 12:39:40 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Matz , C Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 04/12] target-arm: Support fp registers in gdb stub Date: Thu, 5 Dec 2013 12:39:32 +0000 Message-Id: <1386247180-26994-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386247180-26994-1-git-send-email-peter.maydell@linaro.org> References: <1386247180-26994-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Register the aarch64-fpu XML and implement the necessary read/write handlers so we can support reading and writing of FP registers in the gdb stub. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- configure | 2 +- gdb-xml/aarch64-fpu.xml | 86 +++++++++++++++++++++++++++++++++++++++++++++++ target-arm/helper.c | 48 +++++++++++++++++++++++++- 3 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 gdb-xml/aarch64-fpu.xml diff --git a/configure b/configure index 3317013..c9ad1de 100755 --- a/configure +++ b/configure @@ -4401,7 +4401,7 @@ case "$target_name" in aarch64) TARGET_BASE_ARCH=arm bflt="yes" - gdb_xml_files="aarch64-core.xml" + gdb_xml_files="aarch64-core.xml aarch64-fpu.xml" ;; cris) ;; diff --git a/gdb-xml/aarch64-fpu.xml b/gdb-xml/aarch64-fpu.xml new file mode 100644 index 0000000..997197e --- /dev/null +++ b/gdb-xml/aarch64-fpu.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target-arm/helper.c b/target-arm/helper.c index 263dbbf..73c97e8 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -65,6 +65,48 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) return 0; } +static int aarch64_fpu_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg) +{ + switch (reg) { + case 0 ... 31: + /* 128 bit FP register */ + stfq_le_p(buf, env->vfp.regs[reg * 2]); + stfq_le_p(buf + 8, env->vfp.regs[reg * 2 + 1]); + return 16; + case 32: + /* FPSR */ + stl_p(buf, vfp_get_fpsr(env)); + return 4; + case 33: + /* FPCR */ + stl_p(buf, vfp_get_fpcr(env)); + return 4; + default: + return 0; + } +} + +static int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) +{ + switch (reg) { + case 0 ... 31: + /* 128 bit FP register */ + env->vfp.regs[reg * 2] = ldfq_le_p(buf); + env->vfp.regs[reg * 2 + 1] = ldfq_le_p(buf + 8); + return 16; + case 32: + /* FPSR */ + vfp_set_fpsr(env, ldl_p(buf)); + return 4; + case 33: + /* FPCR */ + vfp_set_fpcr(env, ldl_p(buf)); + return 4; + default: + return 0; + } +} + static int raw_read(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t *value) { @@ -1785,7 +1827,11 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) CPUState *cs = CPU(cpu); CPUARMState *env = &cpu->env; - if (arm_feature(env, ARM_FEATURE_NEON)) { + if (arm_feature(env, ARM_FEATURE_AARCH64)) { + gdb_register_coprocessor(cs, aarch64_fpu_gdb_get_reg, + aarch64_fpu_gdb_set_reg, + 34, "aarch64-fpu.xml", 0); + } else if (arm_feature(env, ARM_FEATURE_NEON)) { gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg, 51, "arm-neon.xml", 0); } else if (arm_feature(env, ARM_FEATURE_VFP3)) {