On Fri, 22 Sept 2023 at 19:59, Warner Losh <i...@bsdimp.com> wrote: > The third one, though, makes me ask the question: When should we > pass in cpu_env to functions and when should we use the global value? > > I have a lot of changes that look like: > > -static inline abi_long do_freebsd_thr_exit(CPUArchState *cpu_env, > +static inline abi_long do_freebsd_thr_exit(CPUArchState *env, > abi_ulong tid_addr) > { > - CPUState *cpu = env_cpu(cpu_env); > + CPUState *cpu = env_cpu(env); > TaskState *ts; > ... > <other cases of cpu_env -> env> > > Should I just drop the arg, or do the arg rename? Or "Gee, Warner, > that really depends since it's context sensitive" in which case > I'll just post a review to the list.
Is this the "extern TCGv_env cpu_env;" in tcg/tcg.h ? As a TCGv_env, that is only of any use in the TCG frontends, not in the bsd-user/ or linux-user/ code. In fact almost all of tcg/tcg.h is intended for the TCG frontends, so the "ideal" solution to this would be to not include it in the bsd-user code. This might mean figuring out what parts of it need to be split out into different headers. (linux-user also includes tcg/tcg.h.) However, this isn't necessary for the current effort, because -Wshadow=local only warns about local-to-local shadowing, not cases where a local shadows a global. thanks -- PMM