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: Sun, 19 Jul 2015 11:10:16 +0100

On 19 July 2015 at 06:40, Igor R <address@hidden> wrote:
>>> On x86 one can get the current PGD from CR3. What's the right way to
>>> do this on ARM?
>>
>> What's a PGD ?
>
> Page global directory

That doesn't help much -- I don't know x86 terminology and
it's not an ARM term.

>>> 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?
>
> When debugging (via gdbstub), I would like to get the current process
> id by a virtual address. When the virtual address is in the
> user-space, the only way to find the current task_struct I can think
> of is to iterate over all the task_struct's (assuming we know
> task_init and the offsets of the relevant fields), and compare
> task->mm->pgd against the current PGD.

If your kernel is configured with CONFIG_PID_IN_CONTEXTIDR
you can just read the PID out of CONTEXTIDR, which will
be much simpler. (You'd need to expose the contextidr via
gdbstub somehow, but then you'd need to do something in
QEMU to get at the TTBRs too.)

-- PMM



reply via email to

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