[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm: Some cleanups to vlapic emulation.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1198062845 0 # Node ID 181483b8e9590ed161d209c10276e9cc80b97431 # Parent 9d447ba0c99af9d6ad842b30079163cd05f1939a hvm: Some cleanups to vlapic emulation. Some of this was suggested by Dexuan Cui. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/hvm/vlapic.c | 41 ++++++++++++++++++++++------------------- 1 files changed, 22 insertions(+), 19 deletions(-) diff -r 9d447ba0c99a -r 181483b8e959 xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Wed Dec 19 10:11:54 2007 +0000 +++ b/xen/arch/x86/hvm/vlapic.c Wed Dec 19 11:14:05 2007 +0000 @@ -472,7 +472,7 @@ static unsigned long vlapic_read(struct struct vlapic *vlapic = vcpu_vlapic(v); unsigned int offset = address - vlapic_base_address(vlapic); - if ( offset > APIC_TDCR ) + if ( offset > (APIC_TDCR + 0x3) ) return 0; alignment = offset & 0x3; @@ -535,7 +535,7 @@ static void vlapic_write(struct vcpu *v, * According to the IA32 Manual, all accesses should be 32 bits. * Some OSes do 8- or 16-byte accesses, however. */ - val &= 0xffffffff; + val = (uint32_t)val; if ( len != 4 ) { unsigned int tmp; @@ -549,32 +549,27 @@ static void vlapic_write(struct vcpu *v, switch ( len ) { case 1: - val = (tmp & ~(0xff << (8*alignment))) | - ((val & 0xff) << (8*alignment)); + val = ((tmp & ~(0xff << (8*alignment))) | + ((val & 0xff) << (8*alignment))); break; case 2: if ( alignment & 1 ) - { - gdprintk(XENLOG_ERR, "Uneven alignment error for " - "2-byte vlapic access\n"); - goto exit_and_crash; - } - - val = (tmp & ~(0xffff << (8*alignment))) | - ((val & 0xffff) << (8*alignment)); + goto unaligned_exit_and_crash; + val = ((tmp & ~(0xffff << (8*alignment))) | + ((val & 0xffff) << (8*alignment))); break; default: gdprintk(XENLOG_ERR, "Local APIC write with len = %lx, " "should be 4 instead\n", len); - exit_and_crash: - domain_crash(v->domain); - return; - } - } - - offset &= 0xff0; + goto exit_and_crash; + } + } + else if ( (offset & 0x3) != 0 ) + goto unaligned_exit_and_crash; + + offset &= ~0x3; switch ( offset ) { @@ -671,6 +666,14 @@ static void vlapic_write(struct vcpu *v, "Local APIC Write to read-only register 0x%x\n", offset); break; } + + return; + + unaligned_exit_and_crash: + gdprintk(XENLOG_ERR, "Unaligned LAPIC write len=0x%lx at offset=0x%x.\n", + len, offset); + exit_and_crash: + domain_crash(v->domain); } static int vlapic_range(struct vcpu *v, unsigned long addr) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |