uint64_t get_pml4e (vmi_instance_t vmi, addr_t vaddr, reg_t cr3) { uint64_t value = 0; addr_t pml4e_address = get_bits_51to12(cr3) | get_pml4_index(vaddr); dbprint("--PTLookup pml4e_address = 0x%.16"PRIx64"\n", pml4e_address); vmi_read_64_pa(vmi, pml4e_address, &value); return value; }
static inline uint64_t get_pml4e (vmi_instance_t vmi, addr_t vaddr, reg_t cr3, addr_t *pml4e_address) { uint64_t value; *pml4e_address = get_bits_51to12(cr3) | get_pml4_index(vaddr); dbprint(VMI_DEBUG_PTLOOKUP, "--PTLookup pml4e_address = 0x%.16"PRIx64"\n", *pml4e_address); if(VMI_FAILURE == vmi_read_64_pa(vmi, *pml4e_address, &value)) { value = 0; } return value; }
static inline status_t get_pml4e (vmi_instance_t vmi, addr_t vaddr, reg_t cr3, addr_t *pml4e_address, uint64_t *pml4e_value) { *pml4e_value = 0; *pml4e_address = (cr3 & VMI_BIT_MASK(12,51)) | get_pml4_index(vaddr); if(VMI_FAILURE == vmi_read_64_pa(vmi, *pml4e_address, pml4e_value)) { dbprint(VMI_DEBUG_PTLOOKUP, "--PTLookup: error reading pml4e_address = 0x%.16"PRIx64"\n", *pml4e_address); return VMI_FAILURE; } dbprint(VMI_DEBUG_PTLOOKUP, "--PTLookup: pml4e_address = 0x%.16"PRIx64"\n", *pml4e_address); return VMI_SUCCESS; }