kvm_vz_badvaddr_to_gpa(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ kvm_vz_badvaddr_to_gpa(9) β€” the Kernel API Manual glow-up

okay so bestie, welcome to the kvm_vz_badvaddr_to_gpa page from the Kernel API Manual, section 9. yes it's a mouthful, no you don't have to say it out loud at a party. it's giving "small function, big responsibility" and honestly? iconic. πŸŽ€

✨ NAME ✨

kvm_vz_badvaddr_to_gpa β€” the little guy that converts a GVA BadVAddr from a root exception into a GPA. literally translation services for addresses. 🌸

πŸ¦‹ SYNOPSIS πŸ¦‹

int kvm_vz_badvaddr_to_gpa (struct kvm_vcpu *vcpu , unsigned long
badvaddr , unsigned long *gpa );

copy it exactly like that, spacing and all, she's particular about her signature bestie πŸ’…

πŸ“ ARGUMENTS πŸ“

  • vcpu β€” the KVM VCPU state. the main character whose state we're peeking at πŸ‘‘
  • badvaddr β€” the Root BadVAddr. yes that's the actual name, no I didn't make it up, and yes it's a mood fr fr 😭
  • gpa β€” the output guest physical address. where the answer goes to live ✨

🌈 DESCRIPTION 🌈

okay so here's the tea. VZ implementations are permitted to report guest virtual addresses (GVA) in BadVAddr on a root exception during guest execution β€” instead of the guest physical addresses (GPA), which are, and I cannot stress this enough, way more convenient. so rude of them honestly πŸ’€

so when we get handed a GVA like that, this function converts it to a GPA. and it's not just vibes β€” it takes guest segmentation and guest TLB state into account. highkey thorough. 🫢

⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • -errno on failure πŸ˜” (the classic)
ngl bestie, check that return value. -errno on failure is a real thing that can happen, and you do not want to be out here assuming 0 🚨

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, in the kernel file ./arch/mips/kvm/vz.c:


and that's the page bestie, you ate that πŸ’– this gem lives in the ./arch/mips/kvm directory, stamped October 2026, and it's filed under the very cute name kvm_vz_badvaddr_to_gpa(9). go forth and convert those addresses, periodt πŸ§šβ€β™€οΈπŸ’œ

πŸ“¦ where this page comes from