kvm_vz_badvaddr_to_gpa(9)
π 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 β
0on success π-errnoon failure π (the classic)
ngl bestie, check that return value.-errnoon failure is a real thing that can happen, and you do not want to be out here assuming0π¨
π₯ SEE ALSO π₯
the whole friend group, in the kernel file ./arch/mips/kvm/vz.c:
kvm_vz_should_use_htimer(9)_kvm_vz_restore_stimer(9)_kvm_vz_restore_htimer(9)kvm_vz_restore_timer(9)kvm_vz_acquire_htimer(9)_kvm_vz_save_htimer(9)kvm_vz_save_timer(9)kvm_vz_lose_htimer(9)is_eva_access(9)is_eva_am_mapped(9)kvm_vz_gva_to_gpa(9)kvm_trap_vz_handle_cop_unusable(9)kvm_trap_vz_handle_msa_disabled(9)kvm_vz_resize_guest_vtlb(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms