[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] target/riscv: Expose "priv" register for GDB
From: |
Jonathan Behrens |
Subject: |
Re: [PATCH v2] target/riscv: Expose "priv" register for GDB |
Date: |
Mon, 7 Oct 2019 20:22:47 -0400 |
On Mon, Oct 7, 2019 at 2:36 PM Alistair Francis <address@hidden> wrote:
> On Fri, Oct 4, 2019 at 8:18 AM Jonathan Behrens <address@hidden> wrote:
> > @@ -296,6 +302,14 @@ 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 == 33) {
> > +#ifndef CONFIG_USER_ONLY
> > + env->priv = ldtul_p(mem_buf) & 0x3;
> > + if (env->priv == PRV_H) {
> > + env->priv = PRV_S;
> > + }
>
> Why have this? There is no PRV_H so we should never be in that privilege mode.
>
> Alistair
This is hopefully more clear in the next version, but the idea is that
since GDB can try to set the privilege mode to *any* value this
function needs to make sure that it isn't set to something unsupported
like PRV_H.
Jonathan