x86.c (af7cc7d1ee422a612f6785e347a893d44cc892ea) | x86.c (bebb106a5afa32efdf5332ed4a40bf4d6d06b56e) |
---|---|
1/* 2 * Kernel-based Virtual Machine driver for Linux 3 * 4 * derived from drivers/kvm/kvm_main.c 5 * 6 * Copyright (C) 2006 Qumranet, Inc. 7 * Copyright (C) 2008 Qumranet, Inc. 8 * Copyright IBM Corporation, 2008 --- 4002 unchanged lines hidden (view full) --- 4011EXPORT_SYMBOL_GPL(kvm_write_guest_virt_system); 4012 4013static int vcpu_mmio_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva, 4014 gpa_t *gpa, struct x86_exception *exception, 4015 bool write) 4016{ 4017 u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; 4018 | 1/* 2 * Kernel-based Virtual Machine driver for Linux 3 * 4 * derived from drivers/kvm/kvm_main.c 5 * 6 * Copyright (C) 2006 Qumranet, Inc. 7 * Copyright (C) 2008 Qumranet, Inc. 8 * Copyright IBM Corporation, 2008 --- 4002 unchanged lines hidden (view full) --- 4011EXPORT_SYMBOL_GPL(kvm_write_guest_virt_system); 4012 4013static int vcpu_mmio_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva, 4014 gpa_t *gpa, struct x86_exception *exception, 4015 bool write) 4016{ 4017 u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; 4018 |
4019 if (vcpu_match_mmio_gva(vcpu, gva) && 4020 check_write_user_access(vcpu, write, access, 4021 vcpu->arch.access)) { 4022 *gpa = vcpu->arch.mmio_gfn << PAGE_SHIFT | 4023 (gva & (PAGE_SIZE - 1)); 4024 return 1; 4025 } 4026 |
|
4019 if (write) 4020 access |= PFERR_WRITE_MASK; 4021 4022 *gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, exception); 4023 4024 if (*gpa == UNMAPPED_GVA) 4025 return -1; 4026 4027 /* For APIC access vmexit */ 4028 if ((*gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) 4029 return 1; 4030 | 4027 if (write) 4028 access |= PFERR_WRITE_MASK; 4029 4030 *gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, exception); 4031 4032 if (*gpa == UNMAPPED_GVA) 4033 return -1; 4034 4035 /* For APIC access vmexit */ 4036 if ((*gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) 4037 return 1; 4038 |
4039 if (vcpu_match_mmio_gpa(vcpu, *gpa)) 4040 return 1; 4041 |
|
4031 return 0; 4032} 4033 4034static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt, 4035 unsigned long addr, 4036 void *val, 4037 unsigned int bytes, 4038 struct x86_exception *exception) --- 2734 unchanged lines hidden --- | 4042 return 0; 4043} 4044 4045static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt, 4046 unsigned long addr, 4047 void *val, 4048 unsigned int bytes, 4049 struct x86_exception *exception) --- 2734 unchanged lines hidden --- |