On 26/05/2015 18:58, Andreas Färber wrote: >> > +#if DATA_SIZE == 1 >> > +/* >> > + * Force a tlb_fill if the specified guest virtual index isn't in the TCG >> > + * softmmu TLB. >> > + */ >> > +void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx, >> > + uintptr_t retaddr) >> > +{ >> > + int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); >> > + target_ulong tlb_addr = env->tlb_table[mmu_idx][index].addr_write; >> > + >> > + if ((addr & TARGET_PAGE_MASK) >> > + != (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { >> > + /* TLB entry is for a different page */ >> > + if (!VICTIM_TLB_HIT(addr_write)) { >> > + tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, >> > retaddr); > Isn't the use of ENV_GET_CPU() here contradicting Peter C.'s series?
No, I don't think so. This function has a genuine need to access env's fields, so it is okay for it to accept CPUArchState*, especially because it is called from the TCG innards where everything is based on the CPUArchState* anyway. The functions touched by Peter's series (gdbserver_fork, tb_flush, tcg_cpu_exec, cpu_exec_init) don't, so they should accept CPUState*. In other words, it's okay to go from env to cpu, but you should do it as soon as possible. Paolo