[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-riscv] [Qemu-devel] [PATCH 5/5 v3] RISC-V: Add hooks to use th

From: Alistair Francis
Subject: Re: [Qemu-riscv] [Qemu-devel] [PATCH 5/5 v3] RISC-V: Add hooks to use the gdb xml files.
Date: Fri, 8 Feb 2019 10:16:56 -0800

On Wed, Feb 6, 2019 at 6:05 PM Jim Wilson <address@hidden> wrote:
> On Wed, Feb 6, 2019 at 4:04 PM Alistair Francis <address@hidden> wrote:
> > Would it not be easier to add an extra argument to the functions
> > intstead of setting and unsetting this?
> >
> > That's what you had in the earlier version of this set.
> The csr support was rewritten, and is now a table of functions.  If I
> change the type signature for one function in a table column I have to
> change them all.  This means I have to change the type signature of
> about 50 functions, the vast majority of which will never use the new
> argument.  I was hoping to avoid that, so I added a variable into the
> cpu state instead.  In the old patch, before the csr rewrite, I only
> had to change the type signature of a couple of functions, most of
> which did use the new argument, so that was reasonable at the time.

Ah good point.

Can we just write a wrapper function then that sets and unsets the variable?

Something like this:

riscv_csrrw_debug(...) {
    #if !defined(CONFIG_USER_ONLY)
            env->debugger = true;
            result = riscv_csrrw(env, ...);
    #if !defined(CONFIG_USER_ONLY)
            env->debugger = false;


> If I do need to change a lot of type signatures, what about attribute
> ((unused))?  I see that there is a ATTRIBUTE_UNUSED in the disas dir
> but it is apparently not used outside there, and only defined in
> include/disas/bfd.h.  I see a few scattered uses of
> attribute((unused)) but that seems unwise for portability reasons.
> Maybe qemu doesn't care about unused arguments/parameters?
> Jim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]