]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: traps: Simplify the switch in do_trap_*_abort_guest
authorJulien Grall <julien.grall@arm.com>
Thu, 4 Aug 2016 17:50:02 +0000 (18:50 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 4 Aug 2016 17:53:30 +0000 (10:53 -0700)
The fault status we care are in the form BBBBxx where xx is the lookup
level that gave the fault. We can simplify the code by masking the 2 least
significant bits.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/traps.c

index 0f78d2121b0ddeeff5cd906dbb000937211b35e7..b11d2e5766453fb379c36549fbf5cbb60d340a5d 100644 (file)
@@ -2387,9 +2387,9 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
     int rc;
     register_t gva = READ_SYSREG(FAR_EL2);
 
-    switch ( hsr.iabt.ifsc & 0x3f )
+    switch ( hsr.iabt.ifsc & ~FSC_LL_MASK )
     {
-    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+    case FSC_FLT_PERM:
     {
         paddr_t gpa;
         const struct npfec npfec = {
@@ -2450,9 +2450,9 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
             return; /* Try again */
     }
 
-    switch ( dabt.dfsc & 0x3f )
+    switch ( dabt.dfsc & ~FSC_LL_MASK )
     {
-    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+    case FSC_FLT_PERM:
     {
         const struct npfec npfec = {
             .read_access = !dabt.write,