qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Getting current PGD on address@hidden


From: Peter Maydell
Subject: Re: [Qemu-devel] Getting current PGD on address@hidden
Date: Sat, 18 Jul 2015 22:40:00 +0100

On 18 July 2015 at 20:30, Igor R <address@hidden> wrote:
> Hello,
>
> On x86 one can get the current PGD from CR3. What's the right way to
> do this on ARM?

What's a PGD ?

> In a code based on an old QEMU version, I see the following:
> pgd = env->cp15.c2_base0 & env->cp15.c2_base_mask;

We renamed those, both to be in line with the terminology
use by the architecture reference manual and because we
need to support things like the hypervisor and trustzone
extensions. The equivalent things are now in a TCR struct
which has mask and base_mask fields.

However just looking at base & mask is not necessarily
correct -- depending on the configuration of the CPU we
might be using translation table base control registers
in a different format, in which case mask and base_mask
are meaningless. (See the comment in vmsa_ttbcr_raw_write().)

> But in the recent QEMU version c2_base0 field is absent. Instead,
> there's ttbr0[] array. So should I just use ttbr0[current_el]?

What are you trying to do inside QEMU with the page tables?
If you want to know how ARM does virtual-to-physical
translation, start with get_phys_addr() and work through
it. You'll probably need to look at the architecture
reference manual too...

thanks
-- PMM



reply via email to

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