OperatingSystemBase.vtop

OperatingSystemBase.vtop(vaddr, pid=None, dtb=None, kernel_address_space=False)[source]

Translate a guest virtual address to a guest physical address.

While the vtop function of the virtual machine abstraction ( tenjint.plugins.machine.VirtualMachine.vtop()) translates addresses based on the architecture, this function tries to consider the intrinsics of the OS to translate an address. Since the OS has internal state that describes where paged-out data resides, this function is more powerful and might be able to translate some addresses that cannot be translate according to the hardware architecture. However, this function is only available if the OS can be detected.

Parameters
  • vaddr (int) – The virtual address to translate.

  • pid (int, optional) – The PID of the process to use as a basis for the translation. Since we have access to the entire OS, the translation of a virtual address depends on the address space that we use. If neither a PID nor a DTB is given and the kernel address space should not be used for the translation either, the default address space will be used.

  • dtb (int, optional) – The dtb to use as a basis for the translation. Since we have access to the entire OS, the translation of a virtual address depends on the address space that we use. If neither a PID nor a DTB is given and the kernel address space should not be used for the translation either, the default address space will be used.

  • kernel_address_space (bool, optional) – Whether to use the kernel address space as a basis for translation. Since we have access to the entire OS, the translation of a virtual address depends on the address space that we use. If neither a PID nor a DTB is given and the kernel address space should not be used for the translation either, the default address space will be used.

Returns

The physical address or None if the address cannot be translated.

Return type

int or None

Raises

ValueError – If the provided PID or DTB does not belong to a running process.