[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] guest physical address equal host virtual address ?
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] guest physical address equal host virtual address ? |
Date: |
Wed, 27 Oct 2010 20:22:35 +0000 |
On Wed, Oct 27, 2010 at 6:14 AM, <address@hidden> wrote:
>
>>As I remember it, it's on the lines of:
>
>>tlb_entry = env->tlb_table[mem_index][hash(guest_virtual_address)];
>>if (tlb_entry.<access_type> == guest_virtual_address) {
>> host_virtual_address = tlb_entry.addend
>>} else {
>> call the slow path through __ld routines
>>}
>
> No, At qemu-0.10.0
> host_virtual_addres = guest virtual address + tlb_entry.addend
> not as :
> host_virtual_address = tlb_entry.addend
>
> Can you explain more?
This is the TLB calculation when taking out checks, for the RAM address case:
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ;
addend = env->tlb_table[mmu_idx][index].addend;
res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend));
TLB addend is calculated in exec.c, tlb_set_page():
addend = (unsigned long)qemu_get_ram_ptr(pd & TARGET_PAGE_MASK);
te->addend = addend - vaddr;
So taking into account both, the virtual address is subtracted,
leaving only host pointer to RAM area.