>> 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 > 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().) Ok, thanks, I'll take a look at it. >> 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. Thanks!