# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1183970840 -3600
# Node ID 27e993c80ceb13364f0ceff058ef7f6747d7ddb2
# Parent 99143d572521c872f6d116a9f708b650bb2f8388
VMX: Fix function return code when a GP fault is generated on CR accesses.
Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>
---
xen/arch/x86/hvm/vmx/vmx.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff -r 99143d572521 -r 27e993c80ceb xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Mon Jul 09 09:41:45 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Jul 09 09:47:20 2007 +0100
@@ -2153,7 +2153,7 @@ static int vmx_assist(struct vcpu *v, in
goto error;
if ( cp != 0 ) {
vmx_world_save(v, &c);
- if ( hvm_copy_to_guest_phys(cp, &c, sizeof(c)))
+ if ( hvm_copy_to_guest_phys(cp, &c, sizeof(c)) )
goto error;
}
@@ -2220,7 +2220,7 @@ static int vmx_set_cr0(unsigned long val
/* ET is reserved and should be always be 1. */
value |= X86_CR0_ET;
- if ( (value & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG )
+ if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
{
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
return 0;
@@ -2253,12 +2253,11 @@ static int vmx_set_cr0(unsigned long val
HVM_DBG_LOG(DBG_LEVEL_1, "Guest enabled paging "
"with EFER.LME set but not CR4.PAE");
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
+ return 0;
}
- else
- {
- HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode");
- vmx_enable_long_mode(v);
- }
+
+ HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode");
+ vmx_enable_long_mode(v);
}
/*
@@ -2312,8 +2311,8 @@ static int vmx_set_cr0(unsigned long val
*/
if ( (value & X86_CR0_PE) == 0 )
{
- if ( value & X86_CR0_PG ) {
- /* inject GP here */
+ if ( value & X86_CR0_PG )
+ {
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
return 0;
}
@@ -2408,7 +2407,8 @@ static int mov_to_cr(int gp, int cr, str
/*
* If paging is not enabled yet, simply copy the value to CR3.
*/
- if ( !vmx_paging_enabled(v) ) {
+ if ( !vmx_paging_enabled(v) )
+ {
v->arch.hvm_vmx.cpu_cr3 = value;
break;
}
@@ -2454,7 +2454,7 @@ static int mov_to_cr(int gp, int cr, str
"Guest attempts to set reserved bit in CR4: %lx",
value);
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
- break;
+ return 0;
}
if ( (value & X86_CR4_PAE) && !(old_cr & X86_CR4_PAE) )
@@ -2472,7 +2472,6 @@ static int mov_to_cr(int gp, int cr, str
/*
* Now arch.guest_table points to machine physical.
*/
-
old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
v->arch.guest_table = pagetable_from_pfn(mfn);
if ( old_base_mfn )
@@ -2494,6 +2493,7 @@ static int mov_to_cr(int gp, int cr, str
HVM_DBG_LOG(DBG_LEVEL_1, "Guest cleared CR4.PAE while "
"EFER.LMA is set");
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
+ return 0;
}
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|