diff mbox

x86emul: drop redundant #GP checks

Message ID 56B45E6C02000078000CED7D@prv-mh.provo.novell.com
State New, archived
Headers show

Commit Message

Jan Beulich Feb. 5, 2016, 7:33 a.m. UTC
in_protmode() implies !in_realmode(), so we don't need to check both.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86emul: drop redundant #GP checks

in_protmode() implies !in_realmode(), so we don't need to check both.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3972,7 +3972,6 @@ x86_emulate(
         uint64_t msr_content;
         struct segment_register cs, ss;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
@@ -4218,7 +4217,6 @@ x86_emulate(
         int lm;
 
         generate_exception_if(mode_ring0(), EXC_GP, 0);
-        generate_exception_if(in_realmode(ctxt, ops), EXC_GP, 0);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_GP, 0);
 
         fail_if(ops->read_msr == NULL);
@@ -4267,7 +4265,6 @@ x86_emulate(
         bool_t user64 = !!(rex_prefix & REX_W);
 
         generate_exception_if(!mode_ring0(), EXC_GP, 0);
-        generate_exception_if(in_realmode(ctxt, ops), EXC_GP, 0);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_GP, 0);
 
         fail_if(ops->read_msr == NULL);

Comments

Andrew Cooper Feb. 5, 2016, 2:16 p.m. UTC | #1
On 05/02/16 07:33, Jan Beulich wrote:
> in_protmode() implies !in_realmode(), so we don't need to check both.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3972,7 +3972,6 @@  x86_emulate(
         uint64_t msr_content;
         struct segment_register cs, ss;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
@@ -4218,7 +4217,6 @@  x86_emulate(
         int lm;
 
         generate_exception_if(mode_ring0(), EXC_GP, 0);
-        generate_exception_if(in_realmode(ctxt, ops), EXC_GP, 0);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_GP, 0);
 
         fail_if(ops->read_msr == NULL);
@@ -4267,7 +4265,6 @@  x86_emulate(
         bool_t user64 = !!(rex_prefix & REX_W);
 
         generate_exception_if(!mode_ring0(), EXC_GP, 0);
-        generate_exception_if(in_realmode(ctxt, ops), EXC_GP, 0);
         generate_exception_if(!in_protmode(ctxt, ops), EXC_GP, 0);
 
         fail_if(ops->read_msr == NULL);