diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-11-16 00:05:55 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:03 -0500 |
commit | 8b0067913d9d0439d4cf3c1f7314ba71fc7b2958 (patch) | |
tree | a8de1898124085d7f4157ee6812413f65900af37 /drivers/kvm/x86.c | |
parent | e08aa78ae5747c6e1dc525e8a40f23c2ea61d757 (diff) |
KVM: Portability: Make kvm_vcpu_ioctl_translate arch dependent
Move kvm_vcpu_ioctl_translate to arch, since mmu would be put under arch.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86.c')
-rw-r--r-- | drivers/kvm/x86.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index 609792637fb4..f1746afab9e5 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c | |||
@@ -2318,6 +2318,28 @@ struct fxsave { | |||
2318 | #endif | 2318 | #endif |
2319 | }; | 2319 | }; |
2320 | 2320 | ||
2321 | /* | ||
2322 | * Translate a guest virtual address to a guest physical address. | ||
2323 | */ | ||
2324 | int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, | ||
2325 | struct kvm_translation *tr) | ||
2326 | { | ||
2327 | unsigned long vaddr = tr->linear_address; | ||
2328 | gpa_t gpa; | ||
2329 | |||
2330 | vcpu_load(vcpu); | ||
2331 | mutex_lock(&vcpu->kvm->lock); | ||
2332 | gpa = vcpu->mmu.gva_to_gpa(vcpu, vaddr); | ||
2333 | tr->physical_address = gpa; | ||
2334 | tr->valid = gpa != UNMAPPED_GVA; | ||
2335 | tr->writeable = 1; | ||
2336 | tr->usermode = 0; | ||
2337 | mutex_unlock(&vcpu->kvm->lock); | ||
2338 | vcpu_put(vcpu); | ||
2339 | |||
2340 | return 0; | ||
2341 | } | ||
2342 | |||
2321 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | 2343 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) |
2322 | { | 2344 | { |
2323 | struct fxsave *fxsave = (struct fxsave *)&vcpu->guest_fx_image; | 2345 | struct fxsave *fxsave = (struct fxsave *)&vcpu->guest_fx_image; |