From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 4/7] x86emul: fold SrcImmByte fetching Date: Thu, 11 Aug 2016 06:05:19 -0600 Message-ID: <57AC861F02000078001050D2@prv-mh.provo.novell.com> References: <57AC83530200007800105078@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1523E3EF.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXojj-0005BP-Ti for xen-devel@lists.xenproject.org; Thu, 11 Aug 2016 12:05:24 +0000 In-Reply-To: <57AC83530200007800105078@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1523E3EF.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline There's no need for having identical code spelled out twice. Signed-off-by: Jan Beulich --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1979,9 +1979,12 @@ x86_emulate( goto done; break; case SrcImm: + if ( !(d & ByteOp) ) + src.bytes =3D op_bytes !=3D 8 ? op_bytes : 4; + else + case SrcImmByte: + src.bytes =3D 1; src.type =3D OP_IMM; - src.bytes =3D (d & ByteOp) ? 1 : op_bytes; - if ( src.bytes =3D=3D 8 ) src.bytes =3D 4; /* NB. Immediates are sign-extended as necessary. */ switch ( src.bytes ) { @@ -1990,11 +1993,6 @@ x86_emulate( case 4: src.val =3D insn_fetch_type(int32_t); break; } break; - case SrcImmByte: - src.type =3D OP_IMM; - src.bytes =3D 1; - src.val =3D insn_fetch_type(int8_t); - break; } =20 /* Decode and fetch the destination operand: register or memory. */ --=__Part1523E3EF.1__= Content-Type: text/plain; name="x86emul-fold-SrcImmByte-fetching.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86emul-fold-SrcImmByte-fetching.patch" x86emul: fold SrcImmByte fetching=0A=0AThere's no need for having = identical code spelled out twice.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/x86_emulate/x86_emulate.c=0A+++= b/xen/arch/x86/x86_emulate/x86_emulate.c=0A@@ -1979,9 +1979,12 @@ = x86_emulate(=0A goto done;=0A break;=0A case = SrcImm:=0A+ if ( !(d & ByteOp) )=0A+ src.bytes =3D = op_bytes !=3D 8 ? op_bytes : 4;=0A+ else=0A+ case SrcImmByte:=0A+= src.bytes =3D 1;=0A src.type =3D OP_IMM;=0A- = src.bytes =3D (d & ByteOp) ? 1 : op_bytes;=0A- if ( src.bytes = =3D=3D 8 ) src.bytes =3D 4;=0A /* NB. Immediates are sign-extended = as necessary. */=0A switch ( src.bytes )=0A {=0A@@ = -1990,11 +1993,6 @@ x86_emulate(=0A case 4: src.val =3D insn_fetch_= type(int32_t); break;=0A }=0A break;=0A- case SrcImmByte= :=0A- src.type =3D OP_IMM;=0A- src.bytes =3D 1;=0A- = src.val =3D insn_fetch_type(int8_t);=0A- break;=0A }=0A =0A = /* Decode and fetch the destination operand: register or memory. */=0A --=__Part1523E3EF.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__Part1523E3EF.1__=--