On Wed, Feb 6, 2019 at 6:05 PM Jim Wilson <j...@sifive.com> wrote: > > On Wed, Feb 6, 2019 at 4:04 PM Alistair Francis <alistai...@gmail.com> 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; #endif result = riscv_csrrw(env, ...); #if !defined(CONFIG_USER_ONLY) env->debugger = false; #endif } Alistair > > 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