Liu, Eric E
2007-Dec-19 09:34 UTC
[Xen-devel] x86_emulate(): forgot to generate_exception_if() for 0xff?
Hi all, In arch/x86/x86_emulate.c: x86_emulate(): 1716 case 0xfe: /* Grp4 */ 1717 generate_exception_if((m odrm_reg & 7) >= 2, EXC_UD); 1718 case 0xff: /* Grp5 */ 1719 switch ( modrm_reg & 7 ) 1720 { 1721 case 0: /* inc */ 1722 emulate_1op("inc", dst, _regs.eflags); 1723 break; 1724 case 1: /* dec */ 1725 emulate_1op("dec", dst, _regs.eflags); 1726 break; Here we only check 0xfe for "reg >= 2"? I think we should also check 0xff -- we should swap line 1717 and 1718? Thanks! --Eric (Liu, Feng) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2007-Dec-19 10:51 UTC
Re: [Xen-devel] x86_emulate(): forgot to generate_exception_if() for 0xff?
Why do you think that? Grp4 only defines valid opcodes for reg==000b and 001b. Grp5 defines valid opcodes for all except reg=111b. So the current code seems correct. -- Keir On 19/12/07 09:34, "Liu, Eric E" <eric.e.liu@intel.com> wrote:> Hi all, > In arch/x86/x86_emulate.c: x86_emulate(): > 1716 case 0xfe: /* Grp4 */ > 1717 generate_exception_if((m odrm_reg & 7) >= 2, EXC_UD); > 1718 case 0xff: /* Grp5 */ > 1719 switch ( modrm_reg & 7 ) > 1720 { > 1721 case 0: /* inc */ > 1722 emulate_1op("inc", dst, _regs.eflags); > 1723 break; > 1724 case 1: /* dec */ > 1725 emulate_1op("dec", dst, _regs.eflags); > 1726 break; > > Here we only check 0xfe for "reg >= 2"? I think we should also check > 0xff -- we should swap line 1717 and 1718? > > Thanks! > --Eric (Liu, Feng) > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2007-Dec-19 10:54 UTC
Re: [Xen-devel] x86_emulate(): forgot to generate_exception_if() for0xff?
>>> "Liu, Eric E" <eric.e.liu@intel.com> 19.12.07 10:34 >>> >Hi all, >In arch/x86/x86_emulate.c: x86_emulate(): > 1716 case 0xfe: /* Grp4 */ > 1717 generate_exception_if((m odrm_reg & 7) >= 2, EXC_UD); > 1718 case 0xff: /* Grp5 */ > 1719 switch ( modrm_reg & 7 ) > 1720 { > 1721 case 0: /* inc */ > 1722 emulate_1op("inc", dst, _regs.eflags); > 1723 break; > 1724 case 1: /* dec */ > 1725 emulate_1op("dec", dst, _regs.eflags); > 1726 break; > >Here we only check 0xfe for "reg >= 2"? I think we should also check >0xff -- we should swap line 1717 and 1718?Definitely not - 2...6 are valid for opcode 0xff (but aren''t for 0xfe). Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Liu, Eric E
2007-Dec-20 02:10 UTC
RE: [Xen-devel] x86_emulate(): forgot to generate_exception_if() for 0xff?
I see. Thanks --Eric -----Original Message----- From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk] Sent: 2007年12月19日 18:51 To: Liu, Eric E; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] x86_emulate(): forgot to generate_exception_if() for 0xff? Why do you think that? Grp4 only defines valid opcodes for reg==000b and 001b. Grp5 defines valid opcodes for all except reg=111b. So the current code seems correct. -- Keir On 19/12/07 09:34, "Liu, Eric E" <eric.e.liu@intel.com> wrote:> Hi all, > In arch/x86/x86_emulate.c: x86_emulate(): > 1716 case 0xfe: /* Grp4 */ > 1717 generate_exception_if((m odrm_reg & 7) >= 2, EXC_UD); > 1718 case 0xff: /* Grp5 */ > 1719 switch ( modrm_reg & 7 ) > 1720 { > 1721 case 0: /* inc */ > 1722 emulate_1op("inc", dst, _regs.eflags); > 1723 break; > 1724 case 1: /* dec */ > 1725 emulate_1op("dec", dst, _regs.eflags); > 1726 break; > > Here we only check 0xfe for "reg >= 2"? I think we should also check > 0xff -- we should swap line 1717 and 1718? > > Thanks! > --Eric (Liu, Feng) > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel