On 2/9/2023 10:40 AM, Robert Hoo wrote: [...]
- +#ifdef CONFIG_X86_64 + root_pgd = mmu->get_guest_pgd(vcpu) & ~(X86_CR3_LAM_U48 | X86_CR3_LAM_U57); +#else root_pgd = mmu->get_guest_pgd(vcpu); +#endif
I prefer using: root_pgd = mmu->get_guest_pgd(vcpu); if (IS_ENABLED(CONFIG_X86_64)) root_pgd &= ~(X86_CR3_LAM_U48 | X86_CR3_LAM_U57); I looks more structured.
root_gfn = root_pgd >> PAGE_SHIFT;if (mmu_check_root(vcpu, root_gfn))