[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/emulation: honor failure of in_longmode()
Failure of in_longmode() shouldn't be treated the same as the function returning 'true'. Besides that, the function should always return false on 32-bits, eliminating the possibility for it failing there altogether. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- 2009-08-18.orig/xen/arch/x86/x86_emulate/x86_emulate.c 2009-08-18 14:18:20.000000000 +0200 +++ 2009-08-18/xen/arch/x86/x86_emulate/x86_emulate.c 2009-08-24 11:30:17.000000000 +0200 @@ -958,6 +958,7 @@ in_longmode( struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) { +#ifdef __x86_64__ uint64_t efer; if (ops->read_msr == NULL) @@ -965,6 +966,9 @@ in_longmode( ops->read_msr(MSR_EFER, &efer, ctxt); return !!(efer & EFER_LMA); +#else + return 0; +#endif } static int @@ -3605,7 +3609,10 @@ x86_emulate( ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */ #ifdef __x86_64__ - if ( in_longmode(ctxt, ops) ) + rc = in_longmode(ctxt, ops); + if ( rc < 0 ) + goto cannot_emulate; + if ( rc ) { cs.attr.fields.db = 0; cs.attr.fields.l = 1; @@ -3777,7 +3784,10 @@ x86_emulate( ss.limit = ~0u; /* 4GB limit */ ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */ - if ( in_longmode(ctxt, ops) ) + rc = in_longmode(ctxt, ops); + if ( rc < 0 ) + goto cannot_emulate; + if ( rc ) { cs.attr.fields.db = 0; cs.attr.fields.l = 1; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |