qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Jonathan Behrens <jonathan@fintelia.io>
Cc: "open list:RISC-V" <qemu-riscv@nongnu.org>,
	Sagar Karandikar <sagark@eecs.berkeley.edu>,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Palmer Dabbelt <palmer@sifive.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Alistair Francis <Alistair.Francis@wdc.com>
Subject: Re: [PATCH v3 3/3] target/riscv: Make the priv register writable by GDB
Date: Tue, 8 Oct 2019 09:49:39 -0700	[thread overview]
Message-ID: <CAKmqyKN1LZjcd5wJ8PAFvh+RWxwWB9+zJOdh5_t4xjaFKCgc+g@mail.gmail.com> (raw)
In-Reply-To: <20191008001318.219367-4-jonathan@fintelia.io>

On Mon, Oct 7, 2019 at 5:20 PM Jonathan Behrens <jonathan@fintelia.io> wrote:
>
> Currently only PRV_U, PRV_S and PRV_M are supported, so this patch ensures that
> the privilege mode is set to one of them. Once support for the H-extension is
> added, this code will also need to properly update the virtualization status
> when switching between VU/VS-modes and M-mode.
>
> Signed-off-by: Jonathan Behrens <jonathan@fintelia.io>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/gdbstub.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
> index 33cf7c4c7d..bc84b599c2 100644
> --- a/target/riscv/gdbstub.c
> +++ b/target/riscv/gdbstub.c
> @@ -387,6 +387,15 @@ static int riscv_gdb_get_virtual(CPURISCVState *cs, uint8_t *mem_buf, int n)
>
>  static int riscv_gdb_set_virtual(CPURISCVState *cs, uint8_t *mem_buf, int n)
>  {
> +    if (n == 0) {
> +#ifndef CONFIG_USER_ONLY
> +        cs->priv = ldtul_p(mem_buf) & 0x3;
> +        if (cs->priv == PRV_H) {
> +            cs->priv = PRV_S;
> +        }
> +#endif
> +        return sizeof(target_ulong);
> +    }
>      return 0;
>  }
>
> --
> 2.23.0
>


  parent reply	other threads:[~2019-10-08 16:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  0:13 [PATCH v3 0/3] target/riscv: Expose "priv" register for GDB Jonathan Behrens
2019-10-08  0:13 ` [PATCH v3 1/3] target/riscv: Tell gdbstub the correct number of CSRs Jonathan Behrens
2019-10-08  9:53   ` Bin Meng
2019-10-08 14:01     ` Jonathan Behrens
2019-10-08 16:18   ` Alistair Francis
2019-10-08  0:13 ` [PATCH v3 2/3] target/riscv: Expose priv register for GDB for reads Jonathan Behrens
2019-10-08 12:27   ` Bin Meng
2019-10-08 14:03     ` Jonathan Behrens
2019-10-08  0:13 ` [PATCH v3 3/3] target/riscv: Make the priv register writable by GDB Jonathan Behrens
2019-10-08 12:32   ` Bin Meng
2019-10-08 16:49   ` Alistair Francis [this message]
2019-10-08  0:17 ` [PATCH v3 0/3] target/riscv: Expose "priv" register for GDB Jonathan Behrens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKmqyKN1LZjcd5wJ8PAFvh+RWxwWB9+zJOdh5_t4xjaFKCgc+g@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=jonathan@fintelia.io \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=palmer@sifive.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=sagark@eecs.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).