x86/traps: remove redundant trapnr parameter from fatal_trap()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 3 Sep 2014 13:07:49 +0000 (15:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Sep 2014 13:07:49 +0000 (15:07 +0200)
It is always available via regs->entry_vector.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/nmi.c
xen/arch/x86/traps.c
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/processor.h

index 812daf6e8fedbd21271606a481a610d9b41e72df..05a86fb951570323fbb1f74361cb88c19d1e698e 100644 (file)
@@ -74,7 +74,7 @@ static void unexpected_machine_check(const struct cpu_user_regs *regs)
 {
     console_force_unlock();
     printk("Unexpected Machine Check Exception\n");
-    fatal_trap(TRAP_machine_check, regs);
+    fatal_trap(regs);
 }
 
 
index 7d15d5b42af8e31ba2a0e6571e7597e067b4a1a9..055f4efc2deaccfe6221261195db8210d6310186 100644 (file)
@@ -472,7 +472,7 @@ bool_t nmi_watchdog_tick(const struct cpu_user_regs *regs)
             console_force_unlock();
             printk("Watchdog timer detects that CPU%d is stuck!\n",
                    smp_processor_id());
-            fatal_trap(TRAP_nmi, regs);
+            fatal_trap(regs);
         }
     } 
     else 
index 7f5306f2bfe4547a18380ef649e5d9c53fa5ac38..10fc2ca902072bae5f2f1df87f8775bfca5d2d4a 100644 (file)
@@ -394,9 +394,10 @@ static const char *trapstr(unsigned int trapnr)
  * are disabled). In such situations we can't do much that is safe. We try to
  * print out some tracing and then we just spin.
  */
-void fatal_trap(int trapnr, const struct cpu_user_regs *regs)
+void fatal_trap(const struct cpu_user_regs *regs)
 {
     static DEFINE_PER_CPU(char, depth);
+    unsigned int trapnr = regs->entry_vector;
 
     /* Set AC to reduce chance of further SMAP faults */
     stac();
@@ -1427,7 +1428,7 @@ void do_page_fault(struct cpu_user_regs *regs)
         {
             console_start_sync();
             printk("Xen SM%cP violation\n", (pf_type == smep_fault) ? 'E' : 'A');
-            fatal_trap(TRAP_page_fault, regs);
+            fatal_trap(regs);
         }
 
         if ( pf_type != real_fault )
@@ -1498,7 +1499,7 @@ void __init do_early_page_fault(struct cpu_user_regs *regs)
         console_start_sync();
         printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n",
                regs->cs, _p(regs->eip), _p(cr2), regs->error_code);
-        fatal_trap(TRAP_page_fault, regs);
+        fatal_trap(regs);
     }
 }
 
@@ -3256,7 +3257,7 @@ static void pci_serr_error(const struct cpu_user_regs *regs)
     default:  /* 'fatal' */
         console_force_unlock();
         printk("\n\nNMI - PCI system error (SERR)\n");
-        fatal_trap(TRAP_nmi, regs);
+        fatal_trap(regs);
     }
 }
 
@@ -3271,7 +3272,7 @@ static void io_check_error(const struct cpu_user_regs *regs)
     default:  /* 'fatal' */
         console_force_unlock();
         printk("\n\nNMI - I/O ERROR\n");
-        fatal_trap(TRAP_nmi, regs);
+        fatal_trap(regs);
     }
 
     outb((inb(0x61) & 0x0f) | 0x08, 0x61); /* clear-and-disable IOCK */
@@ -3291,7 +3292,7 @@ static void unknown_nmi_error(const struct cpu_user_regs *regs, unsigned char re
         console_force_unlock();
         printk("Uhhuh. NMI received for unknown reason %02x.\n", reason);
         printk("Do you have a strange power saving mode enabled?\n");
-        fatal_trap(TRAP_nmi, regs);
+        fatal_trap(regs);
     }
 }
 
index a3ed216b390c2e87a21ff377850ee34ee7f2bc74..42835d034153e51cf415d1455b3e2f33cea05a3b 100644 (file)
@@ -536,8 +536,7 @@ exception_with_ints_disabled:
 
 /* No special register assumptions. */
 FATAL_exception_with_ints_disabled:
-        movzbl UREGS_entry_vector(%rsp),%edi
-        movq  %rsp,%rsi
+        movq  %rsp,%rdi
         call  fatal_trap
         ud2
 
index a156e01d80aee050536dccd65fa60884e0135c59..9e1f210e6e09aaf9db68d75d1e7fca8b6341d025 100644 (file)
@@ -481,7 +481,7 @@ void show_registers(const struct cpu_user_regs *regs);
 void show_execution_state(const struct cpu_user_regs *regs);
 #define dump_execution_state() run_in_exception_handler(show_execution_state)
 void show_page_walk(unsigned long addr);
-void noreturn fatal_trap(int trapnr, const struct cpu_user_regs *regs);
+void noreturn fatal_trap(const struct cpu_user_regs *regs);
 
 void compat_show_guest_stack(struct vcpu *v,
                              const struct cpu_user_regs *regs, int lines);