Skip to content

Commit fb1248e

Browse files
binbinwu1lijinxia
authored andcommitted
hv: remove cr3 handling from cr_access_vmexit_handler
Guest CR3 read/write operations are not trapped. Remove CR3 handling in cr_access_vmexit_handler. Also remove unused API vmx_read_cr3. Signed-off-by: Binbin Wu <binbin.wu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
1 parent 2df7b96 commit fb1248e

File tree

3 files changed

+0
-21
lines changed

3 files changed

+0
-21
lines changed

hypervisor/arch/x86/vmexit.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,21 +292,10 @@ int cr_access_vmexit_handler(struct vcpu *vcpu)
292292
/* mov to cr0 */
293293
vmx_write_cr0(vcpu, *regptr);
294294
break;
295-
296-
case 0x03:
297-
/* mov to cr3 */
298-
vmx_write_cr3(vcpu, *regptr);
299-
break;
300-
301295
case 0x04:
302296
/* mov to cr4 */
303297
vmx_write_cr4(vcpu, *regptr);
304298
break;
305-
306-
case 0x13:
307-
/* mov from cr3 */
308-
vmx_read_cr3(vcpu, regptr);
309-
break;
310299
#if 0
311300
case 0x14:
312301
/* mov from cr4 (this should not happen) */

hypervisor/arch/x86/vmx.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,6 @@ int vmx_write_cr0(struct vcpu *vcpu, uint64_t value)
287287
return 0;
288288
}
289289

290-
int vmx_read_cr3(struct vcpu *vcpu, uint64_t *value)
291-
{
292-
*value = vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context].cr3;
293-
294-
pr_dbg("VMM: reading 0x%08x from CR3", *value);
295-
296-
return 0;
297-
}
298-
299290
int vmx_write_cr3(struct vcpu *vcpu, uint64_t value)
300291
{
301292
/* Write to guest's CR3 */

hypervisor/include/arch/x86/vmx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ int exec_vmclear(void *addr);
465465
int exec_vmptrld(void *addr);
466466

467467
int vmx_write_cr0(struct vcpu *vcpu, uint64_t cr0);
468-
int vmx_read_cr3(struct vcpu *vcpu, uint64_t *cr3);
469468
int vmx_write_cr3(struct vcpu *vcpu, uint64_t cr3);
470469
int vmx_write_cr4(struct vcpu *vcpu, uint64_t cr4);
471470

0 commit comments

Comments
 (0)