Message ID | 20181019010625.25294-8-cota@braap.org |
---|---|
State | New |
Headers | show |
Series | per-CPU locks | expand |
On 10/19/18 2:05 AM, Emilio G. Cota wrote: > To avoid a name clash with the soon-to-be-defined cpu_halted() helper. > > Cc: Laurent Vivier <laurent@vivier.eu> > Signed-off-by: Emilio G. Cota <cota@braap.org> > --- > target/m68k/translate.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Although for this usage it's probably better to avoid the tcg_global_mem_new_i32 and just use tcg_gen_st_i32. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 10/21/18 1:53 PM, Richard Henderson wrote: > On 10/19/18 2:05 AM, Emilio G. Cota wrote: >> To avoid a name clash with the soon-to-be-defined cpu_halted() helper. >> >> Cc: Laurent Vivier <laurent@vivier.eu> >> Signed-off-by: Emilio G. Cota <cota@braap.org> >> --- >> target/m68k/translate.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) > > Although for this usage it's probably better to avoid the > tcg_global_mem_new_i32 and just use tcg_gen_st_i32. And, as I read further, you need to convert this use to a helper call. Otherwise you've still got an unlocked direct modification to cpu->halted from within the TCG generated code. There are several other targets that do the same thing: alpha, cris, hppa, mips, microblaze, ppc. And typically they will do exactly the same thing: set the flag and then raise the halt exception. r~
On Sun, Oct 21, 2018 at 14:38:38 +0100, Richard Henderson wrote: > On 10/21/18 1:53 PM, Richard Henderson wrote: > > On 10/19/18 2:05 AM, Emilio G. Cota wrote: > >> To avoid a name clash with the soon-to-be-defined cpu_halted() helper. > >> > >> Cc: Laurent Vivier <laurent@vivier.eu> > >> Signed-off-by: Emilio G. Cota <cota@braap.org> > >> --- > >> target/m68k/translate.c | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > > > > Although for this usage it's probably better to avoid the > > tcg_global_mem_new_i32 and just use tcg_gen_st_i32. > > And, as I read further, you need to convert this use to a helper call. > Otherwise you've still got an unlocked direct modification to cpu->halted > from within the TCG generated code. > > There are several other targets that do the same thing: alpha, cris, hppa, > mips, microblaze, ppc. And typically they will do exactly the same thing: set > the flag and then raise the halt exception. Ouch -- I entirely missed these! For v4, I defined helper_cpu_halted_set in tcg-runtime, and converted all direct setters to it. Thanks, Emilio
diff --git a/target/m68k/translate.c b/target/m68k/translate.c index ae3651b867..86491048f8 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -43,7 +43,7 @@ #undef DEFO32 #undef DEFO64 -static TCGv_i32 cpu_halted; +static TCGv_i32 cpu_halt; static TCGv_i32 cpu_exception_index; static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; @@ -79,7 +79,7 @@ void m68k_tcg_init(void) #undef DEFO32 #undef DEFO64 - cpu_halted = tcg_global_mem_new_i32(cpu_env, + cpu_halt = tcg_global_mem_new_i32(cpu_env, -offsetof(M68kCPU, env) + offsetof(CPUState, halted), "HALTED"); cpu_exception_index = tcg_global_mem_new_i32(cpu_env, @@ -4646,7 +4646,7 @@ DISAS_INSN(stop) ext = read_im16(env, s); gen_set_sr_im(s, ext, 0); - tcg_gen_movi_i32(cpu_halted, 1); + tcg_gen_movi_i32(cpu_halt, 1); gen_exception(s, s->pc, EXCP_HLT); }
To avoid a name clash with the soon-to-be-defined cpu_halted() helper. Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Emilio G. Cota <cota@braap.org> --- target/m68k/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)