Long story short: I'd like to get the pointer to the current process' first level translation table on MIPS.
On x86 I get it from CR3. On ARM I use TTBR for this purpose. How to do this on MIPS (without accessing current
Here is some elaboration on why I need it.
I have to get some info on the current process in Linux running in QEMU system emulator. My code runs on the host, as a part of QEMU. Lets assume that I know all the relevant offsets in the guest kernel structures.
When the guest is in kernel mode (if it's not a kernel thread), it is possible to get the current
task_struct directly, via
thread_info that is located on the kernel stack.
However, when the guest is in user mode, I have to traverse the
task_struct list, comparing each
task->mm->pgd (actually the appropriate physical address) to the current translation table pointer. The latter is what I'm looking for.
The PTE base address can be read from the MIPS CP0 Context register (#4).
See chapter 16 of See MIPS Run: Low-level Memory Management and the TLB.