From patchwork Tue Nov 20 02:39:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10689795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDBF26C5 for ; Tue, 20 Nov 2018 02:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEEA029F69 for ; Tue, 20 Nov 2018 02:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D35ED29FDC; Tue, 20 Nov 2018 02:40:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8686929F69 for ; Tue, 20 Nov 2018 02:40:58 +0000 (UTC) Received: from localhost ([::1]:59932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOvyD-0000ot-Py for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Nov 2018 21:40:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOvxC-00008N-NW for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gOvxC-00066R-16 for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:54 -0500 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]:37649) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gOvxB-00064P-QU for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:53 -0500 Received: by mail-lj1-x242.google.com with SMTP id e5-v6so308974lja.4 for ; Mon, 19 Nov 2018 18:39:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tjHo54hN0R79DzUrIwa1SLyYB805qrFCRd96r0Uxv4k=; b=CvIfg3LaOlHQKqyUz4yqEYwbBuLYkdRx9UdlyVduZMTFwlT1vhRFnwEWp56NRRICnA d8/7lRkOhrB5/ti02UuntniELQU3ae2Lv+ZvUsnY8kFIkajoJJSaYb4/YrnyAzNnIgTN /NbeeFUP7EHN1M1+zyNaskywOrVA2fJxGYz8qnPIYgh0+QGKrxTY4MVfhQH0rIfWr5a8 hwJmxhtHQIocTSkEs4T0Fmk69/mcq9qEdR8Q4JlGHL8xw7gQ45lJMn+Ll+kGPQmBE814 U+ixXmMiG+8O1dweQ9rdY49uNXTXK0rBEf3SQumJ+lpHEs3QEgq3Dm5KX9jQJxzkKdHf TG8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tjHo54hN0R79DzUrIwa1SLyYB805qrFCRd96r0Uxv4k=; b=pNsNt1o2MIHVeuDqveI5NuS8L0b0F+eBeSpmw4Xcax6/zV6+ffQTcHtgNFe77zlx8b VPGqpa/ijjiglw/oOmeFX8MbNFb4GNLLoYqspxg5oZxfPt5Bfafp5OFeesJQnF4QtsiM LMLAfnicuTs1Cn3UZDhpDTwY15BtDoegn45vpWt8TtvQaM8M9lJfStDtJwVlUYhAwI2I AWBkUHPe6B0/RB7asf11OSJz9ZdvDqMeR3QohkjGZ7dsuhmfhoAb2UZ2mss1yyK4HLJB FCMczGGw7zlghAffaKxXMtKUQcG+TT9Wc2vdYF8iSMGq6BJl3SXYinIQPMkg7W2Q7qfX H4ew== X-Gm-Message-State: AGRZ1gLF2TbtLqDqgeY/C8HNTnPSnDpGXlseh4D9wVsqg68y7WP4SN5M G5k6Ma8PpUUSpXiZgKhwbItLBnPW X-Google-Smtp-Source: AFSGD/WgQg0DhlQ3+HYzKM12z1BpqFIvoZBf8g2eAd6iYTFP/i5rFfv6Zu4Zj+5ebIjwjn0Yz8MTLQ== X-Received: by 2002:a2e:3803:: with SMTP id f3-v6mr88038lja.169.1542681592321; Mon, 19 Nov 2018 18:39:52 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id 11sm5913054lfq.89.2018.11.19.18.39.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 18:39:51 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Mon, 19 Nov 2018 18:39:33 -0800 Message-Id: <20181120023934.8552-2-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181120023934.8552-1-jcmvbkbc@gmail.com> References: <20181120023934.8552-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::242 Subject: [Qemu-devel] [PATCH 1/2] target/xtensa: gdbstub fix register counting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In order to communicate correctly with gdb xtensa gdbstub must provide expected number of registers in 'g' packet response. xtensa-elf-gdb expects both nonprivileged and privileged registers. xtensa-linux-gdb only expects nonprivileged registers. gdb only counts one contiguous stretch of registers, do the same for the core registers in the xtensa_count_regs. With this change qemu-system-xtensa is able to communicate with all xtensa-elf-gdb versions (versions prior to 8.2 require overlay fixup), and qemu-xtensa is able to communicate with all xtensa-linux-gdb versions, except 8.2. Signed-off-by: Max Filippov --- target/xtensa/gdbstub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/xtensa/gdbstub.c b/target/xtensa/gdbstub.c index c9450914c72d..d43bb190c614 100644 --- a/target/xtensa/gdbstub.c +++ b/target/xtensa/gdbstub.c @@ -45,15 +45,20 @@ void xtensa_count_regs(const XtensaConfig *config, unsigned *n_regs, unsigned *n_core_regs) { unsigned i; + bool count_core_regs = true; for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) { if (config->gdb_regmap.reg[i].type != xtRegisterTypeTieState && config->gdb_regmap.reg[i].type != xtRegisterTypeMapped && config->gdb_regmap.reg[i].type != xtRegisterTypeUnmapped) { ++*n_regs; - if ((config->gdb_regmap.reg[i].flags & - XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) { - ++*n_core_regs; + if (count_core_regs) { + if ((config->gdb_regmap.reg[i].flags & + XTENSA_REGISTER_FLAGS_PRIVILEGED) == 0) { + ++*n_core_regs; + } else { + count_core_regs = false; + } } } } From patchwork Tue Nov 20 02:39:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10689797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7307C1709 for ; Tue, 20 Nov 2018 02:43:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C0B629FDC for ; Tue, 20 Nov 2018 02:43:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA842A16C; Tue, 20 Nov 2018 02:43:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D438429FDC for ; Tue, 20 Nov 2018 02:42:59 +0000 (UTC) Received: from localhost ([::1]:59936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOw0B-0001bv-8t for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Nov 2018 21:42:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOvxE-000091-UM for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gOvxE-0006Cm-6w for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:56 -0500 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:36518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gOvxD-0006A4-W6 for qemu-devel@nongnu.org; Mon, 19 Nov 2018 21:39:56 -0500 Received: by mail-lj1-x243.google.com with SMTP id g11-v6so311268ljk.3 for ; Mon, 19 Nov 2018 18:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gXJly4DixGDtfX31RgNLty34PJn2Ql4pd49qnqmnQSk=; b=f/7Wy+2C81Tzhmlo0QKBGxUCmiC+Jdj8L4T36qGXJSCwxo4+m8+zOTLAjlnqo6g3H/ Vt6jgd+Z1oanIASpWuY/XZ794FWnrN5vMgIMVVxLduZXK7MHX76gK4gDBLfSc0m7dpBm pk30OG+RlKw8J8voWRn1kQva5dYtHdpM+11EbRWRwwBXA+OtJ5nLDygz59Q+rPGQgtAb MuwL17dvyoGJjkDniSceVQcAqD0NNqa4ZZH2oL7RXX//Y8dynsSwaeedsKhlwAV72c5R k/q57Ps6237ou9UC0iGzLfaGxKG5NaV5CRrTUqZAq4J7MkYRsJhYFxUv07wq71Qz43b4 dgIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gXJly4DixGDtfX31RgNLty34PJn2Ql4pd49qnqmnQSk=; b=B8FhECUGw4Jjvo9nMu6qGJ3Ssu44WBVjHmNdYnzywXT1UoIyw/cGz2melrE0NtvHGR 29gOOIdsb7LB38GqcRBqan4PhSWbfeuqPm5dewMgpy6WAzVt+ZxnX/PiU845giFOcAs/ XvBAuJvdDZVQAVDwUkNoVJHF9XCz7x+ptsxmbvTdVwuvjIivAlXW2xvYS9HIT9TwSN16 xIDRqBQK+OkIE0UzdWmjEVGHHduW2AkQcChFQO2UUqBTREwz6FTc8v7vXJu44tTNzjDY HZWC8WtKBA/m0Jz1EKHKIbe2EVpmRViNFf8AfLqJBuFM4JThGQ5rmg0+NfDziFX57uEy 2Z7w== X-Gm-Message-State: AA+aEWagcXYaEOXu6CRPLgCOE0i6uvgl2ZOdrt5ZcE5CZ6yNeqWBqnDZ XE7m8gboJU8OZUeUXoLXP80bmXhe X-Google-Smtp-Source: AFSGD/Vc7aaBb2AAS1MUvuCHeiPbVhHdnKl2s6PVGLHtiF8w4hw7eeM9XONJcbYyEFn+ntNt7PasFA== X-Received: by 2002:a2e:449c:: with SMTP id b28-v6mr96275ljf.47.1542681594467; Mon, 19 Nov 2018 18:39:54 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id 11sm5913054lfq.89.2018.11.19.18.39.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 18:39:53 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Mon, 19 Nov 2018 18:39:34 -0800 Message-Id: <20181120023934.8552-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181120023934.8552-1-jcmvbkbc@gmail.com> References: <20181120023934.8552-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::243 Subject: [Qemu-devel] [PATCH 2/2] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that xtensa_count_regs does the right thing, remove manual initialization of these fields from the affected configurations and let xtensa_finalize_config initialize them. Add XTREG_END to terminate register lists. Signed-off-by: Max Filippov --- target/xtensa/core-dc232b.c | 2 -- target/xtensa/core-dc232b/gdb-config.inc.c | 1 + target/xtensa/core-dc233c.c | 2 -- target/xtensa/core-dc233c/gdb-config.inc.c | 1 + 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/xtensa/core-dc232b.c b/target/xtensa/core-dc232b.c index 71313378409e..7851bcb63687 100644 --- a/target/xtensa/core-dc232b.c +++ b/target/xtensa/core-dc232b.c @@ -40,8 +40,6 @@ static XtensaConfig dc232b __attribute__((unused)) = { .name = "dc232b", .gdb_regmap = { - .num_regs = 120, - .num_core_regs = 52, .reg = { #include "core-dc232b/gdb-config.inc.c" } diff --git a/target/xtensa/core-dc232b/gdb-config.inc.c b/target/xtensa/core-dc232b/gdb-config.inc.c index 13aba5edecd6..d87168628be8 100644 --- a/target/xtensa/core-dc232b/gdb-config.inc.c +++ b/target/xtensa/core-dc232b/gdb-config.inc.c @@ -259,3 +259,4 @@ 0, 0, 0, 0, 0, 0) XTREG(119, 476, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15, 0, 0, 0, 0, 0, 0) + XTREG_END diff --git a/target/xtensa/core-dc233c.c b/target/xtensa/core-dc233c.c index d701e3f5de07..8853bfd4d08f 100644 --- a/target/xtensa/core-dc233c.c +++ b/target/xtensa/core-dc233c.c @@ -40,8 +40,6 @@ static XtensaConfig dc233c __attribute__((unused)) = { .name = "dc233c", .gdb_regmap = { - .num_regs = 121, - .num_core_regs = 52, .reg = { #include "core-dc233c/gdb-config.inc.c" } diff --git a/target/xtensa/core-dc233c/gdb-config.inc.c b/target/xtensa/core-dc233c/gdb-config.inc.c index b632341b28ec..7e8963227fc0 100644 --- a/target/xtensa/core-dc233c/gdb-config.inc.c +++ b/target/xtensa/core-dc233c/gdb-config.inc.c @@ -143,3 +143,4 @@ XTREG(117, 468, 32, 4, 4, 0x000c, 0x0006, -2, 8, 0x0100, a12, 0, 0, 0, 0 XTREG(118, 472, 32, 4, 4, 0x000d, 0x0006, -2, 8, 0x0100, a13, 0, 0, 0, 0, 0, 0) XTREG(119, 476, 32, 4, 4, 0x000e, 0x0006, -2, 8, 0x0100, a14, 0, 0, 0, 0, 0, 0) XTREG(120, 480, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15, 0, 0, 0, 0, 0, 0) +XTREG_END