This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] Fall back to a default value of 0 for the MISA register.


On Fri, 28 Sep 2018 02:43:55 PDT (-0700), andrew.burgess@embecosm.com wrote:
* Jim Wilson <jimw@sifive.com> [2018-09-21 10:25:47 -0700]:

On Fri, Sep 21, 2018 at 2:27 AM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
> Jim: Given that we agree that targets should definitely provide a
> value for misa, at a minimum just returning the constant 0.  But,
> given that GDB already defaults to 0 in some cases anyway.  And the
> spec is quite clear that 0 is the right default value in the absence
> of anything better, would you be OK with a patch that does return a
> default of 0?

The patch to decode an instruction to decide whether to use a
compressed breakpoint or not solves my main problem.  There is also
the issue of finding FP register size, but since we only support
rv64gc at the moment, it isn't a serious problem.

I regularly test embeded RiscV against:

  rv32im  rv32imc  rv32imf   rv32imfc

  rv64im  rv64imc  rv64imfd  rv64imfdc

with the last one of those being closes to rv64gc.  The pass rate is
broadly the same against all of these targets, so right now I consider
these equally supported for baremetal.

For those uniniated in RISC-V, "rv64gc" is the same as "rv64imafdc" (the G is short for IMAFD). Importantly it's probably close enough for embedded GDB testing, as all you're missing is the A extension and GDB doesn't really care about atomics.

I understand Linux support might be different.

Right now all that's really supported in Linux land is rv64gc. The kernel should also build on rv64imac, rv32gc, and rv32imac but they're much less mature. The upstream glibc port supports rv64gc and rv64imac, but we test those only on rv64gc kernels.

We try our best to avoid breaking the other targets, but until we get some better CI up and running I'd expect that non-rv64gc targets do keep falling apart. We're working on it :)

On Linux you should be able to look at the HWCAP in the auxvec, which is meant to tell you what user state is available. The code to fill this out is here

   https://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git/tree/arch/riscv/kernel/cpufeature.c#n26


Thanks,

Andrew


                                                   Also, I think the
linker kernel may already be passing FP info via auxvec/hwcap, so I
think we already have an alternate solution for that which just needs
to be implemented.  I haven't looked at that yet.  So yes, I think it
is OK to start defaulting misa to 0.

FYI I have a qemu patch, which I may someday finish, that adds XML
register support to the RISC-V qemu system-mode port, which allows
qemu to provide a correct value of misa.  We know that misa accesses
already work with embedded targets via OpenOCD.  So it is just linux
and freebsd that need to worry about misa.

The qemu patch is here, though it looks like github is confused by
rebasing and the patch isn't readable anymore.
    https://github.com/riscv/riscv-qemu/pull/160
I'll have to figure out how to fix that.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]