From patchwork Tue Feb 12 23:07:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 10808893 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 42DEB746 for ; Tue, 12 Feb 2019 23:08:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271542C1A1 for ; Tue, 12 Feb 2019 23:08:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18F172C1A5; Tue, 12 Feb 2019 23:08:50 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E7D012C1A1 for ; Tue, 12 Feb 2019 23:08:48 +0000 (UTC) Received: from localhost ([127.0.0.1]:47541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthAW-00057U-4l for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Feb 2019 18:08:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gth9k-00055d-Lp for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gth9e-0002Cf-RH for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:07:59 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37705) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gth9V-00021u-GI for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:07:48 -0500 Received: by mail-pg1-x544.google.com with SMTP id q206so186338pgq.4 for ; Tue, 12 Feb 2019 15:07:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JAYU+2F483zK8KnpD8sCcmnCkD048BdqncLBbGqKdkQ=; b=IJ/1HeWvd+Z1hztKomZHWYPesWPm119JDLQjeQSmqG6MNwfUbqW/4xANQZiPt06eaJ VVYlEVFjvq3tC7vsGAzkwzCfEyU4+oNTi2+i857KlRVt/SPLO6/w7BUkzik31qyEd8B1 33owryWWEA/6QRpUer9qBHc25n3t6ny/gETMJ4cwZ/cJehrhTQBYUVVh/qJOte2Eig7a NN/GJ0Nn30APc/ze4lIRIzxR2Sg+3iAhD8TuritPrh+S9XjebD5VYXfGaTEGFjk4HCio aT12ZTvGz41HonsFfGTu7cigKlcysA8UB6XRCfjHPK4oEUYWHOIdjXoOBXFRiiDs4o2X 82Rg== 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=JAYU+2F483zK8KnpD8sCcmnCkD048BdqncLBbGqKdkQ=; b=Smm8vWnhpTUwMW+qYs3zn2Z4kQ0dvU1dMqzYllb5vCC5kK0EgmzB3bvRNmlgoU8Gva Q+DHKqndRjSQXyKm9JYD+79Urw3csz8pVC1IjLBGHjkb0Ek9/TDW9DtbneMW67h0rbGJ GOPnqcYp0bOhhx9vIkTFtbSzduFDmSY2a3kZRRG/Sw7Ujc6RMPl2I5gtUuaYgGjUBClG 4skK7vpxMM5afNhTa1LAURRda6NAEClTfk/DbI2+zlLo79eiMjwqbRFPSuAwFmVl6c8n qmVY+CZRaqvhadtgtX/giyV2ZynRY6NX0Z3N4SRcSQBU67FE1o+KjjJb7OCDqi3ZIIxi dNWA== X-Gm-Message-State: AHQUAuY89CsIYk7txX8k0Z9qhwhWJOPD4VyiiQ8etk1vG1bVbNUpuHaz 187EWXHDoiyvmovXMWxD0XZKQ3xEAXY= X-Google-Smtp-Source: AHgI3IahHQ95FTy3vdUiSToqHfL1pyDNA2ch4bl34ijRKnDb6eWqlnUyCntKF7AZxzFwqnpICE0vLA== X-Received: by 2002:a63:374e:: with SMTP id g14mr6008410pgn.59.1550012863330; Tue, 12 Feb 2019 15:07:43 -0800 (PST) Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id n25sm6164651pfi.173.2019.02.12.15.07.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 15:07:42 -0800 (PST) From: Jim Wilson To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 15:07:20 -0800 Message-Id: <20190212230720.9033-1-jimw@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v4 1/5] RISC-V: Add 32-bit gdb xml files. 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: qemu-riscv@nongnu.org, Jim Wilson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jim Wilson Reviewed-by: Alistair Francis --- configure | 1 + gdb-xml/riscv-32bit-cpu.xml | 43 ++++++++ gdb-xml/riscv-32bit-csr.xml | 250 ++++++++++++++++++++++++++++++++++++++++++++ gdb-xml/riscv-32bit-fpu.xml | 46 ++++++++ 4 files changed, 340 insertions(+) create mode 100644 gdb-xml/riscv-32bit-cpu.xml create mode 100644 gdb-xml/riscv-32bit-csr.xml create mode 100644 gdb-xml/riscv-32bit-fpu.xml diff --git a/configure b/configure index fbd0825..febe292 100755 --- a/configure +++ b/configure @@ -7251,6 +7251,7 @@ case "$target_name" in TARGET_BASE_ARCH=riscv TARGET_ABI_DIR=riscv mttcg=yes + gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-32bit-csr.xml" target_compiler=$cross_cc_riscv32 ;; riscv64) diff --git a/gdb-xml/riscv-32bit-cpu.xml b/gdb-xml/riscv-32bit-cpu.xml new file mode 100644 index 0000000..c02f86c --- /dev/null +++ b/gdb-xml/riscv-32bit-cpu.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/riscv-32bit-csr.xml b/gdb-xml/riscv-32bit-csr.xml new file mode 100644 index 0000000..4aea9e6 --- /dev/null +++ b/gdb-xml/riscv-32bit-csr.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/riscv-32bit-fpu.xml b/gdb-xml/riscv-32bit-fpu.xml new file mode 100644 index 0000000..783287d --- /dev/null +++ b/gdb-xml/riscv-32bit-fpu.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From patchwork Tue Feb 12 23:08:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 10808897 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 64D8B746 for ; Tue, 12 Feb 2019 23:10:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 529DF2C1C0 for ; Tue, 12 Feb 2019 23:10:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43FC22C1C6; Tue, 12 Feb 2019 23:10:49 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B64A2C1C0 for ; Tue, 12 Feb 2019 23:10:48 +0000 (UTC) Received: from localhost ([127.0.0.1]:47559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthCR-0006CT-Cv for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Feb 2019 18:10:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gth9x-0005Ae-CG for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gth9v-0002WW-HO for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:13 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40509) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gth9v-0002Vm-8P for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:11 -0500 Received: by mail-pf1-x444.google.com with SMTP id h1so184290pfo.7 for ; Tue, 12 Feb 2019 15:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1XvYS0b5LYfk7L+WuPvAlhKOaDmpH1C0Be3jRDJjYN8=; b=lWZIUTtk7KJXBLXY+eGxcby3f/V3QO6pN5XbasFM/55ZJRL/tcLgjGbzcSheLZEM7O XKQ+DwMfcFNE2rMQZflpFztKXHCj017aGZe60a7/XpYAiJTUhQ/ly5a0qd6Z79rQSAVk ROCnh2vCzKKla5/PfL3lvpooqBxnl3wiWAeHKmHjI8GeWDE49iTLL7EEa1xotLdTWaKy eag3tmXKc/T8nwa+Xwvj1yxsqUORlexWBPHJwr7ZJngx8Ksb+5fSzQjx6ztDr1hsI+2e 0DsjqKxFMG5PB3ea/sNb6OVxRrDm9tanmPRlJgwG8m4LnDwt2NkWDio08QaLyOJ6hqpd 1IYQ== 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=1XvYS0b5LYfk7L+WuPvAlhKOaDmpH1C0Be3jRDJjYN8=; b=t8tNnhN+tdvNIfN1tQivgCjr787c9D1W1dqvV6GIoNL0h1mj6GzkvrIPC0NXmMW+rl Ti38m8Bj5UU7wjSB2pPhY1ZDOgyfwuS1tY9DK3gteqWeUCSkapXGoXL6Vjs/ULlsypO8 HM8Ho88NOZ93SlOZCW35NGB1VCxxhlwmiOJwDMrHxOx9Vgd33aH0BrLLxYbRWAleRqMh cRSXRo1Xddl4MOoeI8C2ALbzwWwP9neXfu3cIjRwOizjhmTU8E5L7WgNZ62gCtXS8Sgy UOltq/tLqxmIEnLhrUfO3L13rt6Rf/qB1xG9WewwqAx1Tle7gqnGLIhJCPNSw/jVcn67 uCzw== X-Gm-Message-State: AHQUAuY+FvdWykN61DqXX7ZQUrwR1AVCxBHXjEtqX0eWEw3ujhdNTjJV Bjl35dgsutZlaUlCRCOwmjVIjW/DE10= X-Google-Smtp-Source: AHgI3Ibhs4vhUAB+5OrKA7Cu1Sw7MXX1t1baOPG2VWTzyffUov7glSZuh6ekxjx6jV0rBrr19Bdqzw== X-Received: by 2002:a63:f201:: with SMTP id v1mr5575556pgh.232.1550012889920; Tue, 12 Feb 2019 15:08:09 -0800 (PST) Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id v13sm18817754pff.20.2019.02.12.15.08.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 15:08:09 -0800 (PST) From: Jim Wilson To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 15:08:04 -0800 Message-Id: <20190212230804.9103-1-jimw@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v4 2/5] RISC-V: Add 64-bit gdb xml files. 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: qemu-riscv@nongnu.org, Jim Wilson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jim Wilson Reviewed-by: Alistair Francis --- configure | 1 + gdb-xml/riscv-64bit-cpu.xml | 43 ++++++++ gdb-xml/riscv-64bit-csr.xml | 250 ++++++++++++++++++++++++++++++++++++++++++++ gdb-xml/riscv-64bit-fpu.xml | 52 +++++++++ 4 files changed, 346 insertions(+) create mode 100644 gdb-xml/riscv-64bit-cpu.xml create mode 100644 gdb-xml/riscv-64bit-csr.xml create mode 100644 gdb-xml/riscv-64bit-fpu.xml diff --git a/configure b/configure index febe292..d7cae4e 100755 --- a/configure +++ b/configure @@ -7258,6 +7258,7 @@ case "$target_name" in TARGET_BASE_ARCH=riscv TARGET_ABI_DIR=riscv mttcg=yes + gdb_xml_files="riscv-64bit-cpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml" target_compiler=$cross_cc_riscv64 ;; sh4|sh4eb) diff --git a/gdb-xml/riscv-64bit-cpu.xml b/gdb-xml/riscv-64bit-cpu.xml new file mode 100644 index 0000000..f37d7f3 --- /dev/null +++ b/gdb-xml/riscv-64bit-cpu.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/riscv-64bit-csr.xml b/gdb-xml/riscv-64bit-csr.xml new file mode 100644 index 0000000..a3de834 --- /dev/null +++ b/gdb-xml/riscv-64bit-csr.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/riscv-64bit-fpu.xml b/gdb-xml/riscv-64bit-fpu.xml new file mode 100644 index 0000000..fb24b72 --- /dev/null +++ b/gdb-xml/riscv-64bit-fpu.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From patchwork Tue Feb 12 23:08:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 10808895 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 3046713A4 for ; Tue, 12 Feb 2019 23:09:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B3AA2BF0D for ; Tue, 12 Feb 2019 23:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D7D2BFCB; Tue, 12 Feb 2019 23:09:37 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D7E72BF0D for ; Tue, 12 Feb 2019 23:09:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:47546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthBH-0005OY-Uc for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Feb 2019 18:09:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthAM-0005NW-4w for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gthAL-0002sW-Bo for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:38 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:37070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gthAL-0002qb-4G for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:08:37 -0500 Received: by mail-pf1-x442.google.com with SMTP id s22so190999pfh.4 for ; Tue, 12 Feb 2019 15:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xf4bRx6j/bwpTEm7Vgnjf3FbAauofrWR7TzR9TjFWbc=; b=nWJMQvMoMMhFiLO8um+ZR41iNDdeD2y+K+gVK5/GC7ETupfSlmmkVXylY9uMVuylLi +1vktUlpyEVhJqzU/3tE9CmcSJ07H5AvEFGlJcWvyTddYowxxFj/NuGQO2Yb9VETa1fo xzItB/wiZ49zrxkfL8oSiByNwlI5dlrcnxD5PiIin/MRCmUNav9CQPm6B1Xo9arPD36q LDYQ0S4Ideuogzi+TNt6kRV+3aTha4+q+OMH3gKxshTDJPfYyrl5UP8X+PpRM77sYbok S/idJmEd4osJRanDykfcVfQpEEeMYfFYDMUtPySLJEyFGZMtOqH5PXKPtkGFrl6Hk80F bBgA== 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=xf4bRx6j/bwpTEm7Vgnjf3FbAauofrWR7TzR9TjFWbc=; b=Q211GuXQ8L38kZ5b+r/TsNDgxNHtZS9z59JMHpkj7GkGonnZginpZktSdif0CeuY4H 1DbTZJ4oRxRopvHqRp8LVxY6Td0tmdldw7h3TOWkSoX4RLpPEGkl/Z8AdMiYlVFY10On 16WRn22nAo/RTxmC3PB6YXSJrFnZer8BdfxSRI2OQ38LgOVid/CIh4KqRVvUOLS62MjN Dfd5EVw6x9eZPmpgpu9V+cw2Lx73WDDK+iUrJhyZDf42VxKX4iMnydPf2kE2HBvHtfzb Iwg2usC7rrcW/HApJL9UnQKrxI30XomVi18q8MGvdUOthxqB4EPz0sJw6H1I7wAUlodE ImoA== X-Gm-Message-State: AHQUAub3NZ+9XNvvlmfRMIEvwIyx7dH4CRjf5xysWtoj14cYmea/bxtj NSKtlhPlkouzIvb9PmTFF2/amnK/eu0= X-Google-Smtp-Source: AHgI3IahJCO5Na1/yw6g4yOpyE06a/qwU3uet80YiAPIN24gBqGej9uavvpqZFCmhvC3FcHWQAUfeg== X-Received: by 2002:a62:3603:: with SMTP id d3mr6571713pfa.146.1550012914586; Tue, 12 Feb 2019 15:08:34 -0800 (PST) Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id y134sm4266708pfb.175.2019.02.12.15.08.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 15:08:34 -0800 (PST) From: Jim Wilson To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 15:08:30 -0800 Message-Id: <20190212230830.9160-1-jimw@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v4 3/5] RISC-V: Fixes to CSR_* register macros. 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: qemu-riscv@nongnu.org, Jim Wilson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This adds some missing CSR_* register macros, and documents some as being priv v1.9.1 specific. Signed-off-by: Jim Wilson Reviewed-by: Alistair Francis --- target/riscv/cpu_bits.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 5439f47..316d500 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -135,16 +135,22 @@ /* Legacy Counter Setup (priv v1.9.1) */ #define CSR_MUCOUNTEREN 0x320 #define CSR_MSCOUNTEREN 0x321 +#define CSR_MHCOUNTEREN 0x322 /* Machine Trap Handling */ #define CSR_MSCRATCH 0x340 #define CSR_MEPC 0x341 #define CSR_MCAUSE 0x342 -#define CSR_MBADADDR 0x343 +#define CSR_MTVAL 0x343 #define CSR_MIP 0x344 +/* Legacy Machine Trap Handling (priv v1.9.1) */ +#define CSR_MBADADDR 0x343 + /* Supervisor Trap Setup */ #define CSR_SSTATUS 0x100 +#define CSR_SEDELEG 0x102 +#define CSR_SIDELEG 0x103 #define CSR_SIE 0x104 #define CSR_STVEC 0x105 #define CSR_SCOUNTEREN 0x106 @@ -153,9 +159,12 @@ #define CSR_SSCRATCH 0x140 #define CSR_SEPC 0x141 #define CSR_SCAUSE 0x142 -#define CSR_SBADADDR 0x143 +#define CSR_STVAL 0x143 #define CSR_SIP 0x144 +/* Legacy Supervisor Trap Handling (priv v1.9.1) */ +#define CSR_SBADADDR 0x143 + /* Supervisor Protection and Translation */ #define CSR_SPTBR 0x180 #define CSR_SATP 0x180 @@ -282,6 +291,28 @@ #define CSR_MHPMCOUNTER30H 0xb9e #define CSR_MHPMCOUNTER31H 0xb9f +/* Legacy Hypervisor Trap Setup (priv v1.9.1) */ +#define CSR_HSTATUS 0x200 +#define CSR_HEDELEG 0x202 +#define CSR_HIDELEG 0x203 +#define CSR_HIE 0x204 +#define CSR_HTVEC 0x205 + +/* Legacy Hypervisor Trap Handling (priv v1.9.1) */ +#define CSR_HSCRATCH 0x240 +#define CSR_HEPC 0x241 +#define CSR_HCAUSE 0x242 +#define CSR_HBADADDR 0x243 +#define CSR_HIP 0x244 + +/* Legacy Machine Protection and Translation (priv v1.9.1) */ +#define CSR_MBASE 0x380 +#define CSR_MBOUND 0x381 +#define CSR_MIBASE 0x382 +#define CSR_MIBOUND 0x383 +#define CSR_MDBASE 0x384 +#define CSR_MDBOUND 0x385 + /* mstatus CSR bits */ #define MSTATUS_UIE 0x00000001 #define MSTATUS_SIE 0x00000002 From patchwork Tue Feb 12 23:09:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 10808901 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 417C2746 for ; Tue, 12 Feb 2019 23:11:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ED8F2C1C0 for ; Tue, 12 Feb 2019 23:11:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F91D2C1C9; Tue, 12 Feb 2019 23:11:54 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C1EC2C1C0 for ; Tue, 12 Feb 2019 23:11:53 +0000 (UTC) Received: from localhost ([127.0.0.1]:47601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthDU-0006z9-MU for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Feb 2019 18:11:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthAq-0005qT-3v for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:09:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gthAp-0003OI-1u for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:09:08 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39833) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gthAo-0003NE-SW for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:09:07 -0500 Received: by mail-pl1-x641.google.com with SMTP id 101so189246pld.6 for ; Tue, 12 Feb 2019 15:09:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jEOwJ39SLu7LPsZGsv/aOl5LdrYLz2G0H5NnL2aHCMQ=; b=M/aHQbAjnnOOsuuNq9geohzVH1eCeoXBbYNhPkxzeJpafQi3vXgbuvjeH90rMrXzux oF+WIEMt8OROfYqea4RsS/7uVwJkOh4AKNDVpe1t3rZK0LVY2srsIIKfz0x9NyKLKzK2 th/lEYO0kUluIGrwqkNpLtmmOJYH7m8fwxcGHBk7SKtmu+1mkqCRsj2QIbIR6J9esNF7 EaVGFKE/3PdHQOiwg4QSG2LVnO9/+tvZ5n87LSdpzPhoY9tau6g/lTp9oS+PBjmIHczZ J8YUNVUMd0IvouEQW68GzsthTm1IwE1hjOhr7eJGx7UJbK0yxosIybw7SzMSsx2xe9xD DUjQ== 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=jEOwJ39SLu7LPsZGsv/aOl5LdrYLz2G0H5NnL2aHCMQ=; b=MddQa6HjCqK5JegHwJhE4Er5ixL1F4TyVpYBoUIGVxTy0hKCT57gKgc3hf3A3t6mJV U39mk0DtxbX9llp7iVoIjqPsGTyf+GyTLGEG1U5/OXC40Oe3pZUjaE6f8XLxDHQIjGE/ gFIdmyrjFl26MQD8pMufnm66a9KvX+9PfdFP26710PESFe84h9qBZYA2Miv8L2FvqdZl P+Dss3227gqLBVl6G9vBqguTWBJ4lIr4TVA7Kdrl+UDpOLMcKG3ieVDw39KX8Be62N1a NX7bmNTogUd2zcg8QhieaYXDE1zRd6nlqjZmtJrm3exU0TAMXLmjvMwUl+IMYzXsd0C7 kI/w== X-Gm-Message-State: AHQUAuYNeOijs8WXMFN8NnrXpk0fF5UKa9PFTd71FdGAfgQRAnPTjKUM n4tEh5YtHAx4n3GtpxcilwiPY/n7Rq8= X-Google-Smtp-Source: AHgI3IaVuKKg0G6nti+oZjOHPDbf13zx4rsimZyuq3r0k5nHVnD0X+QFDVVwWHO3W4xQVdirQlaBvQ== X-Received: by 2002:a17:902:7592:: with SMTP id j18mr6356749pll.289.1550012945643; Tue, 12 Feb 2019 15:09:05 -0800 (PST) Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id 145sm20569080pfa.160.2019.02.12.15.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 15:09:05 -0800 (PST) From: Jim Wilson To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 15:09:03 -0800 Message-Id: <20190212230903.9215-1-jimw@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v4 4/5] RISC-V: Add debug support for accessing CSRs. 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: qemu-riscv@nongnu.org, Jim Wilson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a debugger field to CPURISCVState. Add riscv_csrrw_debug function to set it. Disable mode checks when debugger field true. Signed-off-by: Jim Wilson Reviewed-by: Alistair Francis --- target/riscv/cpu.h | 5 +++++ target/riscv/csr.c | 34 ++++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 743f02c..04a050e 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -170,6 +170,9 @@ struct CPURISCVState { /* physical memory protection */ pmp_table_t pmp_state; + + /* True if in debugger mode. */ + bool debugger; #endif float_status fp_status; @@ -292,6 +295,8 @@ static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, int riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value, target_ulong new_value, target_ulong write_mask); +int riscv_csrrw_debug(CPURISCVState *env, int csrno, target_ulong *ret_value, + target_ulong new_value, target_ulong write_mask); static inline void csr_write_helper(CPURISCVState *env, target_ulong val, int csrno) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 5e7e7d1..de28a5d 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -46,7 +46,7 @@ void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops) static int fs(CPURISCVState *env, int csrno) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } #endif @@ -58,7 +58,7 @@ static int ctr(CPURISCVState *env, int csrno) #if !defined(CONFIG_USER_ONLY) target_ulong ctr_en = env->priv == PRV_U ? env->scounteren : env->priv == PRV_S ? env->mcounteren : -1U; - if (!(ctr_en & (1 << (csrno & 31)))) { + if (!env->debugger && !(ctr_en & (1 << (csrno & 31)))) { return -1; } #endif @@ -86,7 +86,7 @@ static int pmp(CPURISCVState *env, int csrno) static int read_fflags(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } #endif @@ -97,7 +97,7 @@ static int read_fflags(CPURISCVState *env, int csrno, target_ulong *val) static int write_fflags(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } env->mstatus |= MSTATUS_FS; @@ -109,7 +109,7 @@ static int write_fflags(CPURISCVState *env, int csrno, target_ulong val) static int read_frm(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } #endif @@ -120,7 +120,7 @@ static int read_frm(CPURISCVState *env, int csrno, target_ulong *val) static int write_frm(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } env->mstatus |= MSTATUS_FS; @@ -132,7 +132,7 @@ static int write_frm(CPURISCVState *env, int csrno, target_ulong val) static int read_fcsr(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } #endif @@ -144,7 +144,7 @@ static int read_fcsr(CPURISCVState *env, int csrno, target_ulong *val) static int write_fcsr(CPURISCVState *env, int csrno, target_ulong val) { #if !defined(CONFIG_USER_ONLY) - if (!(env->mstatus & MSTATUS_FS)) { + if (!env->debugger && !(env->mstatus & MSTATUS_FS)) { return -1; } env->mstatus |= MSTATUS_FS; @@ -772,6 +772,24 @@ int riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value, return 0; } +/* + * Debugger support. If not in user mode, set env->debugger before the + * riscv_csrrw call and clear it after the call. + */ +int riscv_csrrw_debug(CPURISCVState *env, int csrno, target_ulong *ret_value, + target_ulong new_value, target_ulong write_mask) +{ + int ret; +#if !defined(CONFIG_USER_ONLY) + env->debugger = true; +#endif + ret = riscv_csrrw(env, csrno, ret_value, new_value, write_mask); +#if !defined(CONFIG_USER_ONLY) + env->debugger = false; +#endif + return ret; +} + /* Control and Status Register function table */ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { /* User Floating-Point CSRs */ From patchwork Tue Feb 12 23:09:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 10808899 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 6F83D746 for ; Tue, 12 Feb 2019 23:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E3702C1C0 for ; Tue, 12 Feb 2019 23:11:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FF3C2C1D1; Tue, 12 Feb 2019 23:11:14 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E1EC2C1C0 for ; Tue, 12 Feb 2019 23:11:13 +0000 (UTC) Received: from localhost ([127.0.0.1]:47605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthCq-0007NL-45 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Feb 2019 18:11:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gthBf-0006Mk-1j for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:10:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gthBc-0004AX-QE for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:09:58 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:34067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gthBc-0003oW-HE for qemu-devel@nongnu.org; Tue, 12 Feb 2019 18:09:56 -0500 Received: by mail-pg1-x544.google.com with SMTP id i130so197726pgd.1 for ; Tue, 12 Feb 2019 15:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yhYgbGRu+fy+bPScV6/0+Wfzn9IfLb1K9LTOi5++2UY=; b=H2ftNDqaURO2ZWjJtgEs+9wjs36YMQSl3r4YtA92PRKGxNfCWcEaVkgFYm8jYLpXPF HGXjVvypCIFlOagfAPE3shJ0llaI/YkBFGnelptR4WO4iGxmv9gkPv55g/QoCwXKzz8P ouwz9U/lY6VL+nIFwLREJHn5CTTEqe1keRRNBliiJXO1immlboHC77JuTDebjmmwsDLO plAO6JHML09NPz6TDBaS95Ia+nAl3ynps3jDLAbKZvhC0WFfEl3198BTFXm5wGn8RDCc 5C1DyCjvsiT5q+I8OGBCcj6xWWkvB9uVEpBP5WtDeXmrD7GBJ7hS6/1Z9xey9yU2vb/b lm0Q== 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=yhYgbGRu+fy+bPScV6/0+Wfzn9IfLb1K9LTOi5++2UY=; b=fx0yfbtDez+7Oq11qSXXsjcmMnqzVlTBMR3t9EWunGiq+Sc5XebUkeQnDbRCy6ddjT zXqZxujSyBK4j41AW9oNC/gz16XMatRIIUECgy+TGbBZFaQ3u3vxV3wAgwq3KQuXXdHL HeEpkY62cEeaqu+lMuhqIjw6rrdSajE+sgc6Ug4odBbN8IVkxFpwgxu1ZZfvqQGPaunu XrgFyU55Tr0EDDGFcAP3JWPk/9DggID6pFJ1mf6s/JG6oiNMXchmR/qdMEuOgDO6nntU VcSXB3MtApOUb+EfOlFS4JTlJoBUoGH5n6mylwYU+PQt2kO4pO7oTrdTD5V+Sr5LtSnj FDdg== X-Gm-Message-State: AHQUAuYUVTaGll6ZDlLXActfbdjaRIrek588it3l4p/8vHpFFOT8dSHV 7GXBQqfzH+r4cwB31J3NaytGQ/GYM20= X-Google-Smtp-Source: AHgI3IZkfBI2WbB9lpmJ99qvyHuKY4kM7iLPa9enTuewTk+pU/1WfaRJhvaMjHjhFrTMoowJyBKagg== X-Received: by 2002:a62:3a92:: with SMTP id v18mr6425603pfj.43.1550012980900; Tue, 12 Feb 2019 15:09:40 -0800 (PST) Received: from rohan.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id x23sm43295032pfe.0.2019.02.12.15.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 15:09:40 -0800 (PST) From: Jim Wilson To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 15:09:26 -0800 Message-Id: <20190212230926.9273-1-jimw@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v4 5/5] RISC-V: Add hooks to use the gdb xml files. 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: qemu-riscv@nongnu.org, Jim Wilson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The gdb CSR xml file has registers in documentation order, not numerical order, so we need a table to map the register numbers. This also adds fairly standard gdb hooks to access xml specified registers. Signed-off-by: Jim Wilson Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 9 +- target/riscv/cpu.h | 2 + target/riscv/gdbstub.c | 348 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 347 insertions(+), 12 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 28d7e53..c23bd01 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -311,6 +311,8 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) return; } + riscv_cpu_register_gdb_regs_for_features(cs); + qemu_init_vcpu(cs); cpu_reset(cs); @@ -351,7 +353,12 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->synchronize_from_tb = riscv_cpu_synchronize_from_tb; cc->gdb_read_register = riscv_cpu_gdb_read_register; cc->gdb_write_register = riscv_cpu_gdb_write_register; - cc->gdb_num_core_regs = 65; + cc->gdb_num_core_regs = 33; +#if defined(TARGET_RISCV32) + cc->gdb_core_xml_file = "riscv-32bit-cpu.xml"; +#elif defined(TARGET_RISCV64) + cc->gdb_core_xml_file = "riscv-64bit-cpu.xml"; +#endif cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = riscv_cpu_disas_set_info; #ifdef CONFIG_USER_ONLY diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 04a050e..c10e86c 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -329,6 +329,8 @@ typedef struct { void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops); void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops); +void riscv_cpu_register_gdb_regs_for_features(CPUState *cs); + #include "exec/cpu-all.h" #endif /* RISCV_CPU_H */ diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 3cabb21..621206d 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -21,6 +21,255 @@ #include "exec/gdbstub.h" #include "cpu.h" +/* + * The GDB CSR xml files list them in documentation order, not numerical order, + * and are missing entries for unnamed CSRs. So we need to map the gdb numbers + * to the hardware numbers. + */ + +static int csr_register_map[] = { + CSR_USTATUS, + CSR_UIE, + CSR_UTVEC, + CSR_USCRATCH, + CSR_UEPC, + CSR_UCAUSE, + CSR_UTVAL, + CSR_UIP, + CSR_FFLAGS, + CSR_FRM, + CSR_FCSR, + CSR_CYCLE, + CSR_TIME, + CSR_INSTRET, + CSR_HPMCOUNTER3, + CSR_HPMCOUNTER4, + CSR_HPMCOUNTER5, + CSR_HPMCOUNTER6, + CSR_HPMCOUNTER7, + CSR_HPMCOUNTER8, + CSR_HPMCOUNTER9, + CSR_HPMCOUNTER10, + CSR_HPMCOUNTER11, + CSR_HPMCOUNTER12, + CSR_HPMCOUNTER13, + CSR_HPMCOUNTER14, + CSR_HPMCOUNTER15, + CSR_HPMCOUNTER16, + CSR_HPMCOUNTER17, + CSR_HPMCOUNTER18, + CSR_HPMCOUNTER19, + CSR_HPMCOUNTER20, + CSR_HPMCOUNTER21, + CSR_HPMCOUNTER22, + CSR_HPMCOUNTER23, + CSR_HPMCOUNTER24, + CSR_HPMCOUNTER25, + CSR_HPMCOUNTER26, + CSR_HPMCOUNTER27, + CSR_HPMCOUNTER28, + CSR_HPMCOUNTER29, + CSR_HPMCOUNTER30, + CSR_HPMCOUNTER31, + CSR_CYCLEH, + CSR_TIMEH, + CSR_INSTRETH, + CSR_HPMCOUNTER3H, + CSR_HPMCOUNTER4H, + CSR_HPMCOUNTER5H, + CSR_HPMCOUNTER6H, + CSR_HPMCOUNTER7H, + CSR_HPMCOUNTER8H, + CSR_HPMCOUNTER9H, + CSR_HPMCOUNTER10H, + CSR_HPMCOUNTER11H, + CSR_HPMCOUNTER12H, + CSR_HPMCOUNTER13H, + CSR_HPMCOUNTER14H, + CSR_HPMCOUNTER15H, + CSR_HPMCOUNTER16H, + CSR_HPMCOUNTER17H, + CSR_HPMCOUNTER18H, + CSR_HPMCOUNTER19H, + CSR_HPMCOUNTER20H, + CSR_HPMCOUNTER21H, + CSR_HPMCOUNTER22H, + CSR_HPMCOUNTER23H, + CSR_HPMCOUNTER24H, + CSR_HPMCOUNTER25H, + CSR_HPMCOUNTER26H, + CSR_HPMCOUNTER27H, + CSR_HPMCOUNTER28H, + CSR_HPMCOUNTER29H, + CSR_HPMCOUNTER30H, + CSR_HPMCOUNTER31H, + CSR_SSTATUS, + CSR_SEDELEG, + CSR_SIDELEG, + CSR_SIE, + CSR_STVEC, + CSR_SCOUNTEREN, + CSR_SSCRATCH, + CSR_SEPC, + CSR_SCAUSE, + CSR_STVAL, + CSR_SIP, + CSR_SATP, + CSR_MVENDORID, + CSR_MARCHID, + CSR_MIMPID, + CSR_MHARTID, + CSR_MSTATUS, + CSR_MISA, + CSR_MEDELEG, + CSR_MIDELEG, + CSR_MIE, + CSR_MTVEC, + CSR_MCOUNTEREN, + CSR_MSCRATCH, + CSR_MEPC, + CSR_MCAUSE, + CSR_MTVAL, + CSR_MIP, + CSR_PMPCFG0, + CSR_PMPCFG1, + CSR_PMPCFG2, + CSR_PMPCFG3, + CSR_PMPADDR0, + CSR_PMPADDR1, + CSR_PMPADDR2, + CSR_PMPADDR3, + CSR_PMPADDR4, + CSR_PMPADDR5, + CSR_PMPADDR6, + CSR_PMPADDR7, + CSR_PMPADDR8, + CSR_PMPADDR9, + CSR_PMPADDR10, + CSR_PMPADDR11, + CSR_PMPADDR12, + CSR_PMPADDR13, + CSR_PMPADDR14, + CSR_PMPADDR15, + CSR_MCYCLE, + CSR_MINSTRET, + CSR_MHPMCOUNTER3, + CSR_MHPMCOUNTER4, + CSR_MHPMCOUNTER5, + CSR_MHPMCOUNTER6, + CSR_MHPMCOUNTER7, + CSR_MHPMCOUNTER8, + CSR_MHPMCOUNTER9, + CSR_MHPMCOUNTER10, + CSR_MHPMCOUNTER11, + CSR_MHPMCOUNTER12, + CSR_MHPMCOUNTER13, + CSR_MHPMCOUNTER14, + CSR_MHPMCOUNTER15, + CSR_MHPMCOUNTER16, + CSR_MHPMCOUNTER17, + CSR_MHPMCOUNTER18, + CSR_MHPMCOUNTER19, + CSR_MHPMCOUNTER20, + CSR_MHPMCOUNTER21, + CSR_MHPMCOUNTER22, + CSR_MHPMCOUNTER23, + CSR_MHPMCOUNTER24, + CSR_MHPMCOUNTER25, + CSR_MHPMCOUNTER26, + CSR_MHPMCOUNTER27, + CSR_MHPMCOUNTER28, + CSR_MHPMCOUNTER29, + CSR_MHPMCOUNTER30, + CSR_MHPMCOUNTER31, + CSR_MCYCLEH, + CSR_MINSTRETH, + CSR_MHPMCOUNTER3H, + CSR_MHPMCOUNTER4H, + CSR_MHPMCOUNTER5H, + CSR_MHPMCOUNTER6H, + CSR_MHPMCOUNTER7H, + CSR_MHPMCOUNTER8H, + CSR_MHPMCOUNTER9H, + CSR_MHPMCOUNTER10H, + CSR_MHPMCOUNTER11H, + CSR_MHPMCOUNTER12H, + CSR_MHPMCOUNTER13H, + CSR_MHPMCOUNTER14H, + CSR_MHPMCOUNTER15H, + CSR_MHPMCOUNTER16H, + CSR_MHPMCOUNTER17H, + CSR_MHPMCOUNTER18H, + CSR_MHPMCOUNTER19H, + CSR_MHPMCOUNTER20H, + CSR_MHPMCOUNTER21H, + CSR_MHPMCOUNTER22H, + CSR_MHPMCOUNTER23H, + CSR_MHPMCOUNTER24H, + CSR_MHPMCOUNTER25H, + CSR_MHPMCOUNTER26H, + CSR_MHPMCOUNTER27H, + CSR_MHPMCOUNTER28H, + CSR_MHPMCOUNTER29H, + CSR_MHPMCOUNTER30H, + CSR_MHPMCOUNTER31H, + CSR_MHPMEVENT3, + CSR_MHPMEVENT4, + CSR_MHPMEVENT5, + CSR_MHPMEVENT6, + CSR_MHPMEVENT7, + CSR_MHPMEVENT8, + CSR_MHPMEVENT9, + CSR_MHPMEVENT10, + CSR_MHPMEVENT11, + CSR_MHPMEVENT12, + CSR_MHPMEVENT13, + CSR_MHPMEVENT14, + CSR_MHPMEVENT15, + CSR_MHPMEVENT16, + CSR_MHPMEVENT17, + CSR_MHPMEVENT18, + CSR_MHPMEVENT19, + CSR_MHPMEVENT20, + CSR_MHPMEVENT21, + CSR_MHPMEVENT22, + CSR_MHPMEVENT23, + CSR_MHPMEVENT24, + CSR_MHPMEVENT25, + CSR_MHPMEVENT26, + CSR_MHPMEVENT27, + CSR_MHPMEVENT28, + CSR_MHPMEVENT29, + CSR_MHPMEVENT30, + CSR_MHPMEVENT31, + CSR_TSELECT, + CSR_TDATA1, + CSR_TDATA2, + CSR_TDATA3, + CSR_DCSR, + CSR_DPC, + CSR_DSCRATCH, + CSR_HSTATUS, + CSR_HEDELEG, + CSR_HIDELEG, + CSR_HIE, + CSR_HTVEC, + CSR_HSCRATCH, + CSR_HEPC, + CSR_HCAUSE, + CSR_HBADADDR, + CSR_HIP, + CSR_MBASE, + CSR_MBOUND, + CSR_MIBASE, + CSR_MIBOUND, + CSR_MDBASE, + CSR_MDBOUND, + CSR_MUCOUNTEREN, + CSR_MSCOUNTEREN, + CSR_MHCOUNTEREN, +}; + int riscv_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { RISCVCPU *cpu = RISCV_CPU(cs); @@ -30,13 +279,6 @@ int riscv_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) return gdb_get_regl(mem_buf, env->gpr[n]); } else if (n == 32) { return gdb_get_regl(mem_buf, env->pc); - } else if (n < 65) { - return gdb_get_reg64(mem_buf, env->fpr[n - 33]); - } else if (n < 4096 + 65) { - target_ulong val = 0; - if (riscv_csrrw(env, n - 65, &val, 0, 0) == 0) { - return gdb_get_regl(mem_buf, val); - } } return 0; } @@ -55,14 +297,98 @@ int riscv_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) } else if (n == 32) { env->pc = ldtul_p(mem_buf); return sizeof(target_ulong); - } else if (n < 65) { - env->fpr[n - 33] = ldq_p(mem_buf); /* always 64-bit */ + } + return 0; +} + +static int riscv_gdb_get_fpu(CPURISCVState *env, uint8_t *mem_buf, int n) +{ + if (n < 32) { + return gdb_get_reg64(mem_buf, env->fpr[n]); + } else if (n < 35) { + target_ulong val = 0; + int result; + /* + * CSR_FFLAGS is 0x001, and gdb says it is FP register 32, so we + * subtract 31 to map the gdb FP register number to the CSR number. + * This also works for CSR_FRM and CSR_FCSR. + */ + result = riscv_csrrw_debug(env, n - 31, &val, 0, 0); + if (result == 0) { + return gdb_get_regl(mem_buf, val); + } + } + return 0; +} + +static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_t *mem_buf, int n) +{ + if (n < 32) { + env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */ return sizeof(uint64_t); - } else if (n < 4096 + 65) { + } else if (n < 35) { target_ulong val = ldtul_p(mem_buf); - if (riscv_csrrw(env, n - 65, NULL, val, -1) == 0) { + int result; + /* + * CSR_FFLAGS is 0x001, and gdb says it is FP register 32, so we + * subtract 31 to map the gdb FP register number to the CSR number. + * This also works for CSR_FRM and CSR_FCSR. + */ + result = riscv_csrrw_debug(env, n - 31, NULL, val, -1); + if (result == 0) { return sizeof(target_ulong); } } return 0; } + +static int riscv_gdb_get_csr(CPURISCVState *env, uint8_t *mem_buf, int n) +{ + if (n < ARRAY_SIZE(csr_register_map)) { + target_ulong val = 0; + int result; + + result = riscv_csrrw_debug(env, csr_register_map[n], &val, 0, 0); + if (result == 0) { + return gdb_get_regl(mem_buf, val); + } + } + return 0; +} + +static int riscv_gdb_set_csr(CPURISCVState *env, uint8_t *mem_buf, int n) +{ + if (n < ARRAY_SIZE(csr_register_map)) { + target_ulong val = ldtul_p(mem_buf); + int result; + + result = riscv_csrrw_debug(env, csr_register_map[n], NULL, val, -1); + if (result == 0) { + return sizeof(target_ulong); + } + } + return 0; +} + +void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) +{ + RISCVCPU *cpu = RISCV_CPU(cs); + CPURISCVState *env = &cpu->env; +#if defined(TARGET_RISCV32) + if (env->misa & RVF) { + gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, + 35, "riscv-32bit-fpu.xml", 0); + } + + gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, + 4096, "riscv-32bit-csr.xml", 0); +#elif defined(TARGET_RISCV64) + if (env->misa & RVF) { + gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu, + 35, "riscv-64bit-fpu.xml", 0); + } + + gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, + 4096, "riscv-64bit-csr.xml", 0); +#endif +}