On Sat, Apr 02, 2016 at 07:01:34AM -0700, Andy Lutomirski wrote: > This removes a bunch of assembly and adds some C code instead. It > changes the actual printouts on both 32-bit and 64-bit kernels, but > they still seem okay. > > Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx> > --- > arch/x86/include/asm/uaccess.h | 2 +- > arch/x86/kernel/head_32.S | 49 +++++------------------------------------- > arch/x86/kernel/head_64.S | 45 ++------------------------------------ > arch/x86/mm/extable.c | 29 ++++++++++++++++++++----- > 4 files changed, 32 insertions(+), 93 deletions(-) ... > @@ -99,21 +101,38 @@ int __init early_fixup_exception(struct pt_regs *regs, int trapnr) > > /* Ignore early NMIs. */ > if (trapnr == X86_TRAP_NMI) > - return 1; > + return; > + > + if (early_recursion_flag > 2) > + goto halt_loop; > + > + if (regs->cs != __KERNEL_CS) > + goto fail; > > e = search_exception_tables(regs->ip); > if (!e) > - return 0; > + goto fail; > > new_ip = ex_fixup_addr(e); > handler = ex_fixup_handler(e); > > /* special handling not supported during early boot */ > if (handler != ex_handler_default) > - return 0; > + goto fail; > > regs->ip = new_ip; > - return 1; > + return; > + > +fail: > + early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n", > + (unsigned)trapnr, (unsigned long)regs->cs, regs->ip, > + regs->orig_ax, read_cr2()); > + > + show_regs(regs); To make this even better, it could be something called early_show_regs() or so and be a simplified version of __show_regs() on both bitness but which calls early_printk(). This way you'll be able to get out stuff to the console as early as possible. Btw, you don't need to dump rIP, CR2, etc in the PANIC message above since you're going to early_show_regs() anyway. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html