On 10/12/2017 01:32 PM, Lluís Vilanova wrote: > Richard Henderson writes: > >> On 10/11/2017 11:43 PM, Lluís Vilanova wrote: >>>> /* Track which vCPU triggers events */ >>>> CPUState *cpu; /* *_trans */ >>>> - TCGv_env tcg_env; /* *_exec */ >>> >>> I would rather keep it here instead of making a new global variable, since >>> that >>> should make it easier in the future to have multiple translation contexts. > >> Why do you believe this prevents it? The variable is literally identical for >> *all* targets. > > If someone decides to make tcg_ctx thread-local or have one per target > architecture (supporting multiple target archs concurrently), having all that > info on the tcg_ctx object is easier to track and modify, compared to having > multiple global variables.
We have patches on-list that do exactly this, from Emilio Cota. I'm in the process of reviewing them now. We've made sure that patch set works with the cpu_* global variables created once within target/*/translate.c. This one is no different. r~