[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write()
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write() |
Date: |
Tue, 26 May 2015 19:16:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
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