From: "Jan Beulich" Subject: [PATCH 1/4] x86/HVM: replace plain number in hvm_combine_hw_exceptions() Date: Thu, 22 Jan 2015 13:57:17 +0000 Message-ID: <54C10FCD0200007800058291@mail.emea.novell.com> References: <54C10EE1020000780005827E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part5164C9AD.1__=" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEIG5-0004HE-PJ for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 13:57:17 +0000 In-Reply-To: <54C10EE1020000780005827E@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser 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. --=__Part5164C9AD.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While doing so also take care of #VE here (even if we don't make use of it yet). Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -205,6 +205,16 @@ int hvm_event_needs_reinjection(uint8_t=20 */ uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t vec2) { + const unsigned int contributory_exceptions =3D + (1 << TRAP_divide_error) | + (1 << TRAP_invalid_tss) | + (1 << TRAP_no_segment) | + (1 << TRAP_stack_error) | + (1 << TRAP_gp_fault); + const unsigned int page_faults =3D + (1 << TRAP_page_fault) | + (1 << TRAP_virtualisation); + /* Exception during double-fault delivery always causes a triple = fault. */ if ( vec1 =3D=3D TRAP_double_fault ) { @@ -213,11 +223,12 @@ uint8_t hvm_combine_hw_exceptions(uint8_ } =20 /* Exception during page-fault delivery always causes a double fault. = */ - if ( vec1 =3D=3D TRAP_page_fault ) + if ( (1u << vec1) & page_faults ) return TRAP_double_fault; =20 /* Discard the first exception if it's benign or if we now have a = #PF. */ - if ( !((1u << vec1) & 0x7c01u) || (vec2 =3D=3D TRAP_page_fault) ) + if ( !((1u << vec1) & contributory_exceptions) || + ((1u << vec2) & page_faults) ) return vec2; =20 /* Cannot combine the exceptions: double fault. */ --=__Part5164C9AD.1__= Content-Type: text/plain; name="x86-HVM-combine-exceptions.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-HVM-combine-exceptions.patch" x86/HVM: replace plain number in hvm_combine_hw_exceptions()=0A=0AWhile = doing so also take care of #VE here (even if we don't make use of=0Ait = yet).=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/x86/hvm/hvm.c=0A+++ b/xen/arch/x86/hvm/hvm.c=0A@@ -205,6 = +205,16 @@ int hvm_event_needs_reinjection(uint8_t =0A */=0A uint8_t = hvm_combine_hw_exceptions(uint8_t vec1, uint8_t vec2)=0A {=0A+ const = unsigned int contributory_exceptions =3D=0A+ (1 << TRAP_divide_error= ) |=0A+ (1 << TRAP_invalid_tss) |=0A+ (1 << TRAP_no_segment) = |=0A+ (1 << TRAP_stack_error) |=0A+ (1 << TRAP_gp_fault);=0A+= const unsigned int page_faults =3D=0A+ (1 << TRAP_page_fault) = |=0A+ (1 << TRAP_virtualisation);=0A+=0A /* Exception during = double-fault delivery always causes a triple fault. */=0A if ( vec1 = =3D=3D TRAP_double_fault )=0A {=0A@@ -213,11 +223,12 @@ uint8_t = hvm_combine_hw_exceptions(uint8_=0A }=0A =0A /* Exception during = page-fault delivery always causes a double fault. */=0A- if ( vec1 = =3D=3D TRAP_page_fault )=0A+ if ( (1u << vec1) & page_faults )=0A = return TRAP_double_fault;=0A =0A /* Discard the first exception if = it's benign or if we now have a #PF. */=0A- if ( !((1u << vec1) & = 0x7c01u) || (vec2 =3D=3D TRAP_page_fault) )=0A+ if ( !((1u << vec1) & = contributory_exceptions) ||=0A+ ((1u << vec2) & page_faults) )=0A = return vec2;=0A =0A /* Cannot combine the exceptions: double = fault. */=0A --=__Part5164C9AD.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part5164C9AD.1__=--