qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about CPUTLBEntry


From: Richard Henderson
Subject: Re: Question about CPUTLBEntry
Date: Wed, 30 Nov 2022 15:19:10 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 11/30/22 14:50, Nada Lachtar wrote:
Hello,


I’m trying to understand the structure of TLB in QEMU/tcg, in order to extract 
the physical address from the CPUTLBEntry. Would this be possible without 
having the virtual address and use tlb_lookup? For example, I would like to 
read all the physical addresses that are recorded in the TLB table without the 
need for a virtual address to translate the entry.

I would appreciate your help in directing me to what functions/structures to 
use to achieve this.

The virtual address of the CPUTLBEntry is recorded as the page-address bits in each of the three comparators: addr_read, addr_write, addr_code. This is documented in the comment right there with CPUTLBEntry (TARGET_LONG_BITS to TARGET_PAGE_BITS).

Bits below TARGET_PAGE_BITS are TLB flags, e.g. TLB_MMIO.

If TLB_INVALID_MASK is set in addr_{read,write,code}, the entry is not readable/writable/executable. If TLB_INVALID_MASK is set in all three, the entry is unused.

If CPUTLBEntry is valid, there is also a CPUTLBEntryFull structure in parallel, which contains (among other things), CPUTLBEntryFull.phys_addr, containing the cpu-side physical address for the address space given by CPUTLBEntryFull.attrs.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]