[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/HVM: replace plain number in hvm_combine_hw_exceptions()



commit 81db678e4dff0a398fecb59fb92fa41df9954e9c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Jan 23 15:03:28 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 23 15:03:28 2015 +0100

    x86/HVM: replace plain number in hvm_combine_hw_exceptions()
    
    While doing so also take care of #VE here (even if we don't make use of
    it yet). Note that contributory_exceptions, other than the original
    0x7c01 constant, doesn't include #PF anymore, but the check where the
    variable is used is after one that already filtered out #PF.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: TIm Deegan <tim@xxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index c7984d1..24f3333 100644
--- 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 type, uint8_t 
vector)
  */
 uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t vec2)
 {
+    const unsigned int contributory_exceptions =
+        (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 =
+        (1 << TRAP_page_fault) |
+        (1 << TRAP_virtualisation);
+
     /* Exception during double-fault delivery always causes a triple fault. */
     if ( vec1 == TRAP_double_fault )
     {
@@ -213,11 +223,12 @@ uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t 
vec2)
     }
 
     /* Exception during page-fault delivery always causes a double fault. */
-    if ( vec1 == TRAP_page_fault )
+    if ( (1u << vec1) & page_faults )
         return TRAP_double_fault;
 
     /* Discard the first exception if it's benign or if we now have a #PF. */
-    if ( !((1u << vec1) & 0x7c01u) || (vec2 == TRAP_page_fault) )
+    if ( !((1u << vec1) & contributory_exceptions) ||
+         ((1u << vec2) & page_faults) )
         return vec2;
 
     /* Cannot combine the exceptions: double fault. */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.