Exemplo n.º 1
0
void
do_page_fault(struct pt_regs *regs, unsigned int vector)
{
	/* Kernel space exception fixup check */
	if (fixup_exception(regs))
		return;

	unsigned long cr2 = read_cr2();

#ifdef CONFIG_KGDB
	kgdb_breakpoint();
#endif

	struct siginfo s;
	memset(&s, 0, sizeof(struct siginfo));
	s.si_signo = SIGSEGV;
	s.si_errno = 0;
	s.si_addr  = (void *)cr2;
	s.si_code  = SEGV_ACCERR; // SEGV_MAPERR;

	int i = sigsend(current->aspace->id, ANY_ID, SIGSEGV, &s);
	printk(">> PAGE FAULT! Sent signal %d. CR2 is %p, cpu %d\n", i, (void *)cr2, this_cpu);
	show_registers(regs);

	/* If the fault occurred in kernel space, or the init_task, go down */
	if ( (regs->rip >= PAGE_OFFSET) ||
	     (current->aspace->id == INIT_ASPACE_ID)) 
	{
		local_irq_disable();
		halt();
	}
}
Exemplo n.º 2
0
static int show(t_hydra_console *con, t_tokenline_parsed *p)
{
	mode_config_proto_t* proto = &con->mode->proto;
	int tokens_used;

	tokens_used = 0;
	if (p->tokens[1] == T_REGISTERS) {
		tokens_used++;
		show_registers(con);
	} else {

		switch(proto->dev_function) {
		case NFC_TYPEA:
			cprintf(con, "Protocol: TypeA (ISO14443A => MIFARE...)\r\n");
			break;
		case NFC_VICINITY:
			cprintf(con, "Protocol: Vicinity (ISO/IEC 15693)\r\n");
			break;
		default:
			cprintf(con, "Protocol: Unknown\r\n");
			break;
		}
	}

	return tokens_used;
}
Exemplo n.º 3
0
void show_regs(struct pt_regs *regs)
{
	extern void show_registers(struct pt_regs *regs);

	/* __PHX__ cleanup this mess */
	show_registers(regs);
}
Exemplo n.º 4
0
void
do_segment_not_present(struct pt_regs *regs, unsigned int vector)
{
	printk("Segment Not Present Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 5
0
void
do_spurious_interrupt_bug(struct pt_regs *regs, unsigned int vector)
{
	printk("Spurious Interrupt Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 6
0
void
do_alignment_check(struct pt_regs *regs, unsigned int vector)
{
	printk("Alignment Check Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 7
0
void
do_machine_check(struct pt_regs *regs, unsigned int vector)
{
	printk("Machine Check Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 8
0
void
do_general_protection(struct pt_regs *regs, unsigned int vector)
{
	printk("General Protection Exception, cpu %d\n", this_cpu);
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 9
0
void
do_coprocessor_error(struct pt_regs *regs, unsigned int vector)
{
	printk("Coprocessor Error Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 10
0
void show_regs(struct pt_regs *regs)
{
	extern void show_registers(struct pt_regs *regs);

	
	show_registers(regs);
}
Exemplo n.º 11
0
void
do_coproc_segment_overrun(struct pt_regs *regs, unsigned int vector)
{
	printk("Coprocessor Segment Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 12
0
/* This is normally the Oops function. */
void die_if_kernel(const char *str, struct pt_regs *regs, long err)
{
	if (user_mode(regs))
		return;

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	/*
	 * This printout might take too long and could trigger
	 * the watchdog normally. If NICE_DOGGY is set, simply
	 * stop the watchdog during the printout.
	 */
	stop_watchdog();
#endif

	oops_enter();
	handle_BUG(regs);

	pr_err("Linux %s %s\n", utsname()->release, utsname()->version);
	pr_err("%s: %04lx\n", str, err & 0xffff);

	show_registers(regs);

	oops_exit();
	oops_in_progress = 0;
	pr_err("\n"); /* Flush mtdoops.  */

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	reset_watchdog();
#endif
	do_exit(SIGSEGV);
}
Exemplo n.º 13
0
void
do_invalid_tss(struct pt_regs *regs, unsigned int vector)
{
	printk("Invalid TSS Exception)\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 14
0
void
do_double_fault(struct pt_regs *regs, unsigned int vector)
{
	printk("Double Fault Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 15
0
void
do_device_not_available(struct pt_regs *regs, unsigned int vector)
{
	printk("Device Not Available Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 16
0
void
do_bounds(struct pt_regs *regs, unsigned int vector)
{
	printk("Bounds Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 17
0
void
do_stack_segment(struct pt_regs *regs, unsigned int vector)
{
	printk("Stack Segment Exception\n");
	show_registers(regs);
	while (1) {}
}
Exemplo n.º 18
0
void show_regs(struct pt_regs *regs)
{
    extern void show_registers(struct pt_regs *regs);

    show_regs_print_info(KERN_DEFAULT);
    /* __PHX__ cleanup this mess */
    show_registers(regs);
}
Exemplo n.º 19
0
void nmi_watchdog_tick (struct pt_regs * regs)
{

   /*
    * Since current_thread_info()-> is always on the stack, and we
    * always switch the stack NMI-atomically, it's safe to use
    * smp_processor_id().
    */
   int sum, cpu = smp_processor_id();

   sum = irq_stat[cpu].apic_timer_irqs;

   if (last_irq_sums[cpu] == sum) {
      /*
       * Ayiee, looks like this CPU is stuck ...
       * wait a few IRQs (5 seconds) before doing the oops ...
       */
      alert_counter[cpu]++;
      if (alert_counter[cpu] == 5*nmi_hz) {
         spin_lock(&nmi_print_lock);
         /*
          * We are in trouble anyway, lets at least try
          * to get a message out.
          */
         bust_spinlocks(1);
         printk("NMI Watchdog detected LOCKUP on CPU%d, eip %08lx, registers:\n", cpu, regs->eip);
         show_registers(regs);
         printk("console shuts up ...\n");
         console_silent();
         spin_unlock(&nmi_print_lock);
         bust_spinlocks(0);
         do_exit(SIGSEGV);
      }
   } else {
      last_irq_sums[cpu] = sum;
      alert_counter[cpu] = 0;
   }
   if (nmi_perfctr_msr) {
      if (nmi_perfctr_msr == MSR_P4_IQ_COUNTER0) {
         /*
          * P4 quirks:
          * - An overflown perfctr will assert its interrupt
          *   until the OVF flag in its CCCR is cleared.
          * - LVTPC is masked on interrupt and must be
          *   unmasked by the LVTPC handler.
          */
         wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0, 0);
         apic_write(APIC_LVTPC, APIC_DM_NMI);
      }
      else if (nmi_perfctr_msr == MSR_P6_PERFCTR0) {
         /* Only P6 based Pentium M need to re-unmask
          * the apic vector but it doesn't hurt
          * other P6 variant */
         apic_write(APIC_LVTPC, APIC_DM_NMI);
      }
      wrmsr(nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000), -1);
   }
}
Exemplo n.º 20
0
void show_regs(struct pt_regs *regs)
{
	show_regs_print_info(KERN_DEFAULT);
	show_registers(regs);
	/* Show stack backtrace if pt_regs is from kernel mode */
	if (!user_mode(regs))
		show_trace(NULL, (unsigned long *) regs->gprs[15]);
	show_last_breaking_event(regs);
}
Exemplo n.º 21
0
void
oops_nmi_handler(struct pt_regs *regs)
{
	stop_watchdog();
	oops_in_progress = 1;
	printk("NMI!\n");
	show_registers(regs);
	oops_in_progress = 0;
}
Exemplo n.º 22
0
void oops_nmi_handler(struct pt_regs *regs)
{
	stop_watchdog();
	oops_in_progress = 1;
	pr_err("NMI!\n");
	show_registers(regs);
	oops_in_progress = 0;
	oops_exit();
	pr_err("\n"); /* Flush mtdoops.  */
}
Exemplo n.º 23
0
void __die(const char *str, struct pt_regs *regs, const char *file,
	const char *func, unsigned long line)
{
	console_verbose();
	printk("%s", str);
	if (file && func)
		printk(" in %s:%s, line %ld", file, func, line);
	printk(":\n");
	show_registers(regs);
	do_exit(SIGSEGV);
}
Exemplo n.º 24
0
void die(const char * str, struct pt_regs * regs, long err)
{
	console_verbose();
	spin_lock_irq(&die_lock);
	bust_spinlocks(1);
	printk("%s: %04lx\n", str, err & 0xffff);
	show_registers(regs);
	bust_spinlocks(0);
	spin_unlock_irq(&die_lock);
	do_exit(SIGSEGV);
}
Exemplo n.º 25
0
/*
 * handle NMI
 */
asmlinkage void nmi(struct pt_regs *regs, enum exception_code code)
{
	/* see if gdbstub wants to deal with it */
#ifdef CONFIG_GDBSTUB
	if (gdbstub_intercept(regs, code))
		return;
#endif

	printk(KERN_WARNING "--- Register Dump ---\n");
	show_registers(regs);
	printk(KERN_WARNING "---------------------\n");
}
Exemplo n.º 26
0
static void io_check_error(unsigned char reason, struct pt_regs * regs)
{
	printk("NMI: IOCK error (debug interrupt?)\n");
	show_registers(regs);

	/* Re-enable the IOCK line, wait for a few seconds */
	reason = (reason & 0xf) | 8;
	outb(reason, 0x61);
	mdelay(2000);
	reason &= ~8;
	outb(reason, 0x61);
}
Exemplo n.º 27
0
void nmi_watchdog_tick (struct pt_regs * regs)
{

	/*
	 * Since current-> is always on the stack, and we always switch
	 * the stack NMI-atomically, it's safe to use smp_processor_id().
	 */
	int sum, cpu = smp_processor_id();

	sum = apic_timer_irqs[cpu];
#if defined(CONFIG_KGDB) && defined(CONFIG_SMP)
	if (atomic_read(&kgdb_lock)) {

		/*
		 * The machine is in kgdb, hold this cpu if already
		 * not held.
		 */

		if (!procindebug[cpu] && atomic_read(&kgdb_lock) != (cpu + 1)) {
			gdb_wait(regs);
		}
		alert_counter[cpu] = 0;
	} else
#endif
	if (last_irq_sums[cpu] == sum) {
		/*
		 * Ayiee, looks like this CPU is stuck ...
		 * wait a few IRQs (5 seconds) before doing the oops ...
		 */
		alert_counter[cpu]++;
		if (alert_counter[cpu] == 5*nmi_hz) {

			CHK_REMOTE_DEBUG(2,SIGSEGV,0,regs,)

			spin_lock(&nmi_print_lock);
			/*
			 * We are in trouble anyway, lets at least try
			 * to get a message out.
			 */
			bust_spinlocks(1);
			printk("NMI Watchdog detected LOCKUP on CPU%d, eip %08lx, registers:\n", cpu, regs->eip);
			show_registers(regs);
			printk("console shuts up ...\n");
			console_silent();
			spin_unlock(&nmi_print_lock);
			bust_spinlocks(0);
			do_exit(SIGSEGV);
		}
Exemplo n.º 28
0
/*
 * note the untimely death of part of the kernel
 */
void die(const char *str, struct pt_regs *regs, enum exception_code code)
{
	console_verbose();
	spin_lock_irq(&die_lock);
	printk(KERN_EMERG "\n"
	       KERN_EMERG "%s: %04x\n",
	       str, code & 0xffff);
	show_registers(regs);

	if (regs->pc >= 0x02000000 && regs->pc < 0x04000000 &&
	    (regs->epsw & (EPSW_IM | EPSW_IE)) != (EPSW_IM | EPSW_IE)) {
		printk(KERN_EMERG "Exception in usermode interrupt handler\n");
		printk(KERN_EMERG "\n"
		       KERN_EMERG "  Please connect to kernel debugger !!\n");
		asm volatile ("0: bra 0b");
	}
Exemplo n.º 29
0
void __domain_crash(struct domain *d)
{
    if ( d == current->domain )
    {
        printk("Domain %d (vcpu#%d) crashed on cpu#%d:\n",
               d->domain_id, current->vcpu_id, smp_processor_id());
        show_registers(guest_cpu_user_regs());
    }
    else
    {
        printk("Domain %d reported crashed by domain %d on cpu#%d:\n",
               d->domain_id, current->domain->domain_id, smp_processor_id());
    }

    domain_shutdown(d, SHUTDOWN_crash);
}
Exemplo n.º 30
0
void die_nmi(char *str, struct pt_regs *regs)
{
	unsigned long flags = oops_begin();

	/*
	 * We are in trouble anyway, lets at least try
	 * to get a message out.
	 */
	printk(str, safe_smp_processor_id());
	show_registers(regs);
	if (panic_on_timeout || panic_on_oops)
		panic("nmi watchdog");
	printk("console shuts up ...\n");
	oops_end(flags);
	do_exit(SIGSEGV);
}