]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Unify and shorten the I/L/GDT paths in x86_exc_decode_ec()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 21 Oct 2016 13:17:19 +0000 (14:17 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 21 Oct 2016 13:17:26 +0000 (14:17 +0100)
The split between L/GDT selector (in hex) and IDT index (in decimal) is
awkward to read when both types of errors are seen together.  Furthermore, the
vec/sel text adds unncessary length to the message.

Switch to uniformally reporting the table index in C array syntax which is
shorter to express.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/decode.c

index 5924d2353856b321aa2238ca7ca81912a49026ed..0922036ae385fab87ee4620bdb770bc6c31a3148 100644 (file)
@@ -54,17 +54,12 @@ int x86_exc_decode_ec(char *buf, size_t bufsz, unsigned int ev, unsigned int ec)
     case X86_EXC_GP: case X86_EXC_AC:
         if ( ec != 0 )
         {
-            if ( ec & X86_EC_IDT )
-                return snprintf(buf, bufsz,
-                                "IDT vec %u%s",
-                                ec >> X86_EC_SEL_SHIFT,
-                                ec & X86_EC_EXT ? " EXT" : "");
-            else
-                return snprintf(buf, bufsz,
-                                "%cDT sel %#x%s",
-                                ec & X86_EC_TI ? 'L' : 'G',
-                                ec & X86_EC_SEL_MASK,
-                                ec & X86_EC_EXT ? " EXT" : "");
+            return snprintf(buf, bufsz,
+                            "%cDT[%u]%s",
+                            ec & X86_EC_IDT ? 'I' :
+                            (ec & X86_EC_TI ? 'L' : 'G'),
+                            ec >> X86_EC_SEL_SHIFT,
+                            ec & X86_EC_EXT ? ",EXT" : "");
         }
 
         /* Fallthrough */